Making a variable font


A variable font packs multiple weights into a single font file, letting users dial in any weight within the axis range. You only draw the contours at the two ends of the axis; everything in between is interpolated.

The OpenType spec calls this technology OpenType Font Variations, introduced in version 1.8. Microsoft’s specification defines it like this:

OpenType Font Variations allow a font designer to incorporate multiple font faces within a font family into a single font resource.

——Microsoft Typography, OpenType Font Variations overview

In other words, several styles of a family are merged into one font file. On the web, axis values are set with properties such as font-weight and font-variation-settings, defined in W3C CSS Fonts Module Level 4.

This tutorial uses 花 as the example and walks through building a weight-variable font in fontion, from creating a new font to exporting it. For how variable fonts work, the common axes (wght, wdth, slnt, opsz, ital), and the challenges of designing them for Traditional Chinese, see the TwinType blog post What are Variable Fonts? (in Chinese).

  1. Create a font and add a glyph
  2. Draw contours with the pen
  3. Select and edit nodes
  4. Add a weight axis and a Bold master
  5. Build the Bold master
  6. Check compatibility and node trajectories
  7. Preview
  8. Export

Key concepts

A variable font is made of axes and masters. An axis defines an adjustable range (for example, weight 200–800); a master is a complete design at one position on that axis. Weights between masters are interpolated, so each glyph must have the same number of contours, the same number of nodes per contour, and the same start points in every master.

Create a font

On the project’s Design page, click New font in the top-right corner.

Projects page

  1. Enter a font name and click Next.

Enter a name

  1. Choose Start blank and click Next.

Choose a starting point

  1. You can skip the character set and add characters one by one later. Click Create.

Choose a character set

You’ll land on the Glyphs overview. A new font contains just two glyphs: .notdef and space.

Glyphs overview

Add a glyph

Type 花 into the field at the top right and click Add glyph. You can enter several characters at once, and notations like uni82B1 and U+82B1 work too.

Add a glyph

The glyph editor opens right away.

Empty glyph editor

Area Contents
Left Master layer list, advance width and sidebearings
Center Canvas. The two vertical lines mark the left and right edges of the em box; the lower horizontal line is the baseline
Right Coordinates and size of the selection, flip, align
Bottom Toolbar and key hints for the current tool

Toolbar

Toolbar

From left to right:

Tool Use
Select Click, marquee-select, drag nodes and handles
Pen Draw contours. Shortcut P
Knife Drag a line to cut closed contours; Shift snaps to 15°
Rectangle Drag to draw a rectangle; Shift for a square
Rotate Set a center, then rotate the selection; Shift snaps to 15°
Measure Drag a line to show distances between its intersections with contours
Smart deform Adjust proportion, counters, center of gravity and weight independently
Image trace Convert an image into contours
Simplify nodes Remove redundant nodes
Text Set the text string shown in the editing area. Shortcut T
Background trace Place a background image to trace over. Shortcut Ctrl + B
Zoom Zoom the canvas. You can also zoom with the scroll wheel and pan by dragging with the middle button
Undo / Redo Ctrl + Z / Ctrl + Shift + Z

Buttons with a small triangle in the bottom-right corner are tool groups; right-click to expand them. The Select tool’s group also contains Focus select.

Tool group

Below the toolbar, the keys available for the current tool are listed.

Key hints

Drawing with the pen

Pick the Pen tool (P) and start with the left vertical stroke of 艹.

  1. Click to place each node in turn. A click makes a corner node; click and drag makes a smooth node, with the handle following the drag direction.

Drawing

  1. Press Ctrl + E to close the path.
  2. Press Esc to return to the Select tool.

Closed path

Action Result
Click Add a corner node
Click and drag Add a smooth node; Shift snaps to 15°
Delete Step back to the previous node
Space End the current path and start the next
Ctrl + E Close the path
Esc Stop drawing

Draw the remaining six strokes the same way. Each stroke is its own closed contour, and strokes may overlap.

Finished Thin

Selecting

Marquee direction

The direction you drag the marquee determines what gets selected.

Drag right: a dashed green box selects every contour it touches, in full. Below, the box covers only part of the right vertical and the horizontal stroke, yet both contours are selected.

Dragging Result
Drag right Drag right result

Drag left: a solid blue box selects only what lies entirely inside it. With the same area, only the right vertical is selected.

Dragging Result
Drag left Drag left result

Adding to and inverting a selection

Action Result
Shift + click or marquee Add to selection
Ctrl + click or marquee Invert: selected items are removed, unselected ones are added
Ctrl + A Select all
Esc Clear selection

Hold Shift and marquee the left vertical; now both verticals are selected:

Add to selection

