pango_layout_set_text(f->layout, str, -1);
pango_layout_set_width(f->layout, -1);
pango_layout_get_pixel_extents(f->layout, NULL, &rect);
- *x = rect.width + ABS(shadow_x);
+ *x = rect.width + ABS(shadow_x) + 4 /* we put a 2 px edge on each side */;
*y = rect.height + ABS(shadow_y);
}
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;
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),
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