Re: [css3-fonts] font-size-adjust and em/ex values

Le 25/06/2013 21:14, fantasai a écrit :
> EX, CH compute against the used font size of the first available font.
> Since we need to look up the font metrics for this anyway, it seems
> best to be accurate about it. Also these units are really intended to
> match glyph measurements, so they should do so. E.g. Bert's example
> where a colored line matches the ex height of the text, or fitting
> a 10-digit number into a 10ch form input.

This needs a more precise definition of "first available font". Is that 
font family or a font face? How do you find it? As far as I understand, 
metrics belong to a font face, and different faces in the same family 
can have different metrics. (E.g. wider glyph advance in bold vs. normal.)

CR-css3-values-20130404 defines the ch unit as "in the font used to 
render it", which sounds unambiguous enough. (Although it could say 
"font face".)

For ex however you don’t have a character to use as input to the font 
matching algorithm, so you might need to define something like that 
algorithm but skipping the step that checks whether a face supports the 
input character. (All faces match that step.)


> EM, I could go either way:
>    * take into account 'font-size-adjust'. Text in the first available
>      font will match 1em measurements in the layout.
>    * just use the computed 'font-size'. Text may end up taller than 1em,
>      which may cause some amount of layout mismatch.
> There are fonts that have ascenders and descenders that go beyond the
> em box, so having the used font size not match the computed EM is maybe
> not such a problem. (If the adjustment is large, though, and the font is
> not designed for overlapping across lines, this could be a problem?)

As an implementer I like the simplicity of the second option, but I 
don’t have an opinion on what’s better for authors (which should have 
priority over implementer convenience.)

With the first option you probably need the same font matching as for ex.

-- 
Simon Sapin

Received on Wednesday, 26 June 2013 10:25:42 UTC