bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#33648: 25.2; feature request: configurable position of strike-throug


From: Eli Zaretskii
Subject: bug#33648: 25.2; feature request: configurable position of strike-through line
Date: Mon, 31 Aug 2020 21:43:42 +0300

> From: Stefan Kangas <stefan@marxist.se>
> Date: Mon, 31 Aug 2020 17:42:43 +0000
> Cc: 33648@debbugs.gnu.org
> 
> I've attached a suggested patch to change the strike-through line
> depending on the glyph size.  The constant factor was found by
> experimentation and produces reasonable results here.

Which glyph, though?  Emacs draws glyphs in series, called "glyph
string".  All the glyphs in a glyph string share the same face (and
thus the same font), but that doesn't mean all the glyphs are of the
same height.  And here...

> --- 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;

..glyph_height is simply the height of the first glyph in the glyph
string.  Which could be anything, whereas you seem to assume that all
of the glyphs in a glyph string are of the same height.  IOW, you are
repeating the same "mistake" we do now, just with a different fraction
value.  Wanna bet that it will break with some fonts?

That is why I suggested a Lisp-exposed variable that could be set to
the offset in pixels of the strike-through line from the base.  (If
you want to be fancy, the Lisp variable could also be a float, in
which case it will be interpreted as a fraction of the first glyph's
height.)  This should be user-controlled, which will allow users (or
Lisp programs) to set that as they see fit, without requiring us to
second-guess up front what they would like.

Thanks.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]