Features
The Features tab manages OpenType feature code that substitutes and positions glyphs.
These features are described in the OpenType specification for the GSUB
table (glyph substitution) and the GPOS
table (glyph positioning).
Some GPOS
features such as kerning, mark positioning, and cursive attachment are primarily defined in Edit View by editing the kerning values between glyphs and placing anchors.
These implicit features do not appear in the Feature tab.
See Implicit Features for details.
Editing Feature Code
OpenType features are defined using the AFDKO (Adobe Font Development Kit for OpenType) syntax. Glyphs also offers additional feature code functionality.
The Features sidebar is divided into three parts: Prefix, Classes, and Features. Click the plus button located to the right of each heading to add an entry. Select one or multiple sidebar entries and delete them by clicking the minus button located in the bottom-left of the window.
Prefix entries contain arbitrary feature code, primarily used to define lookups that need to be placed outside any specific feature.
Classes are lists of glyph names. The names are separated by a white space character, either a space or a line break.
Features control the glyph substitution and positioning rules. A feature is identified by its four-character tag. Click the plus button next to the Feature heading and search by feature tag or feature name. Double-click a feature to add it, or navigate the picker list with Up and Down arrow keys and press Return when the desired feature is selected.
A Spec button is shown in the top-right of the window when a feature is selected. Click it to open the feature specification on the Microsoft OpenType developer website.
Automatic Feature Code
Glyphs can automatically generate feature code for many commonly used OpenType features. Click the Update button located in the bottom-left of the window to create and update automatically generated prefixes, classes, and features all at once.
Glyphs also looks for new classes and features to generate when updating.
For example, suppose glyphs with an underscore in their name (such as f_l) were added since the last update.
In that case, Glyphs spots those additions and automatically adds a liga
(Standard Ligatures) feature with the corresponding feature code to the sidebar.
Many automatic features use the dot suffix in glyph names.
For example, glyphs ending in .sc are put in the small caps feature (sub a by a.sc
), or glyphs ending in .tf are put into the tabular figures feature (sub zero by zero.tf
).
This also works by appending the feature tag to the end of a glyph name.
For example, the glyph g.ss01 would substitute the glyph g when the first stylistic set (ss01
) is enabled.
Automatic prefixes, classes, and features are indicated with an update button to the right of their name. Click this button to update only that single entry. Select an entry from the sidebar and deselect the Generate Feature Automatically checkbox above the code editor to edit the code manually. Manual code is not updated by clicking the Update button. See Manual Feature Code for details.
Some features and classes are not added automatically when pressing Update, even though Glyphs could auto-generate them.
For example, the class All, which contains every exporting glyph, can be automatically generated, but not every font project needs it.
The Capital Spacing feature (cpsp
), which adds a bit of extra space between capital letters, can also be automatically generated but is not required by all designs, and some designers might want to write it manually.
Some features automatically generated by Glyphs do not appear in the Features tab. See Implicit Features for details.
Manual Feature Code
Uncheck the Generate Feature Automatically checkbox located above the feature code text field to write the code manually.
Code that cannot be generated automatically, such as the calt
feature, is always in manual mode.
Feature code is written in the AFDKO syntax, as specified by the OpenType Feature File Specification. Glyphs additionally supports extended feature code syntax.
After editing feature code, click the Compile button located in the bottom-left of the window to preview it in Edit View. See Previewing OpenType Features for details. Note that Edit View only previews manual substitution code, not manual positioning code.
Glyphs syntax highlights the feature code in the editor:
Keywords (like sub
or lookup
) are formatted differently from glyph names (like ka-deva
or zero
) which are again formatted differently from numeric values, lookup names, and comments.
Trigger the autocomplete function by typing a glyph name, a class name, or a lookup name (for example, a glyph name after the keyword sub
or a lookup name after the keyword lookup
).
Glyphs will provide a menu of matching suggestions.
Navigate to the desired suggestion with the Up and Down arrow keys. If there are many matching suggestions, scroll until the desired suggestion is shown, or narrow down the suggestions list by typing a few more characters. Accept the highlighted suggestion by pressing the Return key.
Option-click a glyph or class name to show a visual preview. For glyph classes, a list of all member glyphs is shown.
Glyphs shows error messages inline if the feature code is incorrect and cannot be compiled. Click the error icon for an expanded description. Errors with a wrench icon include a suggested fix. Click the Fix button to accept the suggestion.
Prefixes, classes, and features with errors show an icon in the sidebar. Click the error icon in the sidebar to jump directly to the erroneous part of the code.
The text field below the feature code can be used to write notes about a prefix, class, or feature. Change the height of the notes field by dragging the gray line above it up and down.
Click the snippets button to insert predefined code snippets. Choose any of the snippets to insert them into the feature code. See Custom Feature Code Snippets for details on adding custom feature code snippets.
Naming Stylistic Sets
Stylistic sets—the features with tags ss01
through ss20
—can be given proper names.
Applications supporting feature names will show those names instead of Stylistic Set 1
, …, Stylistic Set 20
.
When a stylistic set is selected in the sidebar, rows for the feature name are shown above the code editor. Each row has a language picker and a text field for a localized name in that language. Click the plus button located to the right of a row to add additional localizations of a feature name. Click the minus button to remove a row.
Use the Default language to provide a fallback name if none of the other localized names match the user’s locale.
Many systems assume the default language to be English.
For example, to provide the name of the ss07
feature in English and German, use the Default language for the English feature name and the German language for the German name.
Implicit Features
Implicit features are automatically generated by Glyphs but do not appear in the Features tab.
The kerning feature (kern
) is such an example.
Kerning values are defined in Edit View and managed by the Kerning window (see Kerning).
The kern
feature code is different for each master and instance, which is why it is not exposed in the Features tab and instead added silently in the background on export.
The same is true for other features that are added implicitly:
- Distance
dist
works similarly to kerning, but, unlike kerning, it is not controllable by the user.- Mark to base
mark
is generated if base glyphs have base anchors such as top or bottom and mark glyphs have matching mark anchors such as _top or _bottom. This also applies to theabvm
(above-base mark positioning) andblwm
(below-base mark positioning) features. See Mark to Base Positioning for details.- Mark to mark
mkmk
is generated similarly to themark
feature. See Mark to Mark Positioning.- Cursive positioning
curs
is also defined in Edit View by placing special exit and entry anchors. See Cursive Attachment.
Implicit features can also be extended manually.
Click the plus button next to the Features heading in the sidebar and search for a feature tag, for example, kern
.
Double-click the result or press Return to insert the feature.
In the feature code editor, insert the line # Automatic Code
somewhere in the feature code.
Any code above this line will be placed before the automatically generated feature code, and any code below it will be placed after the automatic feature code:
pos a b -20;
# Automatic Code
pos x y 15;
pos y z -5;
Insert the automatic code placeholder by clicking the snippets button located in the bottom-right of the window.
Export-Specific Features
Use the following custom parameters to customize the features for individual instances.
Add Prefix
,Remove Prefixes
, andReplace Prefix
Add Class
,Remove Classes
, andReplace Class
Add Feature
,Remove Features
, andReplace Feature
Automatic classes and features do not need to be changed for different instances; they are adapted automatically for each instance.