diff options
author | Drew DeVault <sir@cmpwn.com> | 2016-10-07 08:39:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-07 08:39:50 -0400 |
commit | 77433f0029b6bb07352647a512de810b72568260 (patch) | |
tree | 7fa83cd7b67b7ae3cece083580ac2d6035ae4acd | |
parent | fa119661e9efeeb82d2efc1d962fbaddb9f49a3c (diff) | |
parent | 6f2c39610e951b76ff3cc2796c7bd7d3df2d7ba7 (diff) |
Merge pull request #936 from thejan2009/pango-numeric-char-ref
parse pango markup in workspace names (and bugfix)
-rw-r--r-- | swaybar/render.c | 4 | ||||
-rw-r--r-- | wayland/pango.c | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/swaybar/render.c b/swaybar/render.c index a773df7b..7dfac891 100644 --- a/swaybar/render.c +++ b/swaybar/render.c @@ -205,7 +205,7 @@ void workspace_button_size(struct window *window, const char *workspace_name, in const char *stripped_name = strip_workspace_name(swaybar.config->strip_workspace_numbers, workspace_name); get_text_size(window->cairo, window->font, width, height, - window->scale, false, "%s", stripped_name); + window->scale, true, "%s", stripped_name); *width += 2 * ws_horizontal_padding; *height += 2 * ws_vertical_padding; } @@ -241,7 +241,7 @@ static void render_workspace_button(struct window *window, struct config *config cairo_set_source_u32(window->cairo, box_colors.text); cairo_move_to(window->cairo, (int)*x + ws_horizontal_padding, margin); pango_printf(window->cairo, window->font, window->scale, - false, "%s", stripped_name); + true, "%s", stripped_name); *x += width + ws_spacing; } 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; } |