Skip to content

Commit

Permalink
Add padding for text background
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Senichev <[email protected]>
  • Loading branch information
artemsen committed Dec 2, 2024
1 parent ecd64ec commit 220ecbe
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/font.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit 220ecbe

Please sign in to comment.