Skip to content

[css-fonts] Clarify font-optical-sizing behaviour under size-adjust #6190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
drott opened this issue Apr 7, 2021 · 3 comments · Fixed by #6196
Closed

[css-fonts] Clarify font-optical-sizing behaviour under size-adjust #6190

drott opened this issue Apr 7, 2021 · 3 comments · Fixed by #6196

Comments

@drott
Copy link
Collaborator

drott commented Apr 7, 2021

In
web-platform-tests/wpt#28399
I made a ref-test ensuring that font-optical-sizing: auto behaves according to the adjusted / resulting font-size under size-adjust, pending review.

Since the wording for size-adjust says:

However, the computed font-size (and thus any values that derive from it, such as em units, percentages in text-underline-offset, etc.) remains unaffected.

And font-optical-sizing: auto says:

The user agent may modify the shape of glyphs based on the font-size and the pixel density of the screen. For OpenType and TrueType fonts using font variations, this is often done by using the "opsz" font variation.

we may want to clarify that the applied optical sizing value should be based on the resulting/adjusted/displayed font-size, not on the computed font size, in order to avoid confusion?

I believe the behaviour as tested in the new test makes sense as the glyph size is changed by size-adjust, and the scaled glyphs should then be rendered with the scaled/new optical size value. Or in other words, the glyph is displayed larger/smaller, and so should its optical sizing value be adjusted accordingly.

@jfkthame
Copy link
Contributor

jfkthame commented Apr 7, 2021

I agree this makes sense, although I note that the current Gecko implementation fails this test, because it sets 'opsz' based on the computed font size -- so that'll need to be fixed.

(In practice, I think most use cases for size-adjust will involve fairly moderate scaling amounts, so the difference will be barely noticeable; but still, we should specify and do the right thing, not just fudge it!)

This also prompted me to wonder how optical sizing interacts with font-size-adjust; I believe that is similarly broken in Gecko at present. Maybe you could include a similar test for that?

@drott
Copy link
Collaborator Author

drott commented Apr 8, 2021

Thanks for your feedback, Jonathan.

This also prompted me to wonder how optical sizing interacts with font-size-adjust; I believe that is similarly broken in Gecko at present. Maybe you could include a similar test for that?

We're currently not shipping font-size-adjust: and if Gecko would fail it, I wouldn't have a way of verifying the test atm, which would make it a bit brittle to submit to WPT.

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [css-fonts] Clarify font-optical-sizing behaviour under size-adjust #6190, and agreed to the following:

  • RESOLVED: font-optical-sizing: auto references the used font-size, accounting for 'size-adjust' and 'font-size-adjust'
The full IRC log of that discussion <fantasai> Topic: [css-fonts] Clarify font-optical-sizing behaviour under size-adjust #6190
<fantasai> github: https://github.com//issues/6190
<Rossen__> github: https://github.com//issues/6190
<fantasai> chrishtr: Question of size-adjust interaction with font-optical-sizing
<fantasai> chrishtr: The proposed resolution is to use font-optical-sizing of the used font size
<fantasai> myles: of course
<fantasai> RESOLVED: font-optical-sizing: auto references the used font-size, accounting for 'size-adjust' and 'font-size-adjust'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants