From af3ef8d13029eda787e7c6cacf674c09aed1a94f Mon Sep 17 00:00:00 2001 From: gambas Date: Thu, 4 Oct 2018 12:17:53 +0200 Subject: [PATCH] Paint: Text should now be correctly drawn in all cases. [GB.GTK] * BUG: Paint: Text should now be correctly drawn in all cases. [GB.GTK3] * BUG: Paint: Text should now be correctly drawn in all cases. --- gb.gtk/src/cpaint_impl.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gb.gtk/src/cpaint_impl.cpp b/gb.gtk/src/cpaint_impl.cpp index c1dcf07ee..38cd2bdf9 100644 --- a/gb.gtk/src/cpaint_impl.cpp +++ b/gb.gtk/src/cpaint_impl.cpp @@ -991,13 +991,18 @@ static void draw_text(GB_PAINT *d, bool rich, const char *text, int len, float w if (rich) { html = gt_html_to_pango_string(text, len, false); - pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR); + pango_layout_set_text(layout, "", 0); pango_layout_set_markup(layout, html, -1); + pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR); if (w > 0) pango_layout_set_width(layout, (int)(w * PANGO_SCALE)); } else + { + pango_layout_set_markup(layout, "", 0); pango_layout_set_text(layout, text, len); + pango_layout_set_width(layout, -1); + } if (align == GB_DRAW_ALIGN_DEFAULT) align = ALIGN_TOP_NORMAL; @@ -1014,7 +1019,7 @@ static void draw_text(GB_PAINT *d, bool rich, const char *text, int len, float w offy = -(EXTRA(d)->ascent); } - cairo_rel_move_to(CONTEXT(d), offx + DX(d), offy + DY(d)); + cairo_rel_move_to(CONTEXT(d), offx, offy); if (draw) pango_cairo_show_layout(CONTEXT(d), layout); else