commit 9b56da5753c21d223971d653dce413ee751d752d
Author: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Fri Sep 19 10:52:07 2025 +0200
Commit: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Fri Sep 19 10:52:07 2025 +0200
Underline does not appear in some fonts and scales (X11-noCairo) (#1308)
src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H | 1 +
src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx | 9 +++++++++
2 files changed, 10 insertions(+)
diff --git src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H
index 83146ae..fc05747 100644
--- src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H
+++ src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H
@@ -122,6 +122,7 @@ public:
// --- bitmap stuff
static unsigned long create_bitmask(int w, int h, const uchar *array); // NOT virtual
void delete_bitmask(fl_uintptr_t bm) FL_OVERRIDE;
+ 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/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx
index 8c9e392..a7f8ae4 100644
--- src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx
+++ src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx
@@ -118,6 +118,15 @@ static void correct_extents (float s, int &dx, int &dy, int &w, int &h) {
}
}
+void Fl_Xlib_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);
+}
+
+
#if ! USE_PANGO
///////////////////////////////////////////////////////////
[ Direct Link to Message ]