summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2024-02-21 09:38:24 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2024-02-21 09:38:24 +0100
commit957becbe2836d1bc4a8be76b7ca4abb445a181f3 (patch)
treede4955337691c1655f7cc0dd02bb15972bf99dc8 /src
parent681e22a4529b2d3e36c8fda87a015e82dd80f0fe (diff)
Fix: fl_height(int, int) decreases the font size after each call (#915)
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Graphics_Driver.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Fl_Graphics_Driver.cxx b/src/Fl_Graphics_Driver.cxx
index 4ef37e33f..6142c8672 100644
--- a/src/Fl_Graphics_Driver.cxx
+++ b/src/Fl_Graphics_Driver.cxx
@@ -745,6 +745,7 @@ Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, Fl_Fontsize Size) {
Fl_Scalable_Graphics_Driver::Fl_Scalable_Graphics_Driver() : Fl_Graphics_Driver() {
line_width_ = 0;
+ fontsize_ = -1;
}
void Fl_Scalable_Graphics_Driver::rect(int x, int y, int w, int h)
@@ -862,6 +863,7 @@ void Fl_Scalable_Graphics_Driver::circle(double x, double y, double r) {
void Fl_Scalable_Graphics_Driver::font(Fl_Font face, Fl_Fontsize size) {
if (!font_descriptor()) fl_open_display(); // to catch the correct initial value of scale_
font_unscaled(face, Fl_Fontsize(size * scale()));
+ fontsize_ = size;
}
Fl_Font Fl_Scalable_Graphics_Driver::font() {
@@ -878,7 +880,7 @@ double Fl_Scalable_Graphics_Driver::width(unsigned int c) {
Fl_Fontsize Fl_Scalable_Graphics_Driver::size() {
if (!font_descriptor() ) return -1;
- return Fl_Fontsize(size_unscaled()/scale());
+ return fontsize_;
}
void Fl_Scalable_Graphics_Driver::text_extents(const char *str, int n, int &dx, int &dy, int &w, int &h) {