summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Zlobin <cook60020tmp@mail.ru>2023-08-27 23:25:59 +0500
committerDave Davenport <qball@gmpclient.org>2023-08-27 21:10:00 +0200
commit9b2b52b13e686e5cb37fa6d5fcda476aebf7405e (patch)
tree8d7fcdd59a88bd2bd0055e06963c9ca2e7c8b33e
parent51a8df9da5d84c0a068a1d37885acd07817ab251 (diff)
Clip text with extents rectangle
Fonts are not ideal, some characters have mismatch between reported and painted size.
-rw-r--r--source/widgets/textbox.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c
index 6785826a..9c1a25d5 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);