From 220ecbef7f6fb25e6368c7e9bfa4205364e4dafa Mon Sep 17 00:00:00 2001 From: Artem Senichev Date: Mon, 2 Dec 2024 18:17:57 +0300 Subject: [PATCH] Add padding for text background Signed-off-by: Artem Senichev --- src/font.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/font.c b/src/font.c index 98e09a1b..1b4aea87 100644 --- a/src/font.c +++ b/src/font.c @@ -28,6 +28,8 @@ #define POINT_FACTOR 64.0 // default points per pixel for 26.6 format #define SPACE_WH_REL 2.0 +#define BACKGROUND_PADDING 5 + /** Font context. */ struct font { FT_Library lib; ///< Font lib instance @@ -231,7 +233,9 @@ void font_print(struct pixmap* wnd, ssize_t x, ssize_t y, const struct text_surface* text) { if (ARGB_GET_A(ctx.background)) { - pixmap_blend(wnd, x, y, text->width, text->height, ctx.background); + pixmap_blend(wnd, x - BACKGROUND_PADDING, y, + text->width + BACKGROUND_PADDING * 2, text->height, + ctx.background); } if (ARGB_GET_A(ctx.shadow)) {