From b47a4dd2553b7f4db5a385b15bc7cb559c9932db Mon Sep 17 00:00:00 2001 From: Oleh Hushchenkov Date: Sun, 25 Aug 2024 11:28:21 +0300 Subject: add setting for strikeout thickness --- render.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'render.c') diff --git a/render.c b/render.c index d9317b68..98bc0b69 100644 --- a/render.c +++ b/render.c @@ -544,11 +544,21 @@ draw_strikeout(const struct terminal *term, pixman_image_t *pix, const struct fcft_font *font, const pixman_color_t *color, int x, int y, int cols) { + const int thickness = term->conf->strikeout_thickness.px >= 0 + ? term_pt_or_px_as_pixels( + term, &term->conf->strikeout_thickness) + : font->strikeout.thickness; + + /* Try to center custom strikeout */ + const int position = term->conf->strikeout_thickness.px >= 0 + ? font->strikeout.position - round(font->strikeout.thickness / 2.) + round(thickness / 2.) + : font->strikeout.position; + pixman_image_fill_rectangles( PIXMAN_OP_SRC, pix, color, 1, &(pixman_rectangle16_t){ - x, y + term->font_baseline - font->strikeout.position, - cols * term->cell_width, font->strikeout.thickness}); + x, y + term->font_baseline - position, + cols * term->cell_width, thickness}); } static void -- cgit v1.3