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.
This commit is contained in:
gambas 2018-10-04 12:17:53 +02:00
parent 51230b935d
commit af3ef8d130

View file

@ -991,13 +991,18 @@ static void draw_text(GB_PAINT *d, bool rich, const char *text, int len, float w
if (rich) if (rich)
{ {
html = gt_html_to_pango_string(text, len, false); 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_markup(layout, html, -1);
pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
if (w > 0) if (w > 0)
pango_layout_set_width(layout, (int)(w * PANGO_SCALE)); pango_layout_set_width(layout, (int)(w * PANGO_SCALE));
} }
else else
{
pango_layout_set_markup(layout, "", 0);
pango_layout_set_text(layout, text, len); pango_layout_set_text(layout, text, len);
pango_layout_set_width(layout, -1);
}
if (align == GB_DRAW_ALIGN_DEFAULT) if (align == GB_DRAW_ALIGN_DEFAULT)
align = ALIGN_TOP_NORMAL; 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); 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) if (draw)
pango_cairo_show_layout(CONTEXT(d), layout); pango_cairo_show_layout(CONTEXT(d), layout);
else else