From 9082c44cd07cd379c5a13cdcbe1153d1fd29048d Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Mon, 2 May 2022 19:40:43 +0200 Subject: Issue #438 : Wayland: Text drawing different from Xft version - cont'd. --- src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx index 06abacccb..04050364d 100644 --- a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx +++ b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx @@ -1125,7 +1125,8 @@ 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_); - cairo_translate(cairo_, x, y - size() - 1); + // The -1 below is necessary for Fl_Text_Display at scale = 1 + cairo_translate(cairo_, x, y - height() + descent() -1); pango_layout_set_text(pango_layout_, str, n); pango_cairo_show_layout(cairo_, pango_layout_); cairo_restore(cairo_); @@ -1197,7 +1198,7 @@ void Fl_Cairo_Graphics_Driver::text_extents(const char* txt, int n, int& dx, int PangoRectangle ink_rect; pango_layout_get_pixel_extents(pango_layout_, &ink_rect, NULL); dx = ink_rect.x; - dy = ink_rect.y - size(); + dy = ink_rect.y - height() + descent(); w = ink_rect.width; h = ink_rect.height; } -- cgit v1.2.3