Subject: Re: bug#71039: :box :line-width and :underline :position should accept fractional sizes

From: Eli Zaretskii <[email-masked]>
Date: Sat, 18 May 2024 19:06:29 +0300

> From: JD Smith <[email-masked]>
> Date: Sat, 18 May 2024 10:52:03 -0400
> 
> There are, however, two face size attributes which are hard-coded in pixels: :box :linewidth and :underline :
> position.  It would be very convenient if these also accepted fractional floating point values.  E.g. a face
> attribute of:
> 
>  :box (:line-width (0.5 . -0.25)) 
> 
> would indicate a box with half a char width outside padding left & right, and one-quarter char height padding
> above and below.

Are you sure this is a good idea?  What would you like this to do when
two adjacent runs of text are shown using different-size fonts (which
AFAIU is the main use case for this feature)?  We currently force the
thickness and position of the underline to be identical for all the
characters of a stretch of underlined text, even if they are displayed
using different fonts, and we take those values from the first part of
the underlined text's stretch.  This is because having the underline
break or show differently in the middle of an underlined text has ugly
appearance.

OTOH, calculating the thickness and position in pixels from the face
font's dimensions is easy enough if your code needs that.

Given these two facts, I'm not sure supporting float values here will
be worth the effort.

> In addition, :box would be even more powerful, and obviate the use of SVG styling in many situations, if :box :
> line-width optionally accepted a list of four parameters for box dimensions, one for each side:
> 
>  :line-width (left right top bottom)
> 
> naturally as either pixel or floating point fractions.

How is this different from specifying the thickness and the position,
as we have today?