Stylistic sets

Tutorial
by Rainer Erich Scheichelbauer
en fr zh

30 October 2024 Published on 8 October 2012

You have more than one design that you like for the same letter? Put them into a stylistic set!

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 > Create Composite (Ctrl-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. Glyphs will automatically display a field for the name. Unless you have a better idea, leave Default in the language pop-up. Then, add a good descriptive name for your users, best in what is the most sensible lingua franca for the users of your font. Very often, but not necessarily, that will be English:

If you do add other languages, always also keep a Default entry. And sure enough, if none of your users speak English, write the Default entry in a language that makes sense for your users. The entry supports Unicode, so don’t worry about special characters.

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

Fantastic!

OT code

Here is one for the geeks among you: If you know what you are doing, you can also add the full featureNames inside your feature code. This allows you to have more 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? No, seriously, all you need is the UI at the top of the window. Glyphs then produces this code automatically. I added this here just so that you are scared. Har har.


SAMPLE FONT: ATTORNEY BY VIKTOR SOLT-BITTNER AND SCHRIFTLABOR
Update 2018-02-05: added Names for Stylistic Sets. Updated Diacritics section.
Update 2019-07-30: corrected sentence in Names for Stylistic Sets and link for Attorney (Thanks Nathalie.)
Update 2022-08-01: updated title, related articles, minor formatting.
Update 2024-10-30: fixed a legacy error (‘Name:’), thx Viktor Baltus.