-
- XftDrawStringUtf8(d, &c, t->font->xftfont, x,
- t->font->xftfont->ascent + y,
- (FcChar8*)text->str, strlen(text->str));
- return;
+
+ if (t->shortcut) {
+ const gchar *c = t->string + t->shortcut_pos;
+
+ 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
+ The line doesn't need to be freed, it's a part of the layout */
+ pango_xft_render_layout_line
+ (d, &c, pango_layout_get_line(t->font->layout, 0),
+ x * PANGO_SCALE, y * PANGO_SCALE);
+
+ if (t->shortcut) {
+ 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);
+ }