diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-05-02 19:40:43 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-05-02 19:40:43 +0200 |
| commit | 9082c44cd07cd379c5a13cdcbe1153d1fd29048d (patch) | |
| tree | 25a55dd8c6be47619562b82b247332c1700c9568 | |
| parent | 049cef17f75f20af74bc81c33010da34196e4199 (diff) | |
Issue #438 : Wayland: Text drawing different from Xft version - cont'd.
| -rw-r--r-- | src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx | 5 |
1 files 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; } |
