From 9b2b52b13e686e5cb37fa6d5fcda476aebf7405e Mon Sep 17 00:00:00 2001 From: Nikita Zlobin Date: Sun, 27 Aug 2023 23:25:59 +0500 Subject: [PATCH] Clip text with extents rectangle Fonts are not ideal, some characters have mismatch between reported and painted size. --- source/widgets/textbox.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c index 6785826ad..9c1a25d58 100644 --- a/source/widgets/textbox.c +++ b/source/widgets/textbox.c @@ -568,7 +568,11 @@ static void textbox_draw(widget *wid, cairo_t *draw) { // draw the text cairo_save(draw); + double x1, y1, x2, y2; + cairo_clip_extents(draw, &x1, &y1, &x2, &y2); cairo_reset_clip(draw); + cairo_rectangle(draw, x1, y1, x2 - x1, y2 - y1); + cairo_clip(draw); gboolean show_outline = rofi_theme_get_boolean(WIDGET(tb), "text-outline", FALSE);