w3c / font-text-cg

GitHub Pages
https://w3c.github.io/font-text-cg/
Other
28 stars 5 forks source link

Allow font-size-adjust to be used in @font-face block #51

Open floratmin opened 3 years ago

floratmin commented 3 years ago

When mixing fonts of different scripts into one font family with the @font-face declaration, sometimes the sizes of the fonts do not match. When mixing these scripts in one paragraph, we have to use spans to adjust the size of one of the fonts. But if we could define the font-size-adjust property directly in the @font-face declaration, then there would be no need to mark parts of different scripts (or even fonts) in paragraphs.

tiroj commented 3 years ago

This should probably be cross-posted as a CSS working group issue.

A related issue: the font-size-adjust property, as currently defined, is very Latin-centric, e.g. ‘All fonts have an "aspect value" which is the size-difference between the lowercase letter "x" and the uppercase letter "X".’ It works reasonably well for European scripts that have similar proportions to Latin, but is effectively meaningless for most of the world’s writing systems.

floratmin commented 3 years ago

OK I updated the font-size-adjust property to be independent of the x-height to capital-height ratio and posted it to the CSS working group.

frivoal commented 3 years ago

The CSSWG has just resolved to do this in https://github.com/w3c/csswg-drafts/issues/6075

PeterConstable commented 3 years ago

I'm reminded of a detail that went into the design of a Windows API added in Windows 8: the LanguageFontGroup class was added to provide font recommendations for different scripts or languages. One of the usage scenarios for the API was to support multilingual content in a single app UI; for example, the Windows 8 Start menu, with app tiles that each could show notifications that might be in different languages. So, the fonts for different languages should be aesthetically compatible and coherent. One particular problem was that the different system fonts might have been designed with different metrics, and if set at the same size would not look well matched—some of the text might look too bit or too small relative to other text in the same UI. And so the LanguageFont objects returned for a given script or language includes a ScaleFactor member that could be used to adjust relative size of the different fonts.

fantasai commented 3 years ago

@tiroj That's already filed as https://github.com/w3c/csswg-drafts/issues/4540 :) We've got two solutions: https://github.com/w3c/csswg-drafts/issues/6075 which introduces a scaling factor per @font-face block and https://github.com/w3c/csswg-drafts/issues/6160 which extends the font-size-adjust property to work with metrics other than ex-height.

Which does leave the issue of Most Writing Systems Don't Have OpenType Metrics, which was filed as https://github.com/MicrosoftDocs/typography-issues/issues/240 and https://lists.w3.org/Archives/Public/www-archive/2020Feb/att-0005/CSS-SC29-20200113.pdf and https://github.com/w3c/csswg-drafts/issues/5244