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

Review Request: CSS Fonts src: descriptor syntax for client side font selection #666

Closed
1 task done
drott opened this issue Aug 9, 2021 · 9 comments
Closed
1 task done
Assignees
Labels
chromium-high-priority Something that the Chromium team would like the TAG to prioritise Resolution: satisfied with concerns The TAG is satisfied with this work overall but requires changes

Comments

@drott
Copy link

drott commented Aug 9, 2021

I'm requesting a TAG review of the extended format() and supports(<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.

Further details:

  • I have reviewed the TAG's Web Platform Design Principles
  • Relevant time constraints or deadlines: ideally as soon as possible, as we'd like to have a way of COLRv1 font format feature detection available before shipping COLRv1
  • The group where the work on this specification is currently being done: CSS WG
  • Major unresolved issues with or opposition to this specification:
    • No major unresolved issues, TAG review requested mainly as we would be the first to ship in Chrome and considerations listed below.
  • This work is being funded by: Google

Additional considerations

Additional privacy considerations

In addition to the security and privacy self-questionnaire of the CSS fonts spec:

What information might this feature expose to Web sites or other parties, and for what purposes is that exposure necessary?
Do features in your specification expose the minimum amount of information necessary to enable their intended uses?

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 negotation techniques such as the Accept: header or client hints
  • preload optimizations with their type attribute for pre-requesting resources.

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:

I was initially concerned by the fact that these technologies are not well represented in the relevant mime type that can then be used for selection in preload and as part of the Accept header.
But given the fact that preload's type based selection is breaking at the seams when it comes to image types as well as in the face of many different font features, with different levels of support across browsers, it seems like it may be time to design a separate selection mechanism there that wouldn't rely so heavily on mime types.
Regarding Accept, after further thinking, I was not excited about adding the font capabilities to that header because: a) it may expose more passive entropy b) the content-negotiation for fonts is often needed when serving the stylesheet, and sending Accept values for fonts as part of the stylesheet request felt weird. Talking to the Privacy Sandbox folks, they seem to generally agree with (a) and that we may need an alternative mechanism to enable font capabilities based content negotiation.

As such, I think it's fine that this feature is considering the various font capabilities as an orthogonal dimension to font formats and enabling client-side content-negotiation based on that. That seems like an important use case.

We'd prefer the TAG provide feedback as:

💬 leave review feedback as a comment in this issue and @-notify @yoavweiss @svgeesus @jfkthame

@kenchris
Copy link

kenchris commented Aug 11, 2021

Congratulation on making review request #666 😈👿 This now has a milestone

@atanassov
Copy link

atanassov commented Aug 16, 2021

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.

@chrishtr chrishtr added the chromium-high-priority Something that the Chromium team would like the TAG to prioritise label Aug 17, 2021
@drott
Copy link
Author

drott commented Aug 18, 2021

Hi @drott, similar to other design reviews, can you add an actual explainer to this review?

Explainer added to edited description, available at https://github.com/drott/format-supports-explainer.

@svgeesus
Copy link

@svgeesus
Copy link

Huh, great minds think alike, eh? 🤣

@drott
Copy link
Author

drott commented Aug 18, 2021

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.

@svgeesus
Copy link

Mine is maybe better on history, yours is better on the detectability and non-goals

@atanassov
Copy link

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 @supports (see w3c/csswg-drafts#6520 as proposed example) before going after a new microsyntax solution.
FYI, the TAG is working on adding an explicit guidance discouraging new microsyntax from being added (see w3ctag/design-principles#213).

Thank you for working with us. Good luck.

@atanassov atanassov added Resolution: satisfied The TAG is satisfied with this design and removed Progress: in progress labels Aug 18, 2021
@plinss plinss added a11y-needs-resolution Issue the Accessibility Group has raised and looks for a response on. Resolution: satisfied with concerns The TAG is satisfied with this work overall but requires changes labels Aug 18, 2021
@atanassov atanassov removed Resolution: satisfied The TAG is satisfied with this design a11y-needs-resolution Issue the Accessibility Group has raised and looks for a response on. labels Aug 18, 2021
@plinss plinss added a11y-needs-resolution Issue the Accessibility Group has raised and looks for a response on. and removed a11y-needs-resolution Issue the Accessibility Group has raised and looks for a response on. labels Aug 18, 2021
@drott drott changed the title Review Reqest: CSS Fonts src: descriptor syntax for client side font selection Review Request: CSS Fonts src: descriptor syntax for client side font selection Aug 23, 2021
@svgeesus
Copy link

For those following along at home the two explainers have now been merged

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Sep 8, 2022
[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
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Sep 9, 2022
[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
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Sep 12, 2022
[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
aarongable pushed a commit to chromium/chromium that referenced this issue Sep 13, 2022
[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}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Sep 13, 2022
[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}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Sep 13, 2022
[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}
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Sep 24, 2022
…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
jamienicol pushed a commit to jamienicol/gecko that referenced this issue Sep 27, 2022
…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
mjfroman pushed a commit to mjfroman/moz-libwebrtc-third-party that referenced this issue Oct 14, 2022
[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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chromium-high-priority Something that the Chromium team would like the TAG to prioritise Resolution: satisfied with concerns The TAG is satisfied with this work overall but requires changes
Projects
None yet
Development

No branches or pull requests

7 participants