Re: [csswg-drafts] [css-fonts] Unknown fragment identifiers in @font-face src:

The Working Group just discussed `Unknown URL Fragment IDs in @font-face`, and agreed to the following:

* `RESOLVED: if you have a fragID in @font-face src, and you don't`
* `RESOLVED: If fragID is valid, but not found in the resource, skip as if couldn't load resource`
* `RESOLVED: Add format() signifier for font collections, similar to variations`

<details><summary>The full IRC log of that discussion</summary>
&lt;fantasai> Topic: Unknown URL Fragment IDs in @font-face<br>
&lt;fantasai> myles: You can have a font collection file, has several fonts in it<br>
&lt;astearns> github: https://github.com/w3c/csswg-drafts/issues/2566<br>
&lt;fantasai> myles: Individual fonts are identified with fragID<br>
&lt;fantasai> myles: If that name of the font doesn't exist in the file, what do we do?<br>
&lt;fantasai> myles: One is we throw out the whole URL, the whole URL is invalid<br>
&lt;fantasai> myles: The image() function does this<br>
&lt;fantasai> myles: Alternately, throw out just the fragID, use the URL as if it didn't have one<br>
&lt;fantasai> myles: Ends up pointing at first item in the collection<br>
&lt;fantasai> myles: In that case, if you click on document navigation to a missing fragID, you go to the top<br>
&lt;fantasai> myles: So we have precedent for both behaviors<br>
&lt;fantasai> myles: Today for browsers that don't understand, they will just use the first item in the collection<br>
&lt;fantasai> myles: regardless of fragID<br>
&lt;fantasai> myles: So already some places where we have this behavior<br>
&lt;fantasai> florian: Thing you mentioned last, in terms of what browsers do<br>
&lt;fantasai> florian: when they don't support this<br>
&lt;fantasai> florian: hints at consistency with that<br>
&lt;fantasai> florian: Won't have browser showing different fonts for non-obvious reasons<br>
&lt;fantasai> fantasai: But you'll have that already if fragID is valid<br>
&lt;fantasai> myles: If fragID is valid, new browsers will show ID's font, old browsers will show first font<br>
&lt;fantasai> myles: if fragID is invalid, then one of the options will make the new browsers have same behavior has same behavior<br>
&lt;fantasai> dbaron: One thing to think about is how similar are the fonts in the collection?<br>
&lt;fantasai> dbaron: If they're likely to be similar, then falling back to another font in the collection seems reasonable<br>
&lt;fantasai> florian: Especially browsers can be consistent with older browsers<br>
&lt;Rossen_> fantasai: concenred about the what if there'/s fragment id format that doesn't understand if it's useful as the next thing of the list?<br>
&lt;Rossen_> Say a frag id in a collection that it's not in the system, and the browser can't load it sisnce it doesn't understand it forx ex, an open type... can it fall down the list further<br>
&lt;Rossen_> florian: if the browser understands the syntax it would be good to fall back but if it doesn't..?<br>
&lt;fantasai> florian: Can we do both? If the format of the fragID is invalid, it treats as invalid, but if the fragID is missing then it loads and tries to find it and falls back to first font or whatever it can do<br>
&lt;fantasai> TabAtkins: What Florian said, about falling back to first font, that's very specific to collections<br>
&lt;fantasai> TabAtkins: It's not a behavior we can bake into general behavior for fragIDs<br>
&lt;fantasai> myles: Yeah, platform has different behaviors<br>
&lt;fantasai> TabAtkins: There's a different consideration for fragID you understand but can't find, and fragID you don't understand.<br>
&lt;fantasai> myles: These fragIDs are names, they're just strings<br>
&lt;fantasai> TabAtkins: That's assuming fragID sntax for truetype collections is the only format that will exist<br>
&lt;fantasai> myles: Two collection formats, both have this syntax<br>
&lt;fantasai> astearns: I thought we'd already established that browser that don't understand fragment syntax will use the URL as if it wasn't there<br>
&lt;fantasai> TabAtkins: We didn't establish that, it's just the current behavior of browsers<br>
&lt;Rossen_> q?<br>
&lt;fantasai> astearns: Any other comments?<br>
&lt;fantasai> florian: Can we distinguish?<br>
&lt;fantasai> florian: For collections is *any* string accepted, regardless of syntax e.g. parens and stuff included?<br>
&lt;fantasai> myles: Any string<br>
&lt;astearns> ack liam<br>
&lt;Zakim> liam, you wanted to ask about fallback when the vf is used in multiple @font-face rules (bold, italic) when it understands the 1st font<br>
&lt;fantasai> liam: Reason to use collections is to save bandwidth<br>
&lt;fantasai> liam: Can use it in a dozen different @font-face rules<br>
&lt;fantasai> liam: Need it to be first in your src list, can't save bandwidth if browser loads other things first<br>
&lt;TabAtkins> Per https://tools.ietf.org/html/rfc8081#section-4.2 the fragment is *not* an arbitrary string, it does a useful subsetting of "name-like" syntax, explicitly excluding things that might be functions/etc<br>
&lt;fantasai> liam: If bold-italic is first and regular is second<br>
&lt;fantasai> liam: It means your whole page will be bold-italic if you didn't understand the fragID<br>
&lt;fantasai> liam: and that's very unlikely to be acceptable<br>
&lt;TabAtkins> So `font.ttf#foo(bar)` is *not* a valid way to select a font from a collection. It's an unknown fragment.<br>
&lt;fantasai> liam: Seems no way to do fallback here, have the browser only download the object when you want it to<br>
&lt;fantasai> liam: You should ignore the font if you don't understand the fragID syntax<br>
&lt;fantasai> myles: So in today's browser, that's what would occur<br>
&lt;fantasai> myles: In new browsers you get good behavior, old browsers you get the bad behavior<br>
&lt;liam> [right]<br>
&lt;fantasai> florian: Do we have any data on whether this syntax is used?<br>
&lt;myles> q?<br>
&lt;fantasai> myles: It's not supported in browsers, who would use it?<br>
&lt;fantasai> florian: If an author is accidentally using fragID, expecting it to not work<br>
&lt;fantasai> myles: Don't have any data on that<br>
&lt;fantasai> liam: If font collections had a different font format that you could use in the font-face rule<br>
&lt;fantasai> liam: and browsers that didn't understand them would skip them, that would solve the font fallback problem<br>
&lt;fantasai> myles: In Berlin we specced a new format identifier syntax<br>
&lt;fantasai> myles: we could add a new keyword for these<br>
&lt;florian> myles, that sounds like a good idea.<br>
&lt;fantasai> myles: We can use the pre-existing resolutionto extend the format function to support collections<br>
&lt;fantasai> myles: Different issue, but would allow for correct fallback behavior that you've described<br>
&lt;fantasai> astearns: That sounds like a good idea.<br>
&lt;fantasai> astearns: If you support collections, use this one.<br>
&lt;fantasai> astearns: In browsers that don't support collections, whole bit would be thrown out<br>
&lt;fantasai> myles: So, we extend format() function to indicate collections<br>
&lt;fantasai> myles: and then fallback to first font if fragID is not found<br>
&lt;Rossen_> fantasai: given we don't need to worry about consistency between existing supported browsers and those who don't support it,<br>
&lt;Rossen_> it seem better if instead of picking the first font we fallback to the next one like the image()<br>
&lt;Rossen_> picking the first one makes it easier for the authors to notice the err<br>
&lt;TabAtkins> q+<br>
&lt;fantasai> myles: But that's opposite of what liam said, he said it'd be really obvious<br>
&lt;fantasai> fantasai: But if Medium loaded instead of Book, you're unlikely to notice<br>
&lt;fantasai> dbaron: ...<br>
&lt;fantasai> TabAtkins: Concern it's not just about collections<br>
&lt;dbaron> s/.../seems like this might manifest as an issue of the form "bold and italic don't work"/<br>
&lt;fantasai> TabAtkins: But fragIDs in general<br>
&lt;dbaron> myles (before Tab): you'd get synthetic bold/italic<br>
&lt;fantasai> TabAtkins: There *are* limitations on what you can use as a name<br>
&lt;fantasai> TabAtkins: E.g. functional notation is reserved for potential future use<br>
&lt;fantasai> TabAtkins: Today we would load something using such a future syntax by loading the first font<br>
&lt;fantasai> TabAtkins: That's not good<br>
&lt;TabAtkins> Repeating from earlier: So `font.ttf#foo(bar)` is *not* a valid way to select a font from a collection. It's an unknown fragment.<br>
&lt;fantasai> fantasai: I agree ith Tab<br>
&lt;fantasai> florian: I would like to agree with Tab, but if on the font format side the fragID can be any string but on our side it's more restrited, isn't that a problem?<br>
&lt;fantasai> TabAtkins: The standard for this excludes fragments like #foo(bar)<br>
&lt;fantasai> TabAtkins: Allowed syntax is things that look like names<br>
&lt;fantasai> florian: OK, then I agree with you<br>
&lt;fantasai> TabAtkins: RFC8081<br>
&lt;fantasai> TabAtkins: https://tools.ietf.org/html/rfc8081#section-4.2<br>
&lt;fantasai> astearns: Getting to half an hour<br>
&lt;fantasai> astearns: Should at least spec the collections into format()<br>
&lt;fantasai> astearns: And maybe come back to it?<br>
&lt;fantasai> myles: More important to have resolution than on a particular resolution, so happy to do the ignore unknown/unfound URLs<br>
&lt;fantasai> astearns: For cases where browser understands fragment and can't find it, browser goes to next in the list?<br>
&lt;fantasai> astearns: Or browser doesn't understand fragID, skips downloading<br>
&lt;fantasai> fantasai summarizes<br>
&lt;fantasai> astearns: So, if you have a fragID in @font-face src, and you don't understand the fragID syntax, you don't download the font.<br>
&lt;liam> +1<br>
&lt;fantasai> RESOLVED: if you have a fragID in @font-face src, and you don't<br>
&lt;fantasai>                   understand the fragID syntax, you don't download the font.<br>
&lt;fantasai> astearns: If you do understand the fragID, we will download the font, and if ID'd thing not found, move on to next one (as if couldn't load)<br>
&lt;fantasai> RESOLVED: If fragID is valid, but not found in the resource, skip as if couldn't load resource<br>
&lt;fantasai> astearns: Add format() signifier for collections, similar to variations<br>
&lt;fantasai> RESOLVED: Add format() signifier for font collections, similar to variations<br>
&lt;fantasai> github: https://github.com/w3c/csswg-drafts/issues/2566<br>
&lt;myles> github: https://github.com/w3c/csswg-drafts/issues/520<br>
&lt;fantasai> github: https://github.com/w3c/csswg-drafts/issues/2566<br>
</details>


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

Received on Wednesday, 9 May 2018 16:32:14 UTC