Skip to content
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

Implement the font-optical-sizing property #19058

Merged
merged 1 commit into from Sep 17, 2019

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Sep 15, 2019

Implement the CSS fonts property font-optical-sizing [1]. Typographic
optical sizing means that a font has slight variations in glyph contrast
to better optimize for legibility at different font sizes: The glyph
shapes vary between for example a headline font size and a body text
font size. The CSS font-optical-sizing property with its default value
of auto exists to automatically apply the current font size value to a
variable font's 'opsz' axis. This means, if a variable font supports the
'opsz' axis and optical sizing, the right value is automatically applied
without the need for an explicit font-variation-settings styling.

Intend to implement and ship:
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/Y3lhEykjfV0

Chromestatus entry:
https://www.chromestatus.com/feature/5685958032752640

[1] https://drafts.csswg.org/css-fonts-4/#font-optical-sizing-def

Bug: 773697
Change-Id: Ifa4b6e042204a3fbf172b8cfe232821d8691283b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1795244
Commit-Queue: Dominik Röttsches <drott@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Reviewed-by: Emil A Eklund <eae@chromium.org>
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697197}

Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already reviewed downstream.

@drott
Copy link
Contributor

drott commented Sep 16, 2019

CC @jfkthame - I was trying this test in Firefox release and nightly: In Nightly the font does not get loaded - why might that be? In Release (on Mac) font-variation-settings: 'opsz' <number>; work, but font-optical-sizing: auto; does not seem to get applied. There should be a copy of this test at: http://roettsch.es/variable-opsz.html if you'd like to give it a try. Thanks for taking a look.

@drott
Copy link
Contributor

drott commented Sep 16, 2019

CC @emilio ^^ is what we discussed here at TPAC, thanks for taking a look!

@emilio
Copy link
Contributor

emilio commented Sep 16, 2019

Poking a bit it seems like the sanitizer is rejecting it:

[Child 31282: Main Thread]: D/userfonts userfonts (0x7f62f780a9e0) download completed - font uri: (http://roettsch.es/variabletest_box.ttf) time: 944 ms
[Child 31282: Main Thread]: D/userfonts userfonts (0x7f62f56460a0) downloadable font: name: name records are not sorted. (font-family: "variabletest_box" style:normal weight:400 stretch:100 src index:0) source: http://roettsch.es/variabletest_box.ttf
[Child 31282: Main Thread]: D/userfonts userfonts (0x7f62f56460a0) downloadable font: Variations: Axis count mismatch (font-family: "variabletest_box" style:normal weight:400 stretch:100 src index:0) source: http://roettsch.es/variabletest_box.ttf
[Child 31282: Main Thread]: D/userfonts userfonts (0x7f62f56460a0) downloadable font: Variations: Failed to parse variation region list (font-family: "variabletest_box" style:normal weight:400 stretch:100 src index:0) source: http://roettsch.es/variabletest_box.ttf
[Child 31282: Main Thread]: D/userfonts userfonts (0x7f62f56460a0) downloadable font: GDEF: Invalid item variation store (font-family: "variabletest_box" style:normal weight:400 stretch:100 src index:0) source: http://roettsch.es/variabletest_box.ttf
[Child 31282: Main Thread]: D/userfonts userfonts (0x7f62f56460a0) downloadable font: GDEF: Failed to parse table (font-family: "variabletest_box" style:normal weight:400 stretch:100 src index:0) source: http://roettsch.es/variabletest_box.ttf
[Child 31282: Main Thread]: D/userfonts userfonts (0x7f62f56460a0) downloadable font: rejected by sanitizer (font-family: "variabletest_box" style:normal weight:400 stretch:100 src index:0) source: http://roettsch.es/variabletest_box.ttf
[Child 31282: Main Thread]: D/userfonts userfonts (0x7f62f56460a0) [src 0] failed uri: (http://roettsch.es/variabletest_box.ttf) for (variabletest_box) error making platform font
[Child 31282: Main Thread]: D/userfonts userfonts (0x7f62f56460a0) failed all src for (variabletest_box)

But I think we should log a message to the console or so in that case.

@emilio
Copy link
Contributor

emilio commented Sep 16, 2019

Ah, the message goes to the console, but it goes to the "CSS" category, which is disabled by default.

@drott
Copy link
Contributor

drott commented Sep 16, 2019

Poking a bit it seems like the sanitizer is rejecting it:

Thanks, managed to fix the font to pass OTS, had a wrong name id for the new axis name as well as a missing axis filter entry in the variations store in GDEF. Thanks for the CSS button tip.

@drott
Copy link
Contributor

drott commented Sep 16, 2019

698b027 should contain the updated font. Thanks for your help @emilio .

@chromium-wpt-export-bot chromium-wpt-export-bot force-pushed the chromium-export-cl-1795244 branch 3 times, most recently from 0da86f5 to a0e247e Compare September 17, 2019 12:14
Implement the CSS fonts property font-optical-sizing [1]. Typographic
optical sizing means that a font has slight variations in glyph contrast
to better optimize for legibility at different font sizes: The glyph
shapes vary between for example a headline font size and a body text
font size. The CSS font-optical-sizing property with its default value
of auto exists to automatically apply the current font size value to a
variable font's 'opsz' axis. This means, if a variable font supports the
'opsz' axis and optical sizing, the right value is automatically applied
without the need for an explicit font-variation-settings styling.

Intend to implement and ship:
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/Y3lhEykjfV0

Chromestatus entry:
https://www.chromestatus.com/feature/5685958032752640

[1] https://drafts.csswg.org/css-fonts-4/#font-optical-sizing-def

Bug: 773697
Change-Id: Ifa4b6e042204a3fbf172b8cfe232821d8691283b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1795244
Commit-Queue: Dominik Röttsches <drott@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Reviewed-by: Emil A Eklund <eae@chromium.org>
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697197}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants