w3c / csswg-drafts

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

[css-fonts-4] font kerning in vertical text #5295

Open r12a opened 4 years ago

r12a commented 4 years ago

6.3. Kerning: the font-kerning property https://drafts.csswg.org/css-fonts-4/#font-kerning-prop

When kerning is enabled, the OpenType kern feature is enabled (for vertical text runs the vkrn feature is enabled instead).

I'm guessing that the vkrn feature is only applied to upright characters in a line of vertically-set text, whereas Latin text (say) that runs down the line on its side is not affected. Is this taken care of by the font only having vkrn settings for upright characters in vertical lines, or do we have an issue here?

svgeesus commented 4 years ago

On reflection this text (which was also in CSS Fonts 3) is too brief:

When kerning is enabled, the OpenType kern feature is enabled (for vertical text runs the vkrn feature is enabled instead).

how about

When kerning is enabled, the relevant OpenType kerning features are enabled (for upright,horizontally set characters and for rotated, vertically set characters, the kern feature; for upright, vertically set characters, the vkrn feature. ).

followed by three examples - one of horizontally set text, one of vertically set text with all characters upright, and one of vertically set text with some characters rotated. I'm imagining color-coded backgrounds behind each glyph, for kern and vkern. That would also show (which should be obvious, but still) that a change between upright and rotated breaks kerning.

fantasai commented 4 years ago

You probably want to hook into https://www.w3.org/TR/css-writing-modes-4/#vertical-font-features

So

When kerning is enabled, the relevant OpenType kerning features are enabled (for horizontal [=typographic modes=] and for [=sideways typesetting=] in vertical [=typographic modes=], the kern feature; for [=upright typesetting=] in [=vertical typographic modes=], the vkrn feature.

And then I should be sure to export those terms from Writing Modes. :)

fantasai commented 4 years ago

OK, exported. @svgeesus You might want to edit-in-place the resulting markup into the /TR versions of these specs? Then the cross-refs will work when you publish css-fonts-4 to /TR as well.

svgeesus commented 4 years ago

@fantasai I was going to suggest republishing Writing Modes 4, as it has been a year, but apparently there is only one change since then?

svgeesus commented 4 years ago

@r12a you can see the altered text now; could you confirm whether this solves the issue or whether more changes are needed.

svgeesus commented 4 years ago

@fantasai I am now confused; upright typesetting and sideways typesetting and typographic mode all work in the 2019 CR. In terms of generated markup, what did https://github.com/w3c/csswg-drafts/commit/6c54cd31d4b67cd9399cc7b849ca3db93d3c29d6 add?

r12a commented 4 years ago

@r12a you can see the altered text now; could you confirm whether this solves the issue or whether more changes are needed.

Better, yes, thanks. However, it occurred to me while reading that tate-chu-yoko text is also upright in vertical lines, but should used kern rather than vkrn. Do you think we need to clarify that?

svgeesus commented 4 years ago

Definitely, and that needs another example. What spec should we link to, to explain that one?

By the way this example is not rendering correctly for me in Firefox or Chrome on Windows 10. Have not tried Safari yet. The test results led me to expect this would work.

litherum commented 4 years ago

I wish the spec could have affordances for TrueType in addition to OpenType. Specifically calling out kern and vkrn is probably fine, but there are other font technologies which are relevant too.

svgeesus commented 4 years ago

It does mention TrueType kern tables in addition to the OpenType kern and vkrn features

svgeesus commented 3 years ago

@fantasai I was going to suggest republishing Writing Modes 4, as it has been a year, but apparently there is only one change since then?

Ah, its that the changes is not up to date. The History shows 25 commits

svgeesus commented 3 years ago

@r12a I'd like to work with you to get good examples of kerning (and non-kerning) in both horizontal, vertical, and horizontal-in-vertical text. One problem is that ideographic text typically doesn't use kerning.

https://www.w3.org/International/articles/vertical-text/ doesn't have examples of kerning in vertical contexts. Do you have examples from other articles, or do new examples need to be created and verified?

r12a commented 3 years ago

@svgeesus do you have Ken Lunde's book CJKV Information Processing. You may find pp. 360 – 365 useful?

svgeesus commented 3 years ago

Yes, but in Boston :(

myakura commented 3 years ago

https://github.com/w3c/csswg-drafts/issues/5295#issuecomment-656250846

By the way this example is not rendering correctly for me in Firefox or Chrome on Windows 10. Have not tried Safari yet. The test results led me to expect this would work.

The digits value is only implemented in Trident (under the name -ms-text-combine-horizontal). The one works across browsers is text-combine-upright: all.