Re: [csswg-drafts] [css-fonts-4][css-nesting] Nesting of @supports inside @font-face and font technology feature queries (#6520)

> I don't understand. If they have the same glyph set, and same CMAP coverage - why would a character then _not_ be supported by the preferred font? The load for the fallback only needs to be triggered if the primary font doesn't have coverage and such was determined during font analysis or shaping, but if coverage was already found, no load is needed.

The point is that for a character that turns out *not* to be supported (by either the primary or fallback fonts, as they have the same glyph set) the fallback nevertheless has to be loaded *in order to determine its coverage*.

So if you use the "obvious" pattern to implement progressive enhancement (or graceful degradation, to look at it from the other side):
```
@font-face { font-family: my-icons; src: url(my-icons-bw-fallback.woff2); }

@supports font-technology(color-COLRv0) {
  @font-face { font-family: my-icons; src: url(my-icons-flat-colors.woff2); }
}

@supports font-technology(color-COLRv1) {
  @font-face { font-family: my-icons; src: url(my-icons-gradient-colors.woff2); }
}
```
a browser that implements both COLRv0 and COLRv1 will see all three of the `@font-face` rules.

Now, when the browser encounters a character X that is *not* supported by `my-icons`, it will fail to find it in the COLRv1 resource; so it will load the COLRv0 font to check its coverage. Again, it'll fail to find the character, so it'll load the BW font; and again, fail to find the character. So it has loaded *all three* resources in order to check the character coverage of each, even though the author's intention was to just use the best supported version of the three.

To avoid this, the author has to construct more complex `@supports` rules such that any given browser will only "see" the single preferred one of the `@font-face` declarations, rather than all the forms it supports. Given, for example, five possible `color-*` technologies, this could get quite unwieldy.

-- 
GitHub Notification of comment by jfkthame
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6520#issuecomment-906384393 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 26 August 2021 12:58:00 UTC