w3c / csswg-drafts

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

[css-text] Ignore Variation Selectors #2166

Open Crissov opened 6 years ago

Crissov commented 6 years ago

In #1144 I proposed a property to remove, add or override Unicode Variation Selectors (‘VS’, chiefly U+FE0x) from/to all applicable characters. The main use case presented was consistent presentation of possible emoji characters by enforcing either VS-15 or VS-16. The WG decided against adding an override keyword to the font-presentation property. I am now proposing text-transform-variant again, but limited to stripping (e.g. ignore, or keeping: auto or none) all VSs.

Variation selectors by definition do not change the semantics of the character varied. While emoji variation sequences usually come in pairs, others only document one specific variant, e.g. a slashed digit zero vs. the default design, which may depend on the font features set (OT zero, CSS font-variant-numeric: slashed-zero). Most variation sequences come in groups that are using VSs (usually VS-1 and VS-2) in a consistent way (but math symbols hardly do), e.g. Myanmar characters may be switched to a dotted form. This means variation sequences are close to or even crossing the border between character encoding and typography, hence design. They thus become in scope of CSS.

Changing the variant can usually be considered less consequential than changing letter case. It is also much more simple to implement because it only involves dropping certain Unicode Code points. Font selection should not be affected for non-emoji sequences, because it is always expected that only the base glyph without variation may be displayed. (Some emoji fonts only contain colorful glyphs which in many cases are only appropriate if VS-16 was present; e.g. Symbola, on the other hand, only contains text-like characters which can also be considered inappropriate for one class of emojis.)

litherum commented 6 years ago

It seems to me that the primary use case for this would be a backdoor into the override behavior you described in the other thread, which the Working Group rejected.

If we do this, it should be part of the same property, not a new property.

Crissov commented 6 years ago

That is a use case and the primary one I am knowledgeable about, but there are a lot of variation sequences defined for sinograms (“Han characters”, “ideographs”) and this approach equally covers those. The feature is really different and separate from font-presentation.

Tab Atkin’s major counter argument seems to be that he thinks VSs were not used much – but they are, especially VS-16 for emojis. VS-1 is often the only relevant one elsewhere. Comments on the previous issue were mostly in favor.

Crissov commented 5 years ago

Actually, this does not necessarily have to be a subproperty of the text-transform property, but could be just a single new keyword: base-form, basic-form, common-form, default-form, base-variant, basic-variant, common-variant, default-variant, base-variation, basic-variation, common-variation, default-variation or no-variation.