Contact emails
ksak...@chromium.org, kenji...@chromium.org
Spec
https://tabatkins.github.io/specs/css-font-display/ (Tag review)
Summary
A new @font-face descriptor for controlling how a downloadable font renders before it is fully loaded.
@font-face descriptor:
Name | Value | Initial |
font-display | auto | block | swap | fallback | optional | auto |
Note: the API surface needed to allow first party developers to use font-display in the context of third party hosted fonts, is still being discussed and is therefore out of scope for this intent to ship.
Motivation
When using downloadable web fonts via @font-face, the user agent needs to know what to do while the web font is not available. Most web browsers have adopted some form of timeout:
Browser | Timeout triggering fallback behavior | Fallback to system font? | Swap when the web font is available? |
Chrome 35+ | 3 seconds | yes | yes |
Opera | 3 seconds | yes | yes |
Firefox | 3 seconds[1] | yes | yes |
Internet Explorer | 0 seconds | yes | yes |
Safari 10+[2] | 3 seconds | yes | yes |
[1]: simplified view of the actual behavior
[2]: since Safari 10 (used to be “no timeout, n/a, n/a”)
The 3 seconds timeout is from the point where the user agent determined that a particular web font would be needed. Synthetic example:
Font Loading API allows a developer to override some of the above behaviors, but it requires a non-trivial amount of effort and ultimately doesn’t provide sufficient hooks to cover all reasonable cases. In addition, it requires JavaScript which means a sub-optimal solution for something as critical as text rendering:
the developer needs to either inline the loading script into their page, or else load an external library and introduce additional network latency before the fonts can be loaded, delaying text rendering.
Design/performance-conscious web developers have a good sense for the relative importance of a given web font for the intended user experience. This specification provides them the ability to control font timeout and rendering behavior. Specifically, it lets developers:
Define the font rendering strategy when text is ready to be painted: block, or paint with fallback.
Define the font rendering behavior once the desired font is available: rerender text with the new font, or leave it with the fallback.
Link to “Intent to Implement” blink-dev discussion
https://groups.google.com/a/chromium.org/d/msg/blink-dev/7s4-eQTAxqs/SoahsGpMAQAJ
Is this feature supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
Yes.
Demo link
Enable chrome://flags/#enable-experimental-web-platform-features beforehand
Play with DevTools’ “disable cache” as well as “network throttling” features to experience some of the behaviors.
Debuggability
Fits within the existing debuggability features for CSS APIs.
Interoperability and Compatibility Risk
Low risk.
Pluses and minuses:
+ small API footprint.
+ Mozilla has implemented CSS font-display (behing an experimental flag) + expressed interest in shipping
+ Feedback from WebKit (i.e. discussion about behavior when modifying font-display)
- No official signals from Edge.
+ Positive feedback from Travis Leithead (Microsoft; context: TAG review)
+ consensus in the CSS working group and agreement to move forward with a FPWD
- A few remaining spec issues but relatively minor, prioritized by the working group and actively tracked (marked as blocking bugs).
+ The level of interest from developers has been constantly high since inception:
https://www.bramstein.com/writing/web-font-loading-patterns.html#custom-font-display
http://alistapart.com/article/webfonts-on-the-prairie#section3
http://meowni.ca/posts/web-fonts/ (+ Followup discussion on HN: "Personally, I would use font-display: optional everywhere, but that doesn’t really work anywhere yet.")
https://speakerdeck.com/smashingmag/improving-web-fonts-performance
https://speakerdeck.com/zachleat/the-performance-and-usability-of-font-loading
https://speakerdeck.com/bramstein/the-consequences-of-web-fonts
and my favorite: “CSS font-display property is going to solve all of our font loading woes” ― Patrick Hamann.
Ongoing technical constraints
None.
OWP launch tracking bug
Entry on the feature dashboard
https://www.chromestatus.com/feature/4799947908055040Hi,
This is a very interesting feature and I'm happy to see progress on it, but I think this intent to ship misstates the maturity of the specification.
You're quoting the CSSWG's IRC (https://log.csswg.org/irc.w3.org/css/2017-01-12/#e760513) to say it is prioritized by the working group, but that discussion is about a related but different specification: The one that the CSSWG wants to prioritize getting to CR is https://drafts.csswg.org/css-font-loading/ which is different from the https://tabatkins.github.io/specs/css-font-display/ spec discussed here. font-display has been discussed in the WG in the past, and is also (as can be see higher up in that IRC log) something the CSSWG wants to get going, but it is only about to become an official draft in the WG, not about to reach CR.
On Wed, Jan 18, 2017 at 7:41 PM, <flo...@rivoal.net> wrote:Hi,
This is a very interesting feature and I'm happy to see progress on it, but I think this intent to ship misstates the maturity of the specification.
You're quoting the CSSWG's IRC (https://log.csswg.org/irc.w3.org/css/2017-01-12/#e760513) to say it is prioritized by the working group, but that discussion is about a related but different specification: The one that the CSSWG wants to prioritize getting to CR is https://drafts.csswg.org/css-font-loading/ which is different from the https://tabatkins.github.io/specs/css-font-display/ spec discussed here. font-display has been discussed in the WG in the past, and is also (as can be see higher up in that IRC log) something the CSSWG wants to get going, but it is only about to become an official draft in the WG, not about to reach CR.The log clearly indicates that we were talking about css-font-display and even links to the draft (https://tabatkins.github.io/specs/css-font-display/). We resolved to publish a first public working draft for font-display as indicated in the log, at least that is how I remember it.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
Hi Florian,I want to apologize: I reread the IRC log and can confirm that I was confused.The resolution about the spec issues was regarding font-loading, not font-display.
We currently have 6 issues: 2 trivial editorial matters, and 4 issues with tentative consensus.We would love to hear feedback from the CSSWG on these 4 issues and the spec in general.
A related concern: generally we avoid shipping APIs based solely on specs in someone's personal GitHub. Eg. this can limit the ability of some implementors to provide technical feedback due to the lack of any IPR commitments, so we can't be confident that there aren't technical objections which haven't yet been raised.To ship this I'd personally prefer (other owners may feel differently) that we either:
- Move it into the csswg-drafts repo, get it published as a FPWD and work with CSSWG folks to get the spec in a state that the WG is comfortable with us shipping ASAP. OR
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
On May 12, 2017, at 03:10, Rick Byers <rby...@chromium.org> wrote:So this is a case where we delayed shipping for ~3 months to block on the CSSWG process.
I'm curious, to what extent has the spec for font-display improved during that time (i.e. what did we buy in exchange for the delay)?