Making stylistic alternates


Stylistic alternates give a character a second design. When a user turns on a stylistic set (ss01–ss20) in their layout app, the default glyph is swapped for the alternate.

The feature registry in Microsoft’s OpenType spec describes ss01–ss20 like this:

Selects typographic alternatives for a set of glyphs.

——Microsoft Typography, Registered features: ‘ss01’ – ‘ss20’

In other words, it applies an alternate design to a group of glyphs. A single stylistic set can hold alternates for many characters, and they are all swapped together when it’s turned on. On the web, enable it with font-variant-alternates: styleset() or font-feature-settings: "ss01" from W3C CSS Fonts Module Level 4.

This tutorial uses 青 as the example: we’ll make an ss01 alternate, 靑, and export the font.

  1. Create an alternate in the Glyphs overview
  2. Edit the alternate’s contours
  3. Review the feature and the substitution graph
  4. Preview
  5. Export
  6. Use it in Illustrator

Key concepts

Term Description
Alternate glyph Another design of the same character. Its name is the original glyph name plus a suffix such as .ss01, and it has no Unicode code point
Stylistic set The OpenType ss01–ss20 features, each a set of substitution rules
Substitution rule sub original by alternate;, written in the corresponding feature

Create an alternate

  1. Open the Glyphs overview.

Glyphs overview

  1. Right-click 青 and choose Create alternate.

Context menu

fontion does three things:

The new alternate

The top of the editor shows the glyph name uni9752.ss01 and “Unencoded”, and the bottom-left of the canvas shows that it belongs to ss01.

Edit the contours

The new glyph starts with the same contours as the original; edit them into the alternate design. Here, the 月 in the lower half is changed to 円, giving 靑. For how to use the editing tools, see Making a variable font.

The edited alternate

Back in the Glyphs overview, the original and the alternate sit side by side. The alternate’s cell shows no code point.

Both glyphs in the overview

Review the feature

Open Features from the navigation bar and click ss01 on the left. The feature’s code appears on the right:

sub uni9752 by uni9752.ss01;

The ss01 feature code

Field Description
feature The feature tag, e.g. ss01
Enabled When unchecked, this feature isn’t written on export
Description The stylistic set’s display name, shown in layout apps’ menus
Editor The substitution rules, which you can edit directly

Each alternate you create adds one rule to the corresponding feature. A second alternate of the same character goes into ss02.

Substitution graph

Click Visualize in the top left to see the substitutions as a graph: original glyphs on the left, alternates on the right, with the feature shown in the top-right corner.

Substitution graph

Action Function
Drag empty space Pan
Scroll wheel Zoom
Search field at the top Filter by glyph name or character
✕ in the top right Close

Shaping test

Use the Shaping test at the bottom of the Features page to confirm the rule works.

  1. Enter 青.
  2. Check ss01.
  3. Click Shape.

The result shows uni9752.ss01, meaning 青 is replaced by the alternate when ss01 is on.

Shaping test

Preview

Open Preview and type 青. The features in the font are listed to the right of OpenType at the bottom.

Preview: ss01 off

Click ss01 and the glyph switches to the alternate.

Preview: ss01 on

Export

  1. Go back to the Glyphs overview and click Export font.
  2. Choose a format. This example uses OTF.

Export settings

  1. Click Start export, then download it from the Versions list when it’s done.

Export complete

The exported font contains a GSUB table in which the ss01 feature replaces uni9752 with uni9752.ss01.

Use it in Illustrator

  1. Install the exported font.
  2. In Illustrator, type 青 and set it in the font you just installed.
  3. Open Window › Type › OpenType.
  4. Select the text, and in the OpenType panel choose Set 1 under Stylistic Sets.
Image coming soon: Illustrator's OpenType panel and Stylistic Sets menu
Image coming soon: the glyph before and after turning on the stylistic set

Further reading