W3C home > Mailing lists > Public > public-css-archive@w3.org > August 2021

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

From: CSS Meeting Bot via GitHub <sysbot+gh@w3.org>
Date: Wed, 25 Aug 2021 17:01:00 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-905712330-1629910859-sysbot+gh@w3.org>
The CSS Working Group just discussed `nesting of @supports inside @font-face`.

<details><summary>The full IRC log of that discussion</summary>
&lt;TabAtkins> Topic: nesting of @supports inside @font-face<br>
&lt;TabAtkins> github: https://github.com/w3c/csswg-drafts/issues/6520<br>
&lt;TabAtkins> leaverou: A little background, in the TAG review request the current syntax is extending the format() syntax for 'src'<br>
&lt;lea> https://github.com/w3c/csswg-drafts/blob/main/css-fonts-4/src-explainer.md#use-case-3-detectability<br>
&lt;TabAtkins> leaverou: It hasn't been implemented yet; Chrome is keen to implement quickly<br>
&lt;TabAtkins> leaverou: In the TAG we recognized the use-case, but were concerned about a new microsyntax when @supports alreayd exists<br>
&lt;TabAtkins> leaverou: So was thinking about how we could utilize @supports, and posted this issue<br>
&lt;chris> Explainer for current src descriptor https://github.com/w3c/csswg-drafts/blob/main/css-fonts-4/src-explainer.md<br>
&lt;TabAtkins> leaverou: Two things. First, adding a new @supports query for detecting font tech.<br>
&lt;TabAtkins> leaverou: Lets authors differentiate their CSS in other places; existing proposal only lets them use it when selecting font source.<br>
&lt;TabAtkins> leaverou: Could imagine authors wanting different CSS for a monochrome vs color font<br>
&lt;drott> q+<br>
&lt;TabAtkins> leaverou: This also makes it much easier to programmatically detect, vs doing rule hacking and seeing if there is a syntax error<br>
&lt;TabAtkins> leaverou: Google said they could add the font-tech queries in @supports easily<br>
&lt;TabAtkins> leaverou: Second bit is to let @supports nest inside of @font-face, extending the Nesting proposal<br>
&lt;TabAtkins> leaverou: But that would be a more substantial request<br>
&lt;TabAtkins> leaverou: So proposal is just to add the @supports queries for now - it does the job, if a bit clunky. And in the future perhaps do the nesting thing.<br>
&lt;Rossen_> ack drott<br>
&lt;TabAtkins> drott: Good summary. I'd support font-tech queries in @supports<br>
&lt;chris> q+<br>
&lt;TabAtkins> drott: And am open to later improving it by integrating Nesting, but the immediate benefit is just feature detection, so the @supports queries works for me.<br>
&lt;emilio> q+<br>
&lt;TabAtkins> drott: I've made a syntax proposal for Conditional 4 to support this<br>
&lt;Rossen_> ack chris<br>
&lt;TabAtkins> chris: I wrote an explainer for it<br>
&lt;TabAtkins> chris: [missed due to chop]<br>
&lt;drott> 👍<br>
&lt;TabAtkins> chris: TAG asked for an explainer; having written it, it was clear the only benefit of the existing syntax is that old browsers would parse without falling over<br>
&lt;TabAtkins> chris: It has no other redeeming features. It's an ugly complex microsyntax and is hard to read<br>
&lt;Rossen_> q?<br>
&lt;TabAtkins> chris: I think using @supports makes sense even if we can't use it directly in @font-face<br>
&lt;TabAtkins> chris: We've got some examples in the thread and I think it reads easily<br>
&lt;TabAtkins> emilio: I like this<br>
&lt;myles> q+<br>
&lt;Rossen_> ack emilio<br>
&lt;TabAtkins> emilio: Only question is if there's another place we need to parse this font stuff?<br>
&lt;chris> q+<br>
&lt;TabAtkins> emilio: To avoid the "specialized parser" thing that we try to avoid with @supports<br>
&lt;fantasai> TabAtkins: while trying to avoid specialized parse is a general goal<br>
&lt;fantasai> TabAtkins: we recognized there will be cases where we do<br>
&lt;fantasai> TabAtkins: as long as we're carefully scoped wrt feature queries that are not just parsing-based, should be OK<br>
&lt;TabAtkins> myles: One question - if an author uses @supports, is there a way to say "else"?<br>
&lt;TabAtkins> myles: If there's not a way to do that... @font-faces join together to form a family, rather than overriding<br>
&lt;Rossen_> q?<br>
&lt;Rossen_> ack myles<br>
&lt;TabAtkins> emilio: Can use "not"?<br>
&lt;TabAtkins> myles: "not" is both "fails the query" and "doesn't understand"<br>
&lt;TabAtkins> chris: Usual fallback is to put something normal outside, then override in a @supports<br>
&lt;TabAtkins> myles: Right, that's problematic; if it's supported it'll define a combined family using both @font-face rules.<br>
&lt;TabAtkins> myles: Author probably wants it to override<br>
&lt;drott> q+<br>
&lt;TabAtkins> myles: If they're careful they might override, like all same weight/etc, but if they didn't they'll both be present<br>
&lt;lea> q+<br>
&lt;chris> q+<br>
&lt;TabAtkins> q+<br>
&lt;fantasai> myles: and they will join together to form a family<br>
&lt;fantasai> myles: if descriptors aren't identical, might end up using both fonts in the page instead of only the second one<br>
&lt;chris> q-<br>
&lt;TabAtkins> chris: we already have this thing where font faces can combine together into a family, that's be design<br>
&lt;fantasai> TabAtkins: he's saying that conflicts with the author's design here.<br>
&lt;TabAtkins> myles: Right, if you have the non-conditional outside and the conditional inside, that's brittle<br>
&lt;emilio> TabAtkins: this is a general problem with a lot of things<br>
&lt;emilio> ... we don't have an answer to negate a query, but there's a proposal for an "else" on conditional rules<br>
&lt;dbaron[m]> some of these problems seem specific to @font-face inside @supports rather than @supports inside @font-face<br>
&lt;lea> q?<br>
&lt;fantasai> +1 dbaron[m]<br>
&lt;emilio> ... if there's implementor interest I'd be happy to revive it<br>
&lt;TabAtkins> https://tabatkins.github.io/specs/css-when-else/<br>
&lt;Rossen_> ack TabAtkins<br>
&lt;emilio> myles: I think there isn't a lot of sense to build the stopgap solution on something that doesn't exist yet<br>
&lt;TabAtkins> myles: If the oracle delivered us some way of having an else attached to @supports tomorrow, that woudl solve the problem<br>
&lt;chris> q+ to say format strings were a stopgap that lasted 2 1/2 decades<br>
&lt;TabAtkins> drott: I think this is an improvement over the current proposed syntax<br>
&lt;TabAtkins> drott: You're basing this on the concern on the likelihood of a typo; I think most will be coming from 3rd party fonts so that's not really a concern<br>
&lt;Rossen_> ack drott<br>
&lt;TabAtkins> drott: Second, in browsers where author expects font-tech(color) to work, "not" would work<br>
&lt;TabAtkins> myles: I think it would help if after this call we could have an example of the fallback<br>
&lt;chris> the issue already has such an example<br>
&lt;TabAtkins> lea: There's a snippet in the issue that Chris posted<br>
&lt;Rossen_> q?<br>
&lt;Rossen_> ack lea<br>
&lt;TabAtkins> leaverou: I think drott mentioned most points<br>
&lt;TabAtkins> leaverou: Reminder that this isn't *ideal* but it can be done quickly, and when we go on to nesting it'll work without duplication<br>
&lt;TabAtkins> leaverou: Also think ahving "else" in a conditional block would be super useful; it shouldn't hold this up tho.<br>
&lt;drott> +1 for not blocking on an else block<br>
&lt;TabAtkins> Agreed, fwiw<br>
&lt;Rossen_> ack dbaron[m]<br>
&lt;Zakim> dbaron[m], you wanted to react to lea<br>
&lt;TabAtkins> But happy to lean on this to grab impl support ^_^<br>
&lt;Rossen_> ack dbaron[m]<br>
&lt;TabAtkins> dbaron[m]: My understanding of myles' concern is - I think a lot applies if we have @supports { @font-face{}}, but a lot of the proposal is doing @font-face { @supports{}}, and I don't think the interaction concerns apply in that case<br>
&lt;Rossen_> q<br>
&lt;TabAtkins> myles: Right. I have different feedback in that case, but the proposal is currently the first case.<br>
&lt;lea> q?<br>
&lt;TabAtkins> fantasai: First, given myles' example, I do have concern about allowing this without inline/nested supports, becuase of his mentioned concerns<br>
&lt;lea> q+ to say that this problem actually exists today when defining font families, it's not new<br>
&lt;TabAtkins> fantasai: Second, it seems the proposal is to add font-technology() function which include some features that could be part of a font format, but it's not clear to me how that relates tot he font format<br>
&lt;drott> q+<br>
&lt;TabAtkins> fantasai: What if the browser supports colorv1 in woff2, but not others. Would we need to tie the feature query to a font format?<br>
&lt;Rossen_> ack fantasai<br>
&lt;drott> q-<br>
&lt;TabAtkins> chris: woff1 and woff2 are encodings of the same font tech (truetype)<br>
&lt;chris> 1. stopgap 2. OM complexity inside @font-face 3. making other stylistic changes based on font support 4. unrelated to formats<br>
&lt;Rossen_> ack chris<br>
&lt;Zakim> chris, you wanted to say format strings were a stopgap that lasted 2 1/2 decades<br>
&lt;TabAtkins> chris: The entire format string was a stopgap because we didn't have font mime types<br>
&lt;TabAtkins> chris: So "stopgap" is a non-argument in my mind<br>
&lt;TabAtkins> chris: If we do put @supports inside @font-face it complicates the OM; current proposal avoid that<br>
&lt;TabAtkins> chris: Using @supports doesn't just allow switching font, it lets you vary other aspects of your style<br>
&lt;TabAtkins> chris: Finally, the only reason supports were smuggled into format string is for parsing. But spec actually mandates OpenType and TrueType treated the same.<br>
&lt;TabAtkins> chris: So the font technology is almost completely orthogonal to the format used<br>
&lt;myles> q+ to respond to chris<br>
&lt;drott> q+<br>
&lt;TabAtkins> chris: So decoupling as this proposal does is a much clearner and nicer way<br>
&lt;chris> q?<br>
&lt;Rossen_> ack lea<br>
&lt;Zakim> lea, you wanted to say that this problem actually exists today when defining font families, it's not new<br>
&lt;myles> q-<br>
&lt;TabAtkins> lea: The concern myles brought up about typos is already existant; when authors write a family they could already typo and have the wrong family happen<br>
&lt;Rossen_> ack drott<br>
&lt;TabAtkins> drott: as lea mentioned, the reason we brought to the TAG is it seemed helpful to get some time of feature detection for COLR v1, so I hope we can have CSS support for that at the same time<br>
&lt;TabAtkins> Rossen_: I think the TAG feedback was clear - colr1 was gonna be a great addition<br>
&lt;chris> s/was/is/<br>
&lt;TabAtkins> Rossen_: Introducing new microsyntaxes is generally discouraged when we have existing feature-detect capabilities<br>
&lt;TabAtkins> Rossen_: I appreciate you ahve some impl urgency on your end. Important to get what's gonna stick for the future right tho.<br>
&lt;Rossen_> q?<br>
&lt;TabAtkins> Rossen_: So not sure I'm hearing the solution that addresses the current user needs and the tech being proposed<br>
&lt;chris> s/colr1/COLRv1<br>
&lt;TabAtkins> Rossen_: With two minutes remaining, unsure if we'll have a resolution<br>
&lt;TabAtkins> Rossen_: Propose we continue in the issue and bring this back next week for resolution<br>

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

Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 25 August 2021 17:01:03 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:42 UTC