Stylistic Sets

  • by Rainer Erich Scheichelbauer
  • Tutorial
  • – Modified on

Let’s say you cannot decide on the shape of your a, or you worked out two variations and you want to keep both. But how? There’s only one key for a on your keyboard, after all.

For cases like this, OpenType offers so-called stylistic sets. You can define up to twenty variations of your alphabet and put them into your font. Stylistic sets do not necessarily exclude each other: more than one set can be activated at the same time. One stylistic set, for instance, could consist of letters with alternative descenders, another set of alternative shapes (like the a in our exampe), a third one of alternative diagonal legs for R and K. Whatever suits your design best.

Back to our a variations. The key to the stylistic variation is the glyph name. One default a, obviously, is called a. The alternate variation should be named a.ss01. The .ss01 suffix simply means it’s the a of the first stylistic set.

If you want more stylistic sets, all you need to do is add the appropriate suffix to the glyph name: .ss02 corresponds to the second stylistic set, .ss03 to the third one etc. Since the maximum number of sets is twenty, your suffixes can go all the way up to .ss20.

If you stick to this naming convention, Glyphs can build the feature code for you. All you need to do is open your Font Info (Cmd-I), go to the Features tab and click on the circled arrow button in the bottom left corner:

You’ll see that Glyphs adds a feature called ss01 containing a simple substitution: a is replaced by a.ss01. You can test it right in Glyphs by selecting the ss01 feature from the Features popup in the bottom left of an Edit tab:

Pick the first menu entry, the one with the dash, to reset all features again:

One final word of caution. Not many users know about stylistic sets. So, whatever variations you pack into them, be aware that they will be used in rare exceptions only.

Diacritics

If you have an a.ss01 and you also want to use diacritics with it, there’s a simple way to do so.

  1. Firstly, select all your diacritic a, like adieresis, aacute, abreve, and so on. (Or type a lowercase a, right-click it and choose Show all glyphs that use this glyph as a component from the context menu.)
  2. Duplicate them with Glyph > Duplicate Glyph (Cmd-D). The newly duplicated glyphs should be selected by default, and they all have the suffix .001.
  3. Now, press Cmd-Shift-F (or go to Edit > Find > Find and Replace) and replace .001 with .ss01.
  4. And finally, select those .ss01 glyphs and choose Glyph > Make Component Glyph (Opt-Shift-Cmd-C).

And, there you go:

Names for Stylistic Sets

It is a good idea to give your Stylistic Sets appropriate names, so your users can choose wisely in their OpenType-aware applications. Go into File > Font Info > Features and choose one of the ssXX features. Then, in the bottom right window pane, usually reserved for remarks, comments or code backups, you write Name: followed by a space and a human-readable English name for your set:

And in apps like InDesign CC, the user will be presented with the choices in their proper names:

Fantastic!

Here is one for the geeks among you: If you know what you are doing, you can also add the full featureNames code instead of the Name: line. This allows you to make have language and platform variants. Read all about it in the AFDKO specification, here is a sample:

featureNames {
   name "Single Storey a"; # Windows (default)
   name 3 1 0x0407 "Einstöckiges a"; # 3=Windows, 1=Unicode, 0407=German
   name 1 "Single Storey a"; # 1=Mac
   name 1 0 2 "Einst\9fckiges a"; # 1=Mac, 0=MacRoman, 2=German
};

You can find the right numbers for platform, encoding and language IDs in the name table specification in the OT Specs.

Attention: Mac names must be specified in their respective 8-bit Mac encoding, which means that all non-ASCII characters must be escaped with a 2-digit hex code. In our example, 1 0 specifies the MacRoman encoding, therefore the ö (lowercase o with diaeresis) in the last line needs to be escaped with \9f because 0x9F is the hex code for ö in MacRoman.

To quote the AFDKO spec: ‘character codes in the range 128-255 may be specified using a special character sequence of a backslash character (\) followed by exactly two hexadecimal numbers (of either case) which may not both be zero, e.g. \83. The ASCII blackslash character must be represented as the sequence \5c or \5C and the ASCII double quote character must be represented as the sequence \22.’

Easy, right?


SAMPLE FONT: ATTORNEY BY VIKTOR SOLT-BITTNER AND SCHRIFTLABOR
Update 2018-02-05: Added Names for Stylistic Sets. Updated Diacritics section.