W3C home > Mailing lists > Public > www-style@w3.org > August 2013

[css3-fonts] properties that affect digit glyph selection

From: John Daggett <jdaggett@mozilla.com>
Date: Mon, 5 Aug 2013 00:55:45 -0700 (PDT)
To: www-style list <www-style@w3.org>
Message-ID: <1092565809.1070140.1375689345071.JavaMail.zimbra@mozilla.com>

As previously noted [1], the Writing Modes spec includes statements
about the functionality of 'font-variant' when
'text-combine-horizontal' is used:

  # Also, a ‘font-variant’ value of ‘full-width’ must be ignored
  # in such cases: whether applied via ‘@font-face’ descriptor or
  # property declaration, within the combined text this value
  # does not not cause the UA to enable that font feature.

As currently specified in the CSS3 Fonts spec, 'font-variant' property
values translate to enabling/disabling specific OpenType features. 
These features typically affect the glyph selected for a given
character. Enabling a given feature won't necessarily affect glyph
selection for all characters. Many features only affect the glyph
selection for a small number of characters and which characters are
affected will vary across fonts.

What "must be ignored" means isn't clear, but I'm assuming this
translates to "disable the full-width variant feature (fwid)". 
However, this ignores all the possible features that might affect
glyph selection for digits:

  font-variant: sub;                        /* subscript digits */
  font-variant: super;                      /* superscript digits */
  font-variant: small-caps;                 /* small caps digits */
  font-variant: lining-nums;                /* lining digits */
  font-variant: oldstyle-nums;              /* old-style digits */
  font-variant: proporitional-nums;         /* proportionally spaced digits */
  font-variant: tabular-nums;               /* fixed-width digits */
  font-variant: slashed-zero;               /* slashed zero */
  font-variant: styleset(flat-terminals);   /* font-specific variants */
  font-variant: character-variant(ancient); /* font-specific character variants */
  font-variant: annotation(circled);        /* annotation forms */
  font-variant: full-width;                 /* full-width digits  */
  font-variant: proportional-width;         /* proportional digits */

Any one of these might influence glyph selection for digits in
tatechuyoko runs:

.tcy {
  font-variant:            oldstyle-nums;   /* enable 'onum' */
  text-combine-horizontal: digits 2;        /* enable 'hwid' */

As defined by the OpenType spec, features are evaluated in the order
in which they are defined in the font (*).  So if the old-style number
feature ('onum') is defined before the half-width variant feature
('hwid'), the glyph selection might look like this:

            cmap                onum                  hwid
  character ====> default glyph ====> old-style glyph ====> half-width old-style glyph

There probably aren't many fonts that support this specific
combination but the space of possible combinations is quite large.

If the goal is to leave the selection of width variants unaffected by
other font-variant features that might adversely affect the selection
of width variants, then layout should simply run with default features
plus width variants.

But I actually don't think it's important to have user agents try and
mitigate all possible combinations that adversely affect glyph
selection.  Like other odd combinations of CSS properties, unless
there's a common "bad usage" pattern CSS should shy away from
unnecessary edge case handling like this.  I would instead opt to
simply remove the "must be ignored" sentence and not attempt to do
this sort of feature mitigation.


John Daggett

(*) except for features used for supporting specific scripts

[1] http://lists.w3.org/Archives/Public/www-style/2013Jul/0411.html
Received on Monday, 5 August 2013 07:56:12 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:32 UTC