You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[css-text] [css-values] Circular dependency between letter-spacing and x-height #5498
When the effective spacing between two characters is not zero (due to either justification or a non-zero value of letter-spacing), user agents should not apply optional ligatures
letter-spacing takes a <length>, which means that it accepts font-relative units, like 2ex for example. Some (all?) browsers can measure the ex length by actually rendering a literal "x" character and inspecting its height (at least in the case where the metrics inside the font appear to be bogus). However, the liga font feature can change which glyph the "x" character renders with, so if we're supposed to not apply optional ligatures, the height of the "x" character can change depending on whether we're disabling ligatures or not. This means that, if someone applies letter-spacing on an element with ex units, we may have to measure a glyph, but in order to know which glyph to measure, we have to know whether that glyph has a height of 0 or not.
It's a weird fiddly corner case that probably wouldn't ever make a difference in real content, but it's probably worth at least considering how to fix it.
Note: Allowing letter-spacing to accept font-relative units is useful. Also, disabling ligatures when letter-spacing is nonzero is also required for good typography. Whatever solution we pick shouldn't break either of these things.
changed the title [-][css-text] Circular dependency between letter-spacing and x-height[/-][+][css-text] [css-values] Circular dependency between letter-spacing and x-height[/+]on Sep 4, 2020
The best solution is probably "don't run shaping when calculating the value of font-relative units."
Definitely. I would think "liga" is the least of your problems - salt, swsh, smcp and others would have a much bigger impact on units if they were applied, and some of the substitutions could be language dependent too. The metrics really have to be taken from the original glyph as specified by the glyf or CFF tables.
The spec doesn't define exactly how to find the value of an 'ex' from the font, leaves that up to the UA with some pointers. So I don't think there's anything to fix here wrt the specs? https://www.w3.org/TR/css-values-3/#ex
Activity
litherum commentedon Sep 4, 2020
Note: Allowing
letter-spacingto accept font-relative units is useful. Also, disabling ligatures when letter-spacing is nonzero is also required for good typography. Whatever solution we pick shouldn't break either of these things.litherum commentedon Sep 4, 2020
The best solution is probably "don't run shaping when calculating the value of font-relative units."
[-][css-text] Circular dependency between letter-spacing and x-height[/-][+][css-text] [css-values] Circular dependency between letter-spacing and x-height[/+]litherum commentedon Sep 4, 2020
... and the
chandicunits should be calculated withoutletter-spacingapplied (which I think is already the case).faceless2 commentedon Sep 4, 2020
Definitely. I would think "liga" is the least of your problems -
salt,swsh,smcpand others would have a much bigger impact on units if they were applied, and some of the substitutions could be language dependent too. The metrics really have to be taken from the original glyph as specified by theglyforCFFtables.emilio commentedon Sep 6, 2020
cc @jfkthame
fantasai commentedon Sep 9, 2020
The spec doesn't define exactly how to find the value of an 'ex' from the font, leaves that up to the UA with some pointers. So I don't think there's anything to fix here wrt the specs? https://www.w3.org/TR/css-values-3/#ex
frivoal commentedon Sep 14, 2020
Right, we could arguably be more precise, but given the current lack of precision, no circular dependency seem mandated.
fantasai commentedon Sep 29, 2020
@litherum Shall I close this no change, or is there some change to the spec you want to see here?
litherum commentedon Jan 21, 2021
Can we add a note?
[ic-unit] Add |IdeographicFullWidth|
[css-values-3][css-values-4] Clarify that font-relative lengths are m…
fantasai commentedon Oct 12, 2022
@litherum @kojiishi Added
Let me know if you would like some different phrasing.