As I mentioned in my previous post, Firefox 11 includes the ability to make use of Graphite's user-selectable font feature capability. Font features are used to generate alternate forms of some letters as needed for a certain language or geographical region. Features can also be used to tune the font for specific purposes, such as literacy materials.

Features are specified using the -moz-font-feature-settings property in CSS. The general approach is to define a style that indicates the font along with the Graphite feature value to use.

The  Graphite web site shows an example of Burmese script displaying using the Padauk font, with the "Tear drop style washwe" feature turned on. (If you can't figure out where the tear-drop shaped washwe is, look down at the bottom of the page; there is a graphic that highlights them.) The internal ID for the feature is "wtri", and the value 1 is used to turn on this boolean-valued feature. So the following CSS is what would be used to define a style using this feature:

.padauk_washwe font-family: "Padauk"; -moz-font-feature-settings: "wtri=1";

Here's another example: SIL's Annapurna font to render Devanagari has a number of features, including one to use alternate forms of the sequence "shra", and another to alter the position of the nukta when it is located on an ukar. The first example shows the standard rendering:



and the second shows the alternates:



To create this effect on a web page, you would define a style called something like "annapurna_alt" as follows:

.annapurna_alt font-family: "Annapurna SIL"; -moz-font-feature-settings: "shra=1,ukar=1";

where "shra" and "ukar" are the IDs of the relevant features.

Caveats

Keep in mind a couple of caveats, however:

  1. It is possible to use both numbers and short strings as feature IDs. However, Firefox only handles the string approach. So if your Graphite font uses numbers as IDs, they won't be recognized, and we don't expect that they ever will.
  2. Also, we've discovered a bug in the interface between Graphite and Firefox where only 4-letter strings are correctly handled. If a feature has an ID that is only 2 or 3 characters long, it will not be recognized. We expect this bug to be fixed in the next version of Firefox.