From 74b5091161890bc145034c5f2fd0c7e615b21d65 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 31 Aug 2020 13:39:51 +0200 Subject: [PATCH] Make strike-through thicker for larger font sizes * src/nsterm.m (ns_draw_text_decoration): * src/w32term.c (w32_draw_glyph_string): * src/xterm.c (x_draw_glyph_string): Make strike-through thicker for larger font sizes. (Bug#33648) * src/dispextern.h (STRIKE_THROUGH_WIDTH_FACTOR): New constant. --- src/dispextern.h | 4 ++++ src/nsterm.m | 2 +- src/w32term.c | 2 +- src/xterm.c | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/dispextern.h b/src/dispextern.h index 956ca96eb6..461526a7f8 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -656,6 +656,10 @@ #define GLYPH_INVALID_P(GLYPH) (GLYPH_CHAR (GLYPH) < 0) #define CHAR_GLYPH_PADDING_P(GLYPH) (GLYPH).padding_p +/* Calculate the width of the strike-through line. */ + +#define STRIKE_THROUGH_WIDTH(x) ceilf (x / 15.0) + diff --git a/src/nsterm.m b/src/nsterm.m index 26059ab67c..16575c066b 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -3706,7 +3706,7 @@ larger if there are taller display elements (e.g., characters int glyph_height = s->first_glyph->ascent + s->first_glyph->descent; /* Strike-through width and offset from the glyph string's top edge. */ - unsigned long h = 1; + unsigned long h = STRIKE_THROUGH_WIDTH (glyph_height); unsigned long dy; dy = lrint ((glyph_height - h) / 2); diff --git a/src/w32term.c b/src/w32term.c index 1766b32514..1b8d9b811b 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -2636,7 +2636,7 @@ w32_draw_glyph_string (struct glyph_string *s) int glyph_height = s->first_glyph->ascent + s->first_glyph->descent; /* Strike-through width and offset from the glyph string's top edge. */ - unsigned long h = 1; + unsigned long h = STRIKE_THROUGH_WIDTH (glyph_height); unsigned long dy = (glyph_height - h) / 2; if (s->face->strike_through_color_defaulted_p) diff --git a/src/xterm.c b/src/xterm.c index 2e0407aff4..b17afdf225 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3931,7 +3931,7 @@ x_draw_glyph_string (struct glyph_string *s) int glyph_height = s->first_glyph->ascent + s->first_glyph->descent; /* Strike-through width and offset from the glyph string's top edge. */ - unsigned long h = 1; + unsigned long h = STRIKE_THROUGH_WIDTH (glyph_height); unsigned long dy = (glyph_height - h) / 2; if (s->face->strike_through_color_defaulted_p) -- 2.28.0