diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2025-09-17 17:07:45 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2025-09-17 17:07:45 +0200 |
| commit | 6160673bbff4d213894a357a43206742f56d54cc (patch) | |
| tree | ad70317706d044ad658b1fc9d23f212e42f84e64 /src | |
| parent | a8244ebcd85652128ca6d6dcf842d8fd9263f75a (diff) | |
Fix: Underline does not appear in some fonts and scales (WinXP .. Win11) (#1308)
Diffstat (limited to 'src')
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver_font.cxx | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H index 336fa1ebc..f505619b6 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H @@ -74,6 +74,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 a/src/drivers/GDI/Fl_GDI_Graphics_Driver_font.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_font.cxx index e901db971..354957bb9 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_font.cxx +++ b/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 |
