diff options
Diffstat (limited to 'common/pango.c')
-rw-r--r-- | common/pango.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/common/pango.c b/common/pango.c index 9437c60d..403bd9a8 100644 --- a/common/pango.c +++ b/common/pango.c | |||
@@ -77,19 +77,21 @@ PangoLayout *get_pango_layout(cairo_t *cairo, const char *font, | |||
77 | if (markup) { | 77 | if (markup) { |
78 | char *buf; | 78 | char *buf; |
79 | GError *error = NULL; | 79 | GError *error = NULL; |
80 | bool result = pango_parse_markup(text, -1, 0, &attrs, &buf, | 80 | if (pango_parse_markup(text, -1, 0, &attrs, &buf, NULL, &error)) { |
81 | NULL, &error); | 81 | pango_layout_set_markup(layout, buf, -1); |
82 | if (result) { | 82 | free(buf); |
83 | } else { | ||
83 | wlr_log(L_ERROR, "pango_parse_markup '%s' -> error %s", text, | 84 | wlr_log(L_ERROR, "pango_parse_markup '%s' -> error %s", text, |
84 | error->message); | 85 | error->message); |
85 | return NULL; | 86 | g_error_free(error); |
87 | markup = false; // fallback to plain text | ||
86 | } | 88 | } |
87 | pango_layout_set_markup(layout, text, -1); | 89 | } |
88 | free(buf); | 90 | if (!markup) { |
89 | } else { | ||
90 | attrs = pango_attr_list_new(); | 91 | attrs = pango_attr_list_new(); |
91 | pango_layout_set_text(layout, text, -1); | 92 | pango_layout_set_text(layout, text, -1); |
92 | } | 93 | } |
94 | |||
93 | pango_attr_list_insert(attrs, pango_attr_scale_new(scale)); | 95 | pango_attr_list_insert(attrs, pango_attr_scale_new(scale)); |
94 | PangoFontDescription *desc = pango_font_description_from_string(font); | 96 | PangoFontDescription *desc = pango_font_description_from_string(font); |
95 | pango_layout_set_font_description(layout, desc); | 97 | pango_layout_set_font_description(layout, desc); |