commit 2705990eab7a559216c648134c966698727cfe74
Author: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Thu Sep 18 08:56:33 2025 +0200
Commit: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Thu Sep 18 08:56:52 2025 +0200
Fix: Underline does not appear in some fonts and scales (WinXP .. Win11) (#1308)
src/drivers/GDI/Fl_GDI_Graphics_Driver.H | 1 +
src/drivers/GDI/Fl_GDI_Graphics_Driver_font.cxx | 10 ++++++++++
2 files changed, 11 insertions(+)
diff --git src/drivers/GDI/Fl_GDI_Graphics_Driver.H src/drivers/GDI/Fl_GDI_Graphics_Driver.H
index 1f33b0b..4d6cc9c 100644
--- src/drivers/GDI/Fl_GDI_Graphics_Driver.H
+++ src/drivers/GDI/Fl_GDI_Graphics_Driver.H
@@ -79,6 +79,7 @@ public:
static HBITMAP calc_HBITMAP_mask(Fl_RGB_Image *mask);
void delete_bitmask(fl_uintptr_t bm) FL_OVERRIDE;
HBITMAP create_alphamask(int w, int h, int d, int ld, const uchar *array);
+ void draw(const char *str, int n, int x, int y) FL_OVERRIDE;
void draw_unscaled(const char* str, int n, int x, int y) FL_OVERRIDE;
void draw_unscaled(int angle, const char *str, int n, int x, int y) FL_OVERRIDE;
void rtl_draw_unscaled(const char* str, int n, int x, int y) FL_OVERRIDE;
diff --git src/drivers/GDI/Fl_GDI_Graphics_Driver_font.cxx src/drivers/GDI/Fl_GDI_Graphics_Driver_font.cxx
index daf12d5..b74241b 100644
--- src/drivers/GDI/Fl_GDI_Graphics_Driver_font.cxx
+++ src/drivers/GDI/Fl_GDI_Graphics_Driver_font.cxx
@@ -593,6 +593,16 @@ exit_error:
return;
} // fl_text_extents
+
+void Fl_GDI_Graphics_Driver::draw(const char *str, int n, int x, int y) {
+ if (!size_ || !font_descriptor()) font(FL_HELVETICA, FL_NORMAL_SIZE);
+ Fl_Region r2 = scale_clip(scale());
+ int offset = (scale() == 1 ? 0 : -1); // for issue #1308
+ draw_unscaled(str, n, floor(x), floor(y + offset));
+ unscale_clip(r2);
+}
+
+
void Fl_GDI_Graphics_Driver::draw_unscaled(const char* str, int n, int x, int y) {
COLORREF oldColor = SetTextColor(gc_, fl_RGB());
// avoid crash if no font has been set yet
[ Direct Link to Message ]