From cf1c8b1125d58659e080c94280a1c72f8f0ec659 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Sat, 30 Apr 2022 16:37:28 +0200 Subject: Fix for issue #438 : Wayland: Text drawing different from Xft version - cont'd. --- src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H | 1 - src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx | 10 ++-------- 2 files changed, 2 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H index f412328b3..db12ca9b1 100644 --- a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H +++ b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H @@ -165,7 +165,6 @@ public: void draw(const char* s, int nBytes, float x, float y); void draw(int angle, const char *str, int n, int x, int y); void rtl_draw(const char* str, int n, int x, int y); - int height(); int descent(); double width(const char *str, int n); double width(unsigned c); diff --git a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx index 813917392..c47c0b6e4 100644 --- a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx +++ b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx @@ -915,12 +915,6 @@ void Fl_Cairo_Graphics_Driver::delete_bitmask(fl_uintptr_t bm) { } -int Fl_Cairo_Graphics_Driver::height() { - if (!font_descriptor()) font(0, 12); - return (font_descriptor()->ascent + font_descriptor()->descent)*1.1 /*1.15 scale=1*/; -} - - int Fl_Cairo_Graphics_Driver::descent() { return font_descriptor()->descent; } @@ -1124,9 +1118,9 @@ void Fl_Cairo_Graphics_Driver::font(Fl_Font fnum, Fl_Fontsize s) { void Fl_Cairo_Graphics_Driver::draw(const char* str, int n, float x, float y) { if (!n) return; cairo_save(cairo_); - // The vertical offset size()/21. below vertically positions output text adequately + // The vertical offset size()/6. below vertically positions output text adequately // relatively to the baseline (empirical observation). - cairo_translate(cairo_, x, y - height() + descent() + size()/21.); + cairo_translate(cairo_, x, y - height() + descent() - size()/6.); pango_layout_set_text(pango_layout_, str, n); pango_cairo_show_layout(cairo_, pango_layout_); cairo_restore(cairo_); -- cgit v1.2.3