mirror of
https://github.com/labwc/labwc.git
synced 2026-06-13 14:33:18 -04:00
scaled-buffer: introduce scaled_font_buffer_update_markup()
This function behaves identically to `scaled_font_buffer_update()` but allows setting the text as pango markup, supporting further customization like underscores.
This commit is contained in:
parent
0caefa6a9e
commit
07a0a4e59b
4 changed files with 46 additions and 9 deletions
|
|
@ -79,7 +79,7 @@ font_get_buffer_size(int max_width, const char *text, struct font *font,
|
|||
void
|
||||
font_buffer_create(struct lab_data_buffer **buffer, int max_width,
|
||||
int height, const char *text, struct font *font, const float *color,
|
||||
cairo_pattern_t *bg_pattern, double scale)
|
||||
cairo_pattern_t *bg_pattern, double scale, bool use_markup)
|
||||
{
|
||||
if (string_null_or_empty(text)) {
|
||||
return;
|
||||
|
|
@ -123,7 +123,13 @@ font_buffer_create(struct lab_data_buffer **buffer, int max_width,
|
|||
PangoLayout *layout = pango_cairo_create_layout(cairo);
|
||||
pango_context_set_round_glyph_positions(pango_layout_get_context(layout), false);
|
||||
pango_layout_set_width(layout, width * PANGO_SCALE);
|
||||
pango_layout_set_text(layout, text, -1);
|
||||
|
||||
if (use_markup) {
|
||||
pango_layout_set_markup(layout, text, -1);
|
||||
} else {
|
||||
pango_layout_set_text(layout, text, -1);
|
||||
}
|
||||
|
||||
pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_END);
|
||||
|
||||
if (!opaque_bg) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue