From 09c1cdd2dc3964e2e1c079b943b7aef40fc36acd Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Fri, 21 Apr 2023 16:26:44 +0100 Subject: [PATCH] osd: set field width to ellipsize --- src/osd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/osd.c b/src/osd.c index 4459d7dc..f5ce9199 100644 --- a/src/osd.c +++ b/src/osd.c @@ -367,9 +367,11 @@ render_osd(struct server *server, cairo_t *cairo, int w, int h, default: break; } + int field_width = field->width / 100.0 * OSD_ITEM_WIDTH; + pango_layout_set_width(layout, field_width * PANGO_SCALE); pango_layout_set_text(layout, buf.buf, -1); pango_cairo_show_layout(cairo, layout); - x += field->width / 100.0 * OSD_ITEM_WIDTH; + x += field_width; } if (view == cycle_view) { -- 2.52.0