Re: [csswg-drafts] [css-fonts-5] font-size-adjust with missing metrics (#6384)

> If an author sets font-size-adjust to something other than none, they're expecting a "harmonization" of some aspect of font sizes to happen.

I totally agree with this expectation. But do they get an accurate harmonization, or something random because different browsers use actually different heuristics? And does that help the author at all, or does it not instead cause more interop frustration?

IMO they do not get anything better with a heuristic than doing no adjustment and just relying on font-size scaling, if the value are not tuned away from the regular font size too much as the previous example with `cap-height 5`. 

Let's look at the cap height heuristic: 
https://drafts.csswg.org/css-values-4/#cap says:
>  If reliable font metrics are not available, [UAs](https://drafts.csswg.org/css-2023/#user-agent) may determine the cap-height from the height of an uppercase glyph. One possible heuristic is to look at how far the glyph for the uppercase “O” extends below the baseline, and subtract that value from the top of its bounding box. In the cases where it is impossible or impractical to determine the cap-height, the font’s ascent must be used.

"may... from upercase glyph"... "letter O"... "One possible heuristic.... " ... "otherwise ascent". 

This is not the kind of spec text that gets a closer to interop. It also does not function as a foundation for reliable WPT tests that produce the same results in different UAs for testing the fallback for from-font. 

Again: This general situation of missing metrics is rare and the edge case, most fonts have the metrics. But let us try to find a way we can test this case and achieve interoperability.

In your newer example of the emoji fonts followed by Latin and Cyrillic: No adjustment simply means, the chosen emoji font, and `MyLatinFont` and `MyCyrillic` font will just be scaled by font size. The proximity of their cap heights then depends on the font designs. But these fonts share a baseline, so their above baseline parts will not be far off with no adjustment. 

If the emoji font does not have a cap height (unlikely): Then we go about inventing one by each UA employing their own different non-interoperable heuristics. Then we force-scale MyLatinFont and MyCyrillic font to match the heuristically determined value. This may very well result in the uppercase Cyrillic and Latin glyphs not matching the visual emoji cap height. 

I wonder what is gained with this method compared to just scaling by font size? 

It potentially gets worse if `MyLatinFont` or `MyCyrillic` font do not have a cap-height themselves: then we force-scale two values determined by heuristics to each other. I don't think it's predictable for authors to figure out the reasons for such a result. 

-- 
GitHub Notification of comment by drott
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6384#issuecomment-2098488244 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 7 May 2024 14:03:43 UTC