Re: [csswg-drafts] [css-fonts] Reduce layout shift via @font-face descriptor(s) overriding inline spacing (#5533)

The CSS Working Group just discussed `Reduce layout shift via @font-face descriptor(s) overriding inline spacing`.

<details><summary>The full IRC log of that discussion</summary>
&lt;gregwhitworth> Topic: Reduce layout shift via @font-face descriptor(s) overriding inline spacing<br>
&lt;chris> github: https://github.com/w3c/csswg-drafts/issues/5533<br>
&lt;gregwhitworth> xiaochengh: we'd like to introduce a new descriptor called advance-override<br>
&lt;gregwhitworth> xiaochengh: it's to multiply the advance-width<br>
&lt;gregwhitworth> xiaochengh: the intent is to use it to reduce layout shift when switching between fallback and webfonts<br>
&lt;gregwhitworth> xiaochengh: it's intended to wrap a fallback font with wrapper to use advanced-override<br>
&lt;gregwhitworth> xiaochengh: this is in the same group with ascent-override and line-gap override<br>
&lt;gregwhitworth> xiaochengh: there are some considerations with this proposal<br>
&lt;chris> advance width described here https://www.w3.org/TR/css-values-3/#ch<br>
&lt;gregwhitworth> xiaochengh: the first one is whether to use a property or a descriptor<br>
&lt;gregwhitworth> xiaochengh: our consideration is to make things easy to implement and we've confirmed as we've done this behind a flag in Chrome<br>
&lt;gregwhitworth> xiaochengh: we want to make it easy for web authors to use it too<br>
&lt;fantasai> +1 to making it a descriptor and not a property<br>
&lt;gregwhitworth> xiaochengh: a web font provider can provide these in a stylesheet they provide to authors<br>
&lt;gregwhitworth> xiaochengh: so we think our proposal achieves all of the goals<br>
&lt;gregwhitworth> xiaochengh: font-display cannot really reduce layout shift<br>
&lt;chris> q+ to note that advance-width should be advance measure (it is a width for horizontal writing)<br>
&lt;gregwhitworth> xiaochengh: the third issue is typography, when we use such override descriptors we expect the legibility of the fallback font to be worsened<br>
&lt;gregwhitworth> xiaochengh: we don't think this is unacceptable as it only occurs when a web font fails to load<br>
&lt;gregwhitworth> xiaochengh: if the actual fallback font gets unusable means that the fallback font and web font differ too much<br>
&lt;gregwhitworth> xiaochengh: there is a similarity between this and letter spacing but they're different things<br>
&lt;gregwhitworth> xiaochengh: this is working with the width of the glyphs themselves, so letter-spacing doesn't apply<br>
&lt;gregwhitworth> xiaochengh: also happy for name feedback<br>
&lt;astearns> ack chris<br>
&lt;Zakim> chris, you wanted to note that advance-width should be advance measure (it is a width for horizontal writing)<br>
&lt;gregwhitworth> chris: minor point<br>
&lt;gregwhitworth> chris: advanced-width is correct for horizontal writing<br>
&lt;gregwhitworth> chris: in the units spec, the advance-measure it can be vertical and horizontal<br>
&lt;gregwhitworth> fantasai: the problem with that is you may want different numbers with width and height<br>
&lt;chris> advance measure described here https://www.w3.org/TR/css-values-3/#ch<br>
&lt;gregwhitworth> fantasai: you may not want the same adjustments in both directions<br>
&lt;drott> q+<br>
&lt;gregwhitworth> fantasai: if you're typesetting correctly you'll need to ensure you're talking about width or height<br>
&lt;myles> q+<br>
&lt;gregwhitworth> chris: I agree with fantasai<br>
&lt;gregwhitworth> xiaochengh: this is just for the horizontal width<br>
&lt;astearns> ack fantasai<br>
&lt;gregwhitworth> xiaochengh: we're using others for vertical for ascent and descent<br>
&lt;gregwhitworth> fantasai: I don't think you understood my point as this doesn't have to do with ascent &amp; descent<br>
&lt;gregwhitworth> fantasai: depending on how you're typesetting you'll need a different number vertically or horizontally<br>
&lt;fantasai> When typesetting horizontally or vertically sideways, need the same number<br>
&lt;gregwhitworth> xiaochengh: for the same font, when it's used horizontally &amp; vertically<br>
&lt;gregwhitworth> florian: for upright fonts you should probably have two numbers<br>
&lt;fantasai> but for vertical writing typeset upright, you will want a different number<br>
&lt;gregwhitworth> florian: for that particular problem you should take 2 numbers and the second is optional<br>
&lt;astearns> ack drott<br>
&lt;fantasai> because that's the height of the glyph you're measuring, not the width of it<br>
&lt;gregwhitworth> Domenic: is that required for the specificity of src local for wrapping a web font?<br>
&lt;gregwhitworth> fantasai: imagine two fonts Verdana and Times Roman and imagine they look a bit more similar<br>
&lt;gregwhitworth> fantasai: you'll notice that Times is very narrow but they're very close in height<br>
&lt;gregwhitworth> fantasai: so if you're vertically setting then you're fine<br>
&lt;gregwhitworth> Domenic: I was thinking more CJK<br>
&lt;gregwhitworth> fantasai: if I'm typesetting vertically (eg: I rotate it) then I'll need to typeset it<br>
&lt;astearns> ack myles<br>
&lt;gregwhitworth> florian: also the same font may be used in different directions in the same document<br>
&lt;gregwhitworth> myles: we've gotten a similar request for similar features that we should be thinking about<br>
&lt;gregwhitworth> myles: we're thinking about this in the time of loading to ensure that the fallback looks like the webfont<br>
&lt;gregwhitworth> myles: we've looked at this for when a font doesn't support glyphs that the page is asking for and we want to ensure that the fonts look alike<br>
&lt;chris> The next topic https://github.com/w3c/csswg-drafts/issues/126<br>
&lt;fantasai> s/need to typeset it/need a different multiplier<br>
&lt;gregwhitworth> myles: doing this requires more than just the advance of the font<br>
&lt;gregwhitworth> myles: I think it would be good to solve both of these at the same time with the same feature<br>
&lt;gregwhitworth> astearns: I agree they're similar<br>
&lt;gregwhitworth> astearns: matching the fallback with the webfont you don't know which font will match that font<br>
&lt;gregwhitworth> myles: yes each person that has asked for this is willing to spend the time to craft their page to get as close as possible<br>
&lt;florian> q+<br>
&lt;myles> https://github.com/w3c/csswg-drafts/issues/126#issuecomment-245708960<br>
&lt;fantasai> s/page/@font-face rules with local/<br>
&lt;astearns> ack florian<br>
&lt;drott> florian, https://www.fauxfoundry.com/?<br>
&lt;chris> q+<br>
&lt;gregwhitworth> florian: reminds me of a project a while back, something like full greek but you were trying to match the style of greek font even if you only had latin fonts but they used variable fonts to adjust that. Not sure how we apply that idea to this use case<br>
&lt;jfkthame> q+<br>
&lt;gregwhitworth> florian: rather than just changing widths<br>
&lt;astearns> ack chris<br>
&lt;gregwhitworth> chris: yeah, the difference between that and they're changing the glyph outlines to produce a parametized fonts, this proposal is not changing glyphs at all just ensuring the spacing is correct<br>
&lt;gregwhitworth> fantasai: this won't work for cursive then<br>
&lt;astearns> ack jfkthame<br>
&lt;gregwhitworth> chris: I agree, won't work for Mongolian and Arabic<br>
&lt;gregwhitworth> jonathan: Seems like what panos was trying to do what Myles was wanting to do<br>
&lt;gregwhitworth> jonathan: when fallback happens based on meta attributes it can search for fallback that looks for attributes of the web font<br>
&lt;chris> https://www.w3.org/Fonts/Panose/pan2.html<br>
&lt;gregwhitworth> jonathan: that's rather different than using a fallback as a given font and behave as much like a particular font<br>
&lt;gregwhitworth> myles: yes, what you said is correct<br>
&lt;florian> [The project I mentioned earlier is https://www.fauxfoundry.com/ ]<br>
&lt;gregwhitworth> myles: the requests we've gotten is not trying to add serifs, like the example florian gave, but the examples are trying to adjust letter-spacing, font-weight (5 props) in the fallback font. And if you're going to use the fallback then bump up the weight<br>
&lt;myles> font-weight<br>
&lt;myles> font-size<br>
&lt;myles> letter-spacing<br>
&lt;myles> word-spacing<br>
&lt;myles> line-height<br>
&lt;chris> Faux Greek foundry https://www.fauxfoundry.com/<br>
&lt;gregwhitworth> myles: the direction I was going there, one possible way - we should solve this problem in multiple ways. We can have a descriptor or we can extend the properties to be fallback aware<br>
&lt;leaverou> q+ to say this is starting to sound a lot like the next topic and maybe they should be discussed together?<br>
&lt;gregwhitworth> fantasai: I think using font-face is way better given you're describing the font<br>
&lt;gregwhitworth> jonathan: very much agree with fantasai on that<br>
&lt;chris> by Irene Vlachou &amp; Laurence Penney<br>
&lt;fantasai> s/font-face/font-face to tie values to particular font faces/<br>
&lt;gregwhitworth> myles: I'm surprised to hear it although I understand it partly<br>
&lt;gregwhitworth> myles: the benefit of the properties is that you get selectors<br>
&lt;gregwhitworth> florian: why would you want to select against the element and not the font<br>
&lt;gregwhitworth> myles: only request is to consider them both<br>
&lt;gregwhitworth> leaverou: I'm hearing a lot of items from the next issue<br>
&lt;drott> q+<br>
&lt;gregwhitworth> astearns: I'm thinking of "Yes we should solve this but let's solve all the issues together"<br>
&lt;astearns> ack leaverou<br>
&lt;Zakim> leaverou, you wanted to say this is starting to sound a lot like the next topic and maybe they should be discussed together?<br>
&lt;astearns> ack drott<br>
&lt;gregwhitworth> drott: in solving this - do we want to distinguish between another font or what's available locally<br>
&lt;gregwhitworth> drott: that's a fast fallback solution or we load a foundry for variable fonts used for fallback that's completely different<br>
&lt;gregwhitworth> drott: and it would be required for load<br>
&lt;gregwhitworth> astearns: I'd want 1 way to define the override<br>
&lt;gregwhitworth> drott: there are two use cases, the more flexible way is a bit wider in scope.<br>
&lt;gregwhitworth> fantasai: so they're cursive, you can't letter space them so how do you ensure they're rendered properly if an author sets this<br>
&lt;gregwhitworth> myles: would it be the same as the scenario when you use letter-spacing<br>
&lt;gregwhitworth> myles: we have a request to ignore letter-spacing when an Arabic font is used<br>
&lt;drott> q+<br>
&lt;fantasai> fantasai: that's in the spec<br>
&lt;chris> Some arabic fonts do have a spacing axis (variable fonts again)<br>
&lt;gregwhitworth> fantasai: that's what we define already for letter-spacing<br>
&lt;gregwhitworth> xiaochengh: we tried it on Arabic and we see the width of the characters change and the shaping doesn't look bad<br>
&lt;TabAtkins> Lol, Chrome *does* apply letter-spacing to Arabic currently, it just... puts space between teh characters.<br>
&lt;TabAtkins> They're still shaped properly for their place in the word.<br>
&lt;florian> q+<br>
&lt;TabAtkins> Like kashida-ing without the kashida<br>
&lt;chrishtr> q+<br>
&lt;TabAtkins> http://software.hixie.ch/utilities/js/live-dom-viewer/saved/8903<br>
&lt;gregwhitworth> fantasai: I don't think you used a large enough value, in order to avoid rendering at joins they have a small amount of overlap built in<br>
&lt;florian> q-<br>
&lt;gregwhitworth> fantasai: so to see if it is working or not you'd need a larger range than that tolerance<br>
&lt;gregwhitworth> drott: a little bit of adjustment doesn't break them apart<br>
&lt;drott> q-<br>
&lt;gregwhitworth> chrishtr: if letter-spacing then it seems logical to do the same with this descriptor<br>
&lt;chris> q+<br>
&lt;astearns> ack chrishtr<br>
&lt;gregwhitworth> chrishtr: the other thought I had was the only other concern would be to apply a different override in each direction<br>
&lt;fantasai> s/direction/axis<br>
&lt;gregwhitworth> astearns: that was brought up earlier you'll need one for inline and block<br>
&lt;gregwhitworth> TabAtkins: no it's inline in both times, just depends on the writing mode<br>
&lt;gregwhitworth> fantasai: it will be width/height to the font<br>
&lt;astearns> ack chris<br>
&lt;myles> https://en.wikipedia.org/wiki/Kashida<br>
&lt;gregwhitworth> chris: it's not true to say that those scripts don't have letter-spacing it's that you need to use them to use a longer connection but most fonts don't do that<br>
&lt;gregwhitworth> fantasai: it's more complicated than that<br>
&lt;gregwhitworth> fantasai: we would say that you don't do this for Mongolian or Arabic and some fonts may do it but most won't<br>
&lt;fantasai> s/would//<br>
&lt;chris> Arabic text alignment &amp; justification https://www.w3.org/TR/alreq/#h_justification<br>
&lt;fantasai> This is specced in css-text-3<br>
&lt;gregwhitworth> astearns: I think we should close off with a general yes, we want to have this advance-override but move to the next issue about how to define it<br>
&lt;gregwhitworth> myles: is it going to be a length?<br>
&lt;gregwhitworth> xiaochengh: it's a percentage<br>
&lt;gregwhitworth> chris: it's a multiplier<br>
&lt;gregwhitworth> TabAtkins: it's going to be the best overall solution that works the most consistently<br>
</details>


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


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

Received on Tuesday, 9 February 2021 15:43:07 UTC