To invert, hold Ctrl and marquee the whole character. The two selected verticals are removed and all other contours are added:

Inverted selection

Adding and inverting follow the same marquee-direction rules.

Fill preview

Hold Space to see the filled glyph shape; release to go back to editing.

Fill preview

Editing nodes

There are two kinds of nodes: squares are corner nodes and circles are smooth nodes. The small dots are handles, connected to their node by thin lines.

Click a node to select it; selected nodes turn blue.

Selected node

Switch the right panel to Selection to see the node’s X and Y, which you can type in directly.

Coordinates panel

Moving between nodes

With a single node or handle selected, press Tab to jump to the next point along the path, in the order node → handle → handle → next node. Shift + Tab goes backward.

After pressing Tab

Smooth and corner

Press S to toggle the selected node between smooth and corner. Below, the node changes from a circle to a square.

Converted to corner

Node and handle actions

Action Result
Arrow keys Move 1 unit
Shift + arrow keys Move 10 units
Shift + drag Constrain to horizontal or vertical
Tab / Shift + Tab Next / previous point
S Toggle smooth / corner
Alt + click a node Toggle smooth / corner
Ctrl + drag a node Move only the node; handles stay put
Alt + drag a node Duplicate
Alt + drag a handle Mirror the opposite handle at equal length
Shift + Alt + drag a handle Change length only, keeping direction
Double-click a handle Retract the handle into its node
Delete Delete selected nodes; with only handles selected, retract them
Shift + H Corner rounding
R (hold) Rotate the selection around a custom center
Ctrl + D Repeat the last move, rotation or scale

Font info

Open Font Info from the navigation bar. First, fill in the Family Name under General.

Family name

Add a weight axis

Scroll down to Axes.

  1. Click Add Axis. It defaults to wght (Weight).
  2. Enter Min 200, Default 200, Max 800.

Weight axis

Add masters

  1. Under Masters, rename the existing master to Thin and set wght to 200. The master at the axis default is marked Default.
  2. Click Add Master, rename it Bold, and set wght to 800.

Two masters

Named instances

Named instances are fixed positions on the axis that show up in an app’s weight menu. Under Instances, click Add Instance and enter a name and a wght value.

Named instances

Build the Bold master

Go back to the editor for 花. The Master layers list on the left now shows Thin and Bold. Bold has no contours yet and is marked ⚠.

Master layers

Copy the Thin contours

Copying Thin’s contours into Bold first guarantees both masters share the same structure.

  1. In the Thin master, press Ctrl + A to select all and Ctrl + C to copy.

Select all

  1. Click Bold on the left.
  2. Press Ctrl + V; the contours are pasted in place.

Pasted into Bold

Adjust the weight

Move nodes stroke by stroke to make them heavier. Take the vertical stroke of 亻 as an example:

  1. Click the lower node on the stroke’s right edge, then Shift-click the upper one.

Right edge selected

  1. Press Shift + → four times to move the right edge 40 units to the right.

Right edge moved

Adjust the other strokes the same way. Only move nodes and handles—don’t add or delete nodes, or the two masters won’t interpolate.

The finished Bold:

Finished Bold

Checking

Master compatibility

Press Shift + Q to open the master compatibility view. Every node is numbered: green means the structure matches, red means it doesn’t. The contour count for each master is listed in the top-left corner.

Compatibility view

If you see red:

Press Shift + Q again to close it.

Node trajectories

Press Shift + T to show the path each node travels between masters. Hollow circles mark each master’s position; magenta marks the axis maximum.

Node trajectories

Nodes whose trajectories cross or run in opposite directions tend to distort strokes during interpolation. With only two masters, trajectories are straight lines; if you need them to curve, click Add intermediate layer on the left.

Preview

Open Preview from the navigation bar and type 花.

Preview page

The control bar at the bottom:

Preview controls

Control Use
Size Size of the preview text
Weight Move along the weight axis; there is one slider per axis
Vertical Toggle vertical layout
Node trajectories Show node paths, same as Shift + T

Drag Weight: the in-between weights are interpolated from the two masters.

200 500 800
200 500 800

Turn on Node trajectories:

Node trajectories in Preview

Export

  1. Go back to Glyphs and click Export font in the top-right corner.

Glyphs overview

  1. Choose Variable TTF.

Export options

Option Use
Save version Keep this export in the version list; you can set how many to keep
Also save a project snapshot Save the design as it was at export time so you can roll back later
Email me when done Useful for large fonts with long export times
  1. Click Start export. When it’s done, the file appears under Versions below; click the download icon to get it.

Export complete

If a version row shows a warning, expand it to see which font info fields are still empty, such as Vendor ID.

Further reading