-
Notifications
You must be signed in to change notification settings - Fork 56
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
Review Request: CSS Fonts src: descriptor syntax for client side font selection #666
Comments
Congratulation on making review request #666 😈👿 This now has a milestone |
Hi @drott, similar to other design reviews, can you add an actual explainer to this review? Having well articulated user needs and scenarios, the different approaches you considered and how this proposal addresses these is valuable to the review and for posterity. |
Explainer added to edited description, available at https://github.com/drott/format-supports-explainer. |
Huh, great minds think alike, eh? 🤣 |
Oups, I was just about to email you. Thanks so much for this! Yours looks better, I'll do a pull request with some suggestions in regards to the detectability aspect and non-goals. |
Mine is maybe better on history, yours is better on the detectability and non-goals |
Wow, thank you both for all the explanations! :) We like the general use cases and proposed direction of this feature. However we're concerned about the replication of an existing feature, so before shipping we hope that you will work with the CSS Working Group to exhaust any existing CSS feature detection mechanisms such as Thank you for working with us. Good luck. |
For those following along at home the two explainers have now been merged |
[1] defines two additional conditional functions `font-tech()` and `font-format()` which were introduced after the resolution of TAG review [2] and discussion in the CSS working group [3]. These functions allow conditional CSS to be included depending on level of font support in the font stack of the UA. Feature detection becomes particular important when checking for the level of color font support, as UA capabilities still very and not all user agents provide support for COLRv1 for example. Implement behind `SupportsFontFormatTech` RuntimeEnabledFeatures flag for now, pending I2S. [1] https://www.w3.org/TR/css-conditional-5/#at-supports-ext [2] w3ctag/design-reviews#666 [3] w3c/csswg-drafts#6520 (comment) Bug: 1255685 Change-Id: I96ab292bc9644b049a84e073b367063cdbedd26f
[1] defines two additional conditional functions `font-tech()` and `font-format()` which were introduced after the resolution of TAG review [2] and discussion in the CSS working group [3]. These functions allow conditional CSS to be included depending on level of font support in the font stack of the UA. Feature detection becomes particular important when checking for the level of color font support, as UA capabilities still very and not all user agents provide support for COLRv1 for example. Implement behind `SupportsFontFormatTech` RuntimeEnabledFeatures flag for now, pending I2S. [1] https://www.w3.org/TR/css-conditional-5/#at-supports-ext [2] w3ctag/design-reviews#666 [3] w3c/csswg-drafts#6520 (comment) Bug: 1255685 Change-Id: I96ab292bc9644b049a84e073b367063cdbedd26f
[1] defines two additional conditional functions `font-tech()` and `font-format()` which were introduced after the resolution of TAG review [2] and discussion in the CSS working group [3]. These functions allow conditional CSS to be included depending on level of font support in the font stack of the UA. Feature detection becomes particular important when checking for the level of color font support, as UA capabilities still very and not all user agents provide support for COLRv1 for example. Implement behind `SupportsFontFormatTech` RuntimeEnabledFeatures flag for now, pending I2S. [1] https://www.w3.org/TR/css-conditional-5/#at-supports-ext [2] w3ctag/design-reviews#666 [3] w3c/csswg-drafts#6520 (comment) Bug: 1255685 Change-Id: I96ab292bc9644b049a84e073b367063cdbedd26f
[1] defines two additional conditional functions `font-tech()` and `font-format()` which were introduced after the resolution of TAG review [2] and discussion in the CSS working group [3]. These functions allow conditional CSS to be included depending on level of font support in the font stack of the UA. Feature detection becomes particular important when checking for the level of color font support, as UA capabilities still very and not all user agents provide support for COLRv1 for example. Implement behind `SupportsFontFormatTech` RuntimeEnabledFeatures flag for now, pending I2S. [1] https://www.w3.org/TR/css-conditional-5/#at-supports-ext [2] w3ctag/design-reviews#666 [3] w3c/csswg-drafts#6520 (comment) Bug: 1255685 Change-Id: I96ab292bc9644b049a84e073b367063cdbedd26f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3197710 Commit-Queue: Dominik Röttsches <drott@chromium.org> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1046434}
[1] defines two additional conditional functions `font-tech()` and `font-format()` which were introduced after the resolution of TAG review [2] and discussion in the CSS working group [3]. These functions allow conditional CSS to be included depending on level of font support in the font stack of the UA. Feature detection becomes particular important when checking for the level of color font support, as UA capabilities still very and not all user agents provide support for COLRv1 for example. Implement behind `SupportsFontFormatTech` RuntimeEnabledFeatures flag for now, pending I2S. [1] https://www.w3.org/TR/css-conditional-5/#at-supports-ext [2] w3ctag/design-reviews#666 [3] w3c/csswg-drafts#6520 (comment) Bug: 1255685 Change-Id: I96ab292bc9644b049a84e073b367063cdbedd26f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3197710 Commit-Queue: Dominik Röttsches <drott@chromium.org> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1046434}
[1] defines two additional conditional functions `font-tech()` and `font-format()` which were introduced after the resolution of TAG review [2] and discussion in the CSS working group [3]. These functions allow conditional CSS to be included depending on level of font support in the font stack of the UA. Feature detection becomes particular important when checking for the level of color font support, as UA capabilities still very and not all user agents provide support for COLRv1 for example. Implement behind `SupportsFontFormatTech` RuntimeEnabledFeatures flag for now, pending I2S. [1] https://www.w3.org/TR/css-conditional-5/#at-supports-ext [2] w3ctag/design-reviews#666 [3] w3c/csswg-drafts#6520 (comment) Bug: 1255685 Change-Id: I96ab292bc9644b049a84e073b367063cdbedd26f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3197710 Commit-Queue: Dominik Röttsches <drott@chromium.org> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1046434}
…etection extensions, a=testonly Automatic update from web-platform-tests Support CSS Conditional 5 font feature detection extensions [1] defines two additional conditional functions `font-tech()` and `font-format()` which were introduced after the resolution of TAG review [2] and discussion in the CSS working group [3]. These functions allow conditional CSS to be included depending on level of font support in the font stack of the UA. Feature detection becomes particular important when checking for the level of color font support, as UA capabilities still very and not all user agents provide support for COLRv1 for example. Implement behind `SupportsFontFormatTech` RuntimeEnabledFeatures flag for now, pending I2S. [1] https://www.w3.org/TR/css-conditional-5/#at-supports-ext [2] w3ctag/design-reviews#666 [3] w3c/csswg-drafts#6520 (comment) Bug: 1255685 Change-Id: I96ab292bc9644b049a84e073b367063cdbedd26f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3197710 Commit-Queue: Dominik Röttsches <drott@chromium.org> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1046434} -- wpt-commits: 44fa87cd7ce5e68233f175065cf070518c6c9955 wpt-pr: 35829
…etection extensions, a=testonly Automatic update from web-platform-tests Support CSS Conditional 5 font feature detection extensions [1] defines two additional conditional functions `font-tech()` and `font-format()` which were introduced after the resolution of TAG review [2] and discussion in the CSS working group [3]. These functions allow conditional CSS to be included depending on level of font support in the font stack of the UA. Feature detection becomes particular important when checking for the level of color font support, as UA capabilities still very and not all user agents provide support for COLRv1 for example. Implement behind `SupportsFontFormatTech` RuntimeEnabledFeatures flag for now, pending I2S. [1] https://www.w3.org/TR/css-conditional-5/#at-supports-ext [2] w3ctag/design-reviews#666 [3] w3c/csswg-drafts#6520 (comment) Bug: 1255685 Change-Id: I96ab292bc9644b049a84e073b367063cdbedd26f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3197710 Commit-Queue: Dominik Röttsches <drott@chromium.org> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1046434} -- wpt-commits: 44fa87cd7ce5e68233f175065cf070518c6c9955 wpt-pr: 35829
[1] defines two additional conditional functions `font-tech()` and `font-format()` which were introduced after the resolution of TAG review [2] and discussion in the CSS working group [3]. These functions allow conditional CSS to be included depending on level of font support in the font stack of the UA. Feature detection becomes particular important when checking for the level of color font support, as UA capabilities still very and not all user agents provide support for COLRv1 for example. Implement behind `SupportsFontFormatTech` RuntimeEnabledFeatures flag for now, pending I2S. [1] https://www.w3.org/TR/css-conditional-5/#at-supports-ext [2] w3ctag/design-reviews#666 [3] w3c/csswg-drafts#6520 (comment) Bug: 1255685 Change-Id: I96ab292bc9644b049a84e073b367063cdbedd26f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3197710 Commit-Queue: Dominik Röttsches <drott@chromium.org> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1046434} NOKEYCHECK=True GitOrigin-RevId: edc25f50b7faec81cc5538f50364564ff8070ed7
I'm requesting a TAG review of the extended
format()
andsupports(<technology>)
syntax of the src: descriptor of@font-face
, see 4.3.1. Parsing the src descriptor of the CSS Fonts spec.src:
...[ format(<font-format> [supports <font-technology>#]?)]?
The extended syntax serves as a means for the UA to select the most advanced font technology from a list of stated font sources, by traversing the list and selecting the first for which the UA provides support.
As Chrome would be the first browser to ship support for the
supports(<font-technology>)
I am requesting TAG review.Because the specification also mandates the UA to drop unsupported entries from the list of sources specified in the
@font-face
src:
line, this syntax can be used together with JavaScript accessing the CSSOM in order to detect which features are supported. This provides desired feature detection capabilities before the introduction of the COLRv1 font format.Feature detection of font formats is already possible through canvas based methods, see more details in the additional security and privacy considerations below.
format()
andsupports()
syntaxsupports
syntaxFurther details:
Additional considerations
Additional privacy considerations
In addition to the security and privacy self-questionnaire of the CSS fonts spec:
Font technology support can generally be detected using Canvas methods, compare https://pixelambacht.nl/chromacheck/ made by @RoelN. Exposing font technology support in this syntax would thus not expose fundamentally new information.
In the Blink-dev intent-to-ship @krgovind also asked, "...whether this mechanism could reveal anything more granular than the major version of the user agent. Is it possible for font technology support to evolve faster than major UA versions (e.g. via OS stack updates, or in minor UA versions)?"
I responded, that it depends on whether we look at a particular implementation or look at the spec conceptually:
Speaking for Chrome, changes in which font technologies are supported would usually coincide with a major version of the user agent, indeed, or switching a flag on when using a rollout via Chrome variations/flags. In Blink, we use a hybrid font stack that is composed of the system font stack's rasterising capabilities (DirectWrite, CoreText) combined with Skia +FreeType's rasterisation capabilities to fill in gaps in the system rasteriser. Using this stack, we can provide support for all the font formats we support (OpenType variations, color font formats: COLRv0, SBIX, CBDT) on all OSes where we have our own engine (iOS excluded). This means we would not reveal any font technology support differences using this feature as we can cover the gaps with the Skia+FreeType backend.
However, at the specification level, conceptually, this feature can reveal more than the user agent major version if in non-Chrome implementation platform font support differs and a UA provides different support on different platforms. Firefox, as an example, does not have a hybrid font stack capability so their font technology support differs on different platforms. So a correct implementation of this feature in a UA that supports some font technologies only on some platforms would reveal information about the underlying OS/platform as well - so the granularity is similar to UA major version + platform (Win, Mac, Linux, etc.).
Relationship to server side negotiation
During the discussion on blink-dev the question was brought up by @yoavweiss in how this feature compares or relates to
Server-side content negotiation at the time of requests to font blobs or CSS stylesheets are additional tools for selecting the right font content. Preload optimisations as well.
We concluded that there is room for improvement for server side negotiation when requesting font resources. Currently, third-party font providers such as Google Fonts make use of user agent information to decide what CSS to ship. Additional discussions showed that improving this server-side content-negotiation should likely be done through extending UA client hints to give indication about supported font technologies. We concluded that mapping a set of font-technologies supported by the UA to a set of mime-types is likely not a good approach.
In any event, both (server-side content negotiation, preload optimizations) and client side content selection of font resources through the advanced
@font-face
src: ..supports(<font-technology>)
syntax provide useful tools at different stages of fetching and rendering content, which both serve different needs.Quote from @yoavweiss on blink-dev:
We'd prefer the TAG provide feedback as:
💬 leave review feedback as a comment in this issue and @-notify @yoavweiss @svgeesus @jfkthame
The text was updated successfully, but these errors were encountered: