- Naming of kerning groups
- Kerning in OpenType fonts
- Kerning in UFO
- the process of designing the whitespace in a typeface by adjusting the left and right margins of each glyph
- the local optimization of whitespace between pairs of glyphs by adding/subtracting a certain amount of units from the default spacing
Kerning is expressed as a list of glyph pairs and corresponding kerning values:
# pseudocode V A −50 T a -40 f parenright 95
Kerning pairs can also be defined using kerning groups – this allows us to cover a larger amount of combinations with fewer pairs.
# pseudocode @T_right: T Tcommaaccent Tcaron Tcedilla Tbar @r_right: r racute rcaron rcommaaccent @A_left: A Aacute Acircumflex Agrave Atilde @a_left: a aacute acircumflex agrave atilde @f_left: f fi fl germandbls V @A_left −50 @T_right @a_left -40 @r_right @f_left 15
A kerning group should contain glyphs which share the same left- or right-side shape. These can be accented versions of a base glyph, ligatures, or any other glyph with similar forms.
Naming of kerning groups
The pseudocodeAn informal high-level description of the operating principle of a computer program or other algorithm. example above demonstrates a problem with using
right in kerning group names. These qualifiers can mean two opposite things:
- glyphs which are the left/right glyph in a kerning pair
- glyphs which share the same left/right-side shape
In addition to this, there’s also the fact that writing direction can be left-to-right or right-to-left depending on the script – this affects the kerning direction as well.
To remove this ambiguity, it is recommended to think about kerning in terms of “first” and “second” glyphs in a pair. This is in line with the UFO3 specification which defines
public.kern2. as standard prefixes for kerning groups.
With that in mind, here’s an updated version of the above example:
# pseudocode @T_1st: T Tcommaaccent Tcaron Tcedilla Tbar @r_1st: r racute rcaron rcommaaccent @A_2nd: A Aacute Acircumflex Agrave Atilde @a_2nd: a aacute acircumflex agrave atilde @f_2nd: f fi fl germandbls V @A_2nd −50 @T_1st @a_2nd -40 @r_1st @f_2nd 15
Kerning in OpenType fonts
The OpenType format has two places for storing kerning data:
- kern table
kerntable is a simple flat table with kerning pairs and values. Originally a TrueType table, it is also allowed in OpenType-CFF fonts (but not supported by all engines).
→ Use it only for compatibility with legacy environments.
- kern feature
Kerning data can also be expressed as GPOSGlyph Positioning table, a table in the OpenType font format which provides precise control over glyph placement. Used for sophisticated text layout and rendering using the script and language system definitions in the font. feature code. This allows other kerning patterns such as triplets and quadruplets, adjustment of glyph placement independent of the advance adjustment, etc.
→ This is the recommended kerning mechanism for OpenType fonts.
A font may contain both types of kerning, for use by different environments.
Kerning in UFO
There are two ways in which kerning data can be stored in UFOs:
- Kerning pairs and values are stored as XML and can be accessed with Python at
- Kerning data is stored as OpenType code in a
.feafile, and can be accessed with Python at
font.features– but only as a big string with all other features.
From UFO kerning to OpenType kerning
Only one type of kerning is used when generating OpenType fonts, and kerning in the
kern feature has precedence over
If the font contains a
kernfeature, then any data in
font.kerningcontains data and the font does not contain a
kernfeature, RoboFont will generate the
kernfeature automatically for the pairs in
Typeface used in the illustrations: IBM Plex Serif