diff options
author | D.B <[email protected]> | 2016-10-07 11:27:06 +0200 |
---|---|---|
committer | D.B <[email protected]> | 2016-10-07 11:27:06 +0200 |
commit | 6f2c39610e951b76ff3cc2796c7bd7d3df2d7ba7 (patch) | |
tree | 7fa83cd7b67b7ae3cece083580ac2d6035ae4acd /wayland/pango.c | |
parent | fa119661e9efeeb82d2efc1d962fbaddb9f49a3c (diff) |
parse pango markup in workspace names (and bugfix)
This change allows using numeric character references in workspace names
- for example æ which stands for sharp s. A fix was necessary in
get_pango_layout, since markup and parsed markup had different width.
Diffstat (limited to 'wayland/pango.c')
-rw-r--r-- | wayland/pango.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/wayland/pango.c b/wayland/pango.c index 38993243..5781541b 100644 --- a/wayland/pango.c +++ b/wayland/pango.c @@ -11,9 +11,10 @@ PangoLayout *get_pango_layout(cairo_t *cairo, const char *font, const char *text int32_t scale, bool markup) { PangoLayout *layout = pango_cairo_create_layout(cairo); PangoAttrList *attrs = pango_attr_list_new(); + char *buf = malloc(2048); if (markup) { - pango_parse_markup(text, -1, 0, &attrs, NULL, NULL, NULL); - pango_layout_set_markup(layout, text, -1); + pango_parse_markup(text, -1, 0, &attrs, &buf, NULL, NULL); + pango_layout_set_markup(layout, buf, -1); } else { pango_layout_set_text(layout, text, -1); } @@ -24,6 +25,7 @@ PangoLayout *get_pango_layout(cairo_t *cairo, const char *font, const char *text pango_layout_set_attributes(layout, attrs); pango_attr_list_unref(attrs); pango_font_description_free(desc); + free(buf); return layout; } |