Using a horizontal-stroke template called “héng” as the example, this page shows how to create a stroke template, set up its parameters, and use it in glyphs as a component.
- Stroke templates and components
- Add a template and control parameters
- Edit the template’s layers
- Insert a component into a glyph
- Adjust component parameters and position
- Edit the template to update every component
- Decompose into contours
Key concepts
| Term | Description |
|---|---|
| Stroke template | The definition of a stroke, stored in the font’s stroke template library. Can have control parameters |
| Control parameter | An adjustable value on the template, such as the length of a horizontal stroke. Each parameter has a minimum, maximum and default |
| Master layers | The template’s contours at either end of a parameter. For values in between, the contour is interpolated from the layers |
| Component | A single use of a template in a glyph. Each component has its own parameter values, position, scale and rotation |
When you edit a template, every component that uses it updates too—the equivalent of Smart Components in Glyphs.
Stroke template library
The library sits in the lower half of the Glyphs overview. Each card can be assigned a stroke type (horizontal, vertical, left-falling, right-falling, dot, rising, hook, turning, other) and offers Edit, Duplicate and Delete.

| Button | Function |
|---|---|
| + New template | Create a blank template and open the template editor |
| Import template JSON | Import a previously exported template file |
| Edit | Open the template editor |
| Duplicate | Make a copy, handy for similar strokes |
| Delete | Delete the template. This can’t be undone |
Add a template
- In the library, click + New template to open the template editor.
- Enter the template name in the name field at the top.

The template editor has the same toolbar as the glyph editor; see Making a variable font for drawing. The left panel adds a Control parameters section, and there are Import JSON and Export JSON buttons at the top.
Add a control parameter
- Under Control parameters, click +.
- Enter a name plus min, max and default. Here:
width, 10, 100, 50. - Click Add.

Master layers now shows a layer for each end of the parameter: width=10 and width=100.

Select a parameter and click - to remove it.
Edit the template’s layers
The rest of this page uses the existing template “héng”. Click Edit in the library to open it.

Click width under Control parameters to change its name and range.

Click a layer under Master layers to edit the contour for that parameter value. At width=10 héng is a short stroke and at width=100 a long one; the ending has the same shape, and only the stroke length differs.

Check layer compatibility
All layers need the same number of contours, the same number of nodes and the same start points to interpolate. Press Shift + Q to open the compatibility view; green means they match.

Insert a component into a glyph
We’ll build 三 from three héng components.
- Open the glyph editor. The Components tab in the right panel lists the stroke template library.

- Click the héng thumbnail to insert a component onto the canvas. Components are shown with a gray fill and are automatically named
heng1.cpn.

Adjust a component
Click a component to select it; a control panel appears in the bottom-right of the editing area.

| Field | Function |
|---|---|
| Parameter slider (width here) | Adjust the template’s control parameter |
| X / Y | Position |
| Sx / Sy | Horizontal / vertical scale |
| Rotation | Rotation angle |
| Decompose | Convert to regular contours, unlinked from the template |
| Delete | Delete the component |
Set width to 65: the stroke gets longer while the ending keeps its shape.

Type a position into X and Y, or drag the selected component.

| Action | Function |
|---|---|
| Click a component | Select |
Shift + click |
Add to selection |
Ctrl + click |
Invert |
| Drag selected components | Move; Shift constrains direction |
Alt + drag a component |
Move a copy |
Arrow keys / Shift + arrow keys |
Nudge 1 / 10 units |
Delete / Backspace
|
Delete |
| Double-click a component | Open the template editor |
| Double-click the component name in the panel | Rename |
Finish 三
Insert two more components and set their parameters and positions.
| Component | width | X | Y |
|---|---|---|---|
| heng1.cpn | 65 | 126 | -345 |
| heng2.cpn | 50 | 178 | -95 |
| heng3.cpn | 90 | 40 | 185 |

Hold Space to see the filled result.

Edit the template to update every component
Double-click any component to open the template editor and edit the contours. Here, the top node at the stroke ending is moved up 40 units on both layers.

Back in 三, the endings of all three components have changed, while each keeps its own width and position.

When editing a template, make the same change on every layer, or the shapes at either end of the parameter will no longer match.
Decompose into contours
Select a component and click Decompose in the control panel to turn it into regular contours whose nodes you can edit directly. Decomposed contours no longer follow template updates.

Export and import templates
Export JSON at the top of the template editor saves the current template to a file; Import JSON, or Import template JSON in the library, loads it into another font.