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
Thank you! I'd love to add letter-spacing support. I think it's simple: walk the glyph array and increase advances at the end of each unicode grapheme:
I did more reading and thinking on this. It's harder than I thought because the spacing has to be applied after bidi reordering. But letter-spacing also needs to be followed when measuring text for fit. If bidi text splits an inline, the common ancestor's letter-spacing is used. It sounds like I'm supposed to do a simple test of "will this split an inline", rather than trying to calculate the "hypothetical" bidi order.
Currently, none of the major browsers do this correctly: test.
LineWidthTracker, ShapedItem.measure, and createLineboxes all need to be updated to have letter spacing state. Those use logical order, but the total number of spaces will be the same as the after-bidi letter spacing. Also ShapedShim will need to gain an advance property since inline-blocks and <img> in the future also get spaces after them through letter-spacing.
FWIW, it sounds like 'continuing with browser implementations' has won, with possible flags for the future alternate implementation. So just adding to the advance width, like most browsers, would be useful and meet expectations.
It's too bad there's been no movement on w3c/csswg-drafts#10193. Going with current browser behavior is fine, as long as the advance goes on the left side for RTL text, the way Firefox does. Some of the proposals in that issue sound way better than what browsers are doing, but it's probably best to wait until that gets resolved.
I'd still like to get the BIDI test to work in dropflow even though browsers don't do that either.
Activity
chearon commentedon Mar 22, 2024
Thank you! I'd love to add
letter-spacingsupport. I think it's simple: walk the glyph array and increase advances at the end of each unicode grapheme:— CSS Text §7.2
chearon commentedon Mar 23, 2024
I did more reading and thinking on this. It's harder than I thought because the spacing has to be applied after bidi reordering. But
letter-spacingalso needs to be followed when measuring text for fit. If bidi text splits an inline, the common ancestor's letter-spacing is used. It sounds like I'm supposed to do a simple test of "will this split an inline", rather than trying to calculate the "hypothetical" bidi order.Currently, none of the major browsers do this correctly: test.
LineWidthTracker,ShapedItem.measure, andcreateLineboxesall need to be updated to have letter spacing state. Those use logical order, but the total number of spaces will be the same as the after-bidi letter spacing. AlsoShapedShimwill need to gain anadvanceproperty sinceinline-blocks and<img>in the future also get spaces after them throughletter-spacing.add letter-spacing to readme
chearon commentedon Mar 13, 2025
Further reading: w3c/csswg-drafts#10193
BobPritchett commentedon Jul 1, 2025
FWIW, it sounds like 'continuing with browser implementations' has won, with possible flags for the future alternate implementation. So just adding to the advance width, like most browsers, would be useful and meet expectations.
chearon commentedon Jul 4, 2025
It's too bad there's been no movement on w3c/csswg-drafts#10193. Going with current browser behavior is fine, as long as the advance goes on the left side for RTL text, the way Firefox does. Some of the proposals in that issue sound way better than what browsers are doing, but it's probably best to wait until that gets resolved.
I'd still like to get the BIDI test to work in dropflow even though browsers don't do that either.