w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.43k stars 655 forks source link

[css-inline-3] kerning of initial letter when initial letter has negative side bearing #5476

Open dauwhe opened 4 years ago

dauwhe commented 4 years ago

https://drafts.csswg.org/css-inline/#initial-letter-inline-position

If the initial letter is a non-atomic inline with an automatic inline size and zero padding and borders, its margin box is kerned (negatively inset) by the distance from the start edge of its content box to the point in the content that would have been placed at the start edge of the line box if it were not an initial letter (i.e. the distance between its glyph bounding box and its start side bearing). This inset is effectively an additional inline-start margin on the box.

So the start side bearing can be either positive or negative. In Adobe Caslon Pro, the capital "V" has positive start side bearing—the left edge of the glyph bounding box is is at +22. So I presume we would move the initial-letter box left by that amount so the start edge of the glyph bounding box coincides with the start edge of the containing block.

But the capital "Y" in the same font has negative start side bearing (-15). Would we then move the initial-letter box to the right?

Screen Shot 2020-08-26 at 3 54 46 PM
fantasai commented 4 years ago

Yes. Although seems what it probably ought to use is the opbd feature (if it exists) . The intention is to typeset the initial letter at the same position it would be if it were regular inline text. That's probably how we should describe it in the spec...

fantasai commented 4 years ago

Although I do wonder if that really makes the most sense. Maybe it should just be flush...

dauwhe commented 4 years ago

+1 to opdb. If that is absent, my instinct is that we should kern for positive side-bearing (as currently described in the spec) but leave negative side-bearing alone, for better optical alignment. But I am far from an expert here...