X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=render%2Ffont.c;h=50b4208fb6a0f6b429f2215362ae0d3d2d8b536d;hb=564b727966ef1a38309d45b2ab040c3deeb658a4;hp=1208e9ef687d38f9a6085a3072e067e16c9b27f3;hpb=0c41ab3c208970a68e9d0e0d0471c450542e23a3;p=chaz%2Fopenbox diff --git a/render/font.c b/render/font.c index 1208e9ef..50b4208f 100644 --- a/render/font.c +++ b/render/font.c @@ -221,6 +221,13 @@ void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *area) t->font->shortcut_underline->start_index = 0; t->font->shortcut_underline->end_index = 0; + /* the attributes are owned by the layout. + re-add the attributes to the layout after changing the + start and end index */ + attrlist = pango_layout_get_attributes(t->font->layout); + pango_attr_list_ref(attrlist); + pango_layout_set_attributes(t->font->layout, attrlist); + pango_attr_list_unref(attrlist); if (t->shadow_offset_x || t->shadow_offset_y) { c.color.red = t->shadow_color->r | t->shadow_color->r << 8; @@ -229,14 +236,6 @@ void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *area) c.color.alpha = 0xffff * t->shadow_alpha / 255; c.pixel = t->shadow_color->pixel; - /* the attributes are owned by the layout. - re-add the attributes to the layout after changing the - start and end index */ - attrlist = pango_layout_get_attributes(t->font->layout); - pango_attr_list_ref(attrlist); - pango_layout_set_attributes(t->font->layout, attrlist); - pango_attr_list_unref(attrlist); - /* see below... */ pango_xft_render_layout_line (d, &c, pango_layout_get_line(t->font->layout, 0), @@ -253,19 +252,17 @@ void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *area) if (t->shortcut) { const gchar *c = t->string + t->shortcut_pos; - if (g_utf8_validate(c, -1, NULL)) { - t->font->shortcut_underline->start_index = t->shortcut_pos; - t->font->shortcut_underline->end_index = t->shortcut_pos + - (g_utf8_next_char(c) - c); - - /* the attributes are owned by the layout. - re-add the attributes to the layout after changing the - start and end index */ - attrlist = pango_layout_get_attributes(t->font->layout); - pango_attr_list_ref(attrlist); - pango_layout_set_attributes(t->font->layout, attrlist); - pango_attr_list_unref(attrlist); - } + t->font->shortcut_underline->start_index = t->shortcut_pos; + t->font->shortcut_underline->end_index = t->shortcut_pos + + (g_utf8_next_char(c) - c); + + /* the attributes are owned by the layout. + re-add the attributes to the layout after changing the + start and end index */ + attrlist = pango_layout_get_attributes(t->font->layout); + pango_attr_list_ref(attrlist); + pango_layout_set_attributes(t->font->layout, attrlist); + pango_attr_list_unref(attrlist); } /* layout_line() uses y to specify the baseline