font features in CSS

Prince 7.0 has been released with experimental support for OpenType
font "features". This means that glyph alternates present in the font
can be selected by way of CSS. Here's a sample document that uses
alternates found in Adobe's "Arno Pro" font:

The preliminary syntax for selecting various features is:

  font-variant: prince-opentype(<feature name>);

Mozilla is also working on supporting font features:

Their preliminary syntax is:

  -moz-font-feature-opentype: "<feature-name>=<value>";

(Comma-separted lists are supported in both implementations.)

So, it seems font "features" could be a useful CSS feature. However,
some issues have come up:

  - the current implementations only support arbirary features. The
    names of these features are buried deep down within the fonts and
    are hard to find. Another approach is to standardize a set of
    common features. There have been several such proposals in the

    I personally think standardized names will be better, but it may
    still be hard to avoid cryptic names like "alt" and "salt".

  - Are features binary or do they need integer values? It seems that
    Prince has implemented features as binary switches, e.g.:

      font-variant: prince-opentype(salt2);

    while Mozilla uses integer values:

      -moz-font-feature-opentype: "salt=2"; 

    Personally, I hope to avoid numbers altogeter; they seem even more
    arbitrary than the alt/salt/ss names we're currently seeing.

  - Here's a reformulated version of Mozilla's demo document that
    contains both the Prince and Mozilla syntax, along with Prince's

    The page has been carefully designed so that all lines should have
    the same length. However, in Prince's renering, lines stick out.
    This is, I believe, due to Prince applying the named feature
    (ss05) in the case of the "Beua.." line) to all characters in the
    element, while Mozilla only applys it to the last character of a
    word. Mozilla's solution is convenient; it avoids having <span>
    elements around the last charater in order to give it a special
    feature. However, how do one decide that a certain feature should
    only be applied to the last characters? Does the feature itself
    indicate this in any way?

  - personal peeve: I don't like the term "font feature". The term
    "feature" seems much to generic to be used for a very specific
    feature (ouch): alternate glyphs.

              Håkon Wium Lie                          CTO °þe®ª        

Received on Monday, 26 October 2009 14:54:52 UTC