Re: [csswg-drafts] [css-fonts-4] @font-family src: should accept a specifier which lists font requirements

The Working Group just discussed `Fonts l4 super-format()`, and agreed to the following resolutions:

* `RESOLVED: Parse the value of src throwing out invalid parts like media queries and not like selectors. aka You split on the commas and throw out the pieces you don't understand not the whole thing.`
* `RESOLVED: use this: format(<string> [supports (list from spec)#]?)`

<details><summary>The full IRC log of that discussion</summary>
&lt;dael> Topic: Fonts l4 super-format()<br>
&lt;dael> github: https://github.com/w3c/csswg-drafts/issues/633<br>
&lt;dael> myles: There has been much movement in typography industry in the last several years. There are many features fonts can opt into now. One of the tenants of this new world where fonts can have technology inside is browsers that don't support a technology should not trigger downloading a font with that inside.<br>
&lt;dael> myles: In @font-face rules in the past this was done with the format function with the source description.<br>
&lt;dael> myles: Inside the format function it accepts a string. now that we have 3 optional technology we prob shouldn't generate a bunch of strings with tokens. There should be a way for an @font-face to associate a URL with a set of requirements where only if browser fits requirements they should use this.<br>
&lt;dael> myles: That's the issue. We don't have an opinion as to which proposal to do this should be picked. There's one we seem to be zeroing in on in the issue<br>
&lt;dael> ChrisL: We have the format specifier and we don't want the combinatorial thing where we add more things and it explodes. So wexpand the format specifier to that it has a string of what it requires. So exising browser can reject that font. That seems to be where the thread is ending.<br>
&lt;dael> myles: Proposal is do we extend format to extend this.<br>
&lt;dael> Vlad: Hypothetical. Open type font that supports regular + color glyphs + variations. If you can't use color the font provides you the downgrade.<br>
&lt;ChrisL> so for example `format("opentype", requires variations, requires color)`<br>
&lt;dael> myles: Yes. All of these technologies are created such that they are opt in and the browser can still use the font file. Tht's great for backwards compat but these new tech can add significant space in the font file.<br>
&lt;dael> myles: In the case of color glyphs it's a lot. It would be great if browsers didn't have to download more data then needed.<br>
&lt;dael> florian: Is this also avoid the case od a browser choosing to download a variable font when they don't suppor that instead of downloading other fonts.<br>
&lt;dael> astearns: I thought that was correct. Browsers that don't support variable fonts will not download a font with that tag. DOesn't matter if the font in the declarion supports variables, but it's a tag for only if the browser supports variables.<br>
&lt;dael> florian: So fold variable into the rest.<br>
&lt;dael> myles: yes.<br>
&lt;dael> fremy: WE shipped variables and color fonts so if we add this our existing impl will not recognize the new required flags because it doesn't think we know the font. Would have better to think of this before.<br>
&lt;dael> ChrisL: That is why the thread started in 2016.<br>
&lt;dael> myles: We've got the same problem.<br>
&lt;dael> myles: There is a proposal. Is there feedback on it?<br>
&lt;dael> fantasai: Which proposal?<br>
&lt;dael> ChrisL: It's in IRC<br>
&lt;dael> ChrisL: So for that example:  `format("opentype", requires variations, requires color)` you have to support both.<br>
&lt;dael> fantasai: ameliaBR suggested using the names of the font<br>
&lt;dael> myles: One feature can have many tables so you need one representitive table<br>
&lt;dael> fantasai: We do that for @supports anyone<br>
&lt;astearns> s/names of the/names of the tables of the<br>
&lt;dael> ChrisL: For variable fonts there's one table for every table that exists so you ave to list a ton<br>
&lt;dael> fantasai: You use one as a proxy for the rest.  You use @supports display:grid and I assume the rest<br>
&lt;dael> Jason: Font tables aren't something that users commonly know.<br>
&lt;dael> Jason: I think the concernw ould be that people who know about font format technology might know the tables exist but most font users don't. If we're going to pick a table we might as well pick a keyword as the thing which is more understandable to users of fonts.<br>
&lt;dael> ChrisL: Think so, yes.<br>
&lt;dael> myles: There are 4 popular color font formats and they're all competing. Some browsers support some. Edge does all. It kinda matters.<br>
&lt;jpamental> Just chiming in that the Jason mentioned above is me<br>
&lt;dael> myles: That's a situation where the table matters. Variations is different. I think keywords is a good pick so you can say I support variations.<br>
&lt;dael> eae: You don't want to download the font 4 times that has the same variation.<br>
&lt;dael> ChrisL: It's all open type.<br>
&lt;dael> fantasai: There's a few situations where you need more then does it support.<br>
&lt;dael> Vlad: Can you desc an example where this functionality is needed?<br>
&lt;dael> myles: I don't want to download font files....<br>
&lt;dael> Vlad: You're a user and you want color glyphs or nothing at all. Is that the case?<br>
&lt;dael> astearns: Author intent is I was the display color glyphs in this font if I'm in a browser that supports it. If I'm in a browser that doesn't support it I want to download only the smaller font so I get it faster.<br>
&lt;dael> ChrisL: These are subsetted fonts. You've got one that does svg one that does spix.<br>
&lt;dael> myles: It's up the the author but yes.<br>
&lt;dael> Rick: Same hting happens with variable fonts. I could have a bold weight and a light weight and I want to sort them out.<br>
&lt;dael> astearns: I prefer the keywords. Since there are 4 color font flavors do we need for keywords<br>
&lt;dael> many: yes<br>
&lt;dael> myles: And there will be variations and features<br>
&lt;dael> TabAtkins: If a color wins we'll add color as an alis to it.<br>
&lt;dael> fantasai: You might want references to open type tables for the future. Let's say there's an open type table where support is necessary to use this crazy script.<br>
&lt;dael> fantasai: WE can have keywords for the most common things, but might also want to support the more specific cases.<br>
&lt;TabAtkins> `requires variations, requires table "YOLO"<br>
&lt;TabAtkins> `requires variations, requires table "YOLO"<br>
&lt;astearns> `supports`: keyword | "XXXX"<br>
&lt;TabAtkins> `requires variations, requires table "YOLO"`<br>
&lt;dael> astearns: You mean ^?<br>
&lt;dael> astearns: Arbitrary 4 letter strings which you can put for supportsand you check if browser does anything?<br>
&lt;dael> myles: We can have a feature keyed off a specific table but we shouldn't have that many variations. We can have both.<br>
&lt;dael> ChrisL: should use it for open type features?<br>
&lt;dael> fantasai: Interesting point.<br>
&lt;dael> astearns: Since this issue has been open for years can we do keywords for now and extend later as we find use cases? Particularly if there's a language thing with shaping tables where if a table to load a font in some browsers is the useful thing.<br>
&lt;dael> fantasai: One of the reasons you don' want to defer is if you add it later the brwosers will throw out hte entire declaration So you either define a subset and say we may extend in the future.<br>
&lt;dael> ChrisL: It's important to not throw out the whole declaration.<br>
&lt;dael> fremy: Can't we use string and say we split by slash?<br>
&lt;dael> myles: A micro syntax? It's not good of OMs.<br>
&lt;dael> ChrisL: You said it was backwards compat if you use slash?<br>
&lt;dael> myles: Browsers would look at the format scring and parse.<br>
&lt;dael> fantasai: Micro syntax is more complicated if we extend.<br>
&lt;dael> fremy: If we do this it still works in previous browsers. They'll still parse it. If we require something we'll remove all the fonts in src because if you do something inside the string we don't know.<br>
&lt;dael> TabAtkins: Download source twice. Source for simpliest and second for requires.<br>
&lt;dael> fantasai: Shouldn't we use supports to be consistant?<br>
&lt;dael> myles: browser-support font-files<br>
&lt;dael> fremy: Can't you check if the browser supports font varients?<br>
&lt;dael> myles: It doesn't work for color fonts because the css support for palettes is across types of formats<br>
&lt;dael> TabAtkins: Should we be careful with how we define to add more features. If we say it supports custom ident.<br>
&lt;dael> myles: Syntax isn't a | b | c it's just custom ident?<br>
&lt;dael> TabAtkins: WE'll say these are defined custom idents and if you see one you don't know you don't support it.<br>
&lt;dael> fantasai: I think more general and the values are comma sep but if you don't understand any part of it it throws that part out. It's a change to parsing that opens the whole relmn of possibilities in the future.<br>
&lt;dael> TabAtkins: Yeah. Only poss. backwards compat is if people add nonsense in their source and expect it not to download this will jsut htrow away the nonsense.<br>
&lt;dael> astearns: Does that exist?<br>
&lt;dael> TabAtkins: No.<br>
&lt;dael> fantasai: I'd say we resolve on that.<br>
&lt;dael> fantasai: Prop: The values of the src descriptor, the entire declaration is not thrown out if any comma separated section is invalid<br>
&lt;dael> myles: Parsing is chop it into commas, run parse on each piece, and if that piece doesn't parse throw it out.<br>
&lt;dael> fantasai: Like MQ not like selectors.<br>
&lt;dael> TabAtkins: The grammar would have to be like custom properties, that's less good.<br>
&lt;dael> astearns: Objections to not throwing out a source descriptor if a comma separated piece does  not parse<br>
&lt;dael> fremy: Inside a function we can extend, right?<br>
&lt;dael> fantasai: This is broader.<br>
&lt;TabAtkins> TabAtkins: So I'll need to put together some prose to handle that in the grammar.<br>
&lt;dael> RESOLVED: Parse the value of src throwing out invalid parts like media queries and not like selectors. aka You split on the commas and throw out the pieces you don't understand not the whole thing.<br>
&lt;fantasai> Like Media Queries, not like Selectors<br>
&lt;TabAtkins> (unfortunately) not like Selectors<br>
&lt;dael> fantasai: Now people can impl that while we figure out the rest.<br>
&lt;astearns> (fortunately) not like (unfortunate) Selectors<br>
&lt;dael> myles: Now we have that we don't need the string thing. We can just use keywords.<br>
&lt;dael> fantasai: That's a different problem. If you just have keywords that are predefined.<br>
&lt;dael> myles: got it<br>
&lt;myles> format("opentype", [requires custom-ident]#)<br>
&lt;fantasai> s/predefined/predefined, then you can only query predefined things/<br>
&lt;dael> myles: Proposal #2 is ^<br>
&lt;myles> format(DOMString, [requires custom-ident]#)<br>
&lt;dael> astearns: Extending source descriptor to a comma sep list of requirest custom ident<br>
&lt;dael> TabAtkins: not requires<br>
&lt;dael> ChrisL: When I type that out I'll have commas?<br>
&lt;dael> myles: Yes.<br>
&lt;dael> TabAtkins: No requires is no commas.<br>
&lt;fantasai> format(&lt;string>, [requires &lt;custom-ident>#)<br>
&lt;dael> fantasai: This is what you meant ^<br>
&lt;fantasai> format(&lt;string>, [requires &lt;custom-ident>]#)<br>
&lt;ChrisL> almost<br>
&lt;dael> myles: You missed the square bracket<br>
&lt;dael> TabAtkins: With the resolution we don't need the custom-ident business.<br>
&lt;dael> ChrisL: So I can put inherit and stuff in there?<br>
&lt;dael> myles: It's all inside the one format string...I guess that's okay.<br>
&lt;dael> TabAtkins: With the resolution if we mint a brand new requires keyword tomorrow and someone uses it for browsers that don't know it that chunk of the source will be thrown out.<br>
&lt;dael> astearns: If you put in "requires color-something"...oh!<br>
&lt;dael> myles: it goes on to the next source.<br>
&lt;dael> astearns: You break up things between commas which reduces to the things you know.<br>
&lt;ChrisL> so there is an implicit AND, on the requires<br>
&lt;dael> TabAtkins: Source splits on commas and only checks individual pieces<br>
&lt;dael> astearns: Got it.<br>
&lt;dael> myles: I think we're okay.<br>
&lt;dael> fantasai: Do you need requires word?<br>
&lt;Joel> Hi there!I'm Joël from Fontself, I'm really interested about OpenType-SVG / Color fonts<br>
&lt;Joel> My colleagues Mohamed and Franz will be at TypoLabs<br>
&lt;dael> astearns: I like an indication of what this is about. I liked supports better.<br>
&lt;dael> TabAtkins: Open type is written as a string. We can't restrict it because it's an extern source. That's why tables as a string. If we define it's an ident.<br>
&lt;dael> myles: Authors won't understand.<br>
&lt;Joel> Their flight was cancelled at the last minute, they will be in Berlin tonight ;-)<br>
&lt;dael> myles: I think I'm with astearns that having a keyword would be helpful.<br>
&lt;dael> fantasai: Put with many things you have to write it many times.<br>
&lt;dael> astearns: Ties in the supports.<br>
&lt;dael> fantasai: prefer if you don't have to repeat it.<br>
&lt;dael> myles: can you write the grammar so that we don't have to repeat?<br>
&lt;fantasai> format(&lt;string> supports &lt;custom-ident>#)<br>
&lt;dael> fantasai: There ^<br>
&lt;fantasai> format(&lt;string> [supports &lt;custom-ident>#]?)<br>
&lt;dael> myles: Looks like supports is required, though.<br>
&lt;dael> fantasai: there ^<br>
&lt;dael> myles: And a comma<br>
&lt;dael> fantasai: Getting rid of the comma<br>
&lt;dael> TabAtkins: If we're removing supports no commas.<br>
&lt;dael> myles: Okay.<br>
&lt;dael> [everyone argues about commas]<br>
&lt;astearns> (which is a recurring theme)<br>
&lt;dael> ChrisL: The longest github thread ever was about using commas in the color function.<br>
&lt;myles> astearns: proposal: format(&lt;string> [supports &lt;custom-ident>#]?)<br>
&lt;dael> astearns: We have a proposed syntax. Anything more to change/fix or shall we resolve?<br>
&lt;TabAtkins> (It's not gonna be &lt;custom-ident> now.)<br>
&lt;dael> TabAtkins: Custom-ident can be a normal grammar thing.<br>
&lt;dael> ChrisL: So we give an explicit list and if we extend in the future that's fine.<br>
&lt;dael> fantasai: Yes.<br>
&lt;Joel> Btw we think a @supports for color fonts will be needed, especially at the beginning. ie: If you want to use a color font only if it's supported and style it differently.<br>
&lt;dael> astearns: Objections to format(&lt;string> [supports (list from spec)#]?)<br>
&lt;astearns> Joel: that's what we just resolved on<br>
&lt;dael> RESOLVED: use this: format(&lt;string> [supports (list from spec)#]?)<br>
&lt;fantasai> format(&lt;string> [supports &lt;feature-name>#]?)<br>
&lt;Joel> Great!<br>
&lt;fantasai> where &lt;feature-name> is a keyword<br>
&lt;dael> astearns: Someone on irc mentioned @support for color fonts will be needed. Do we have an @support?<br>
&lt;astearns> Joel: sorry, I was wrong. we'll still need to figure it out<br>
&lt;Joel> Ok :)<br>
&lt;astearns> we'll file an issue<br>
&lt;dael> myles: No.I think that should be an issue and we should discuss it.<br>
&lt;dael> fantasai: For @supports you can use the same function as is here.<br>
&lt;dael> myles: WE should do use case research<br>
</details>


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

Received on Wednesday, 11 April 2018 14:20:06 UTC