Skip to content

Glyph Recipe Syntax»

FontLab has a built-in alias.dat database that, for a number of “known” glyph names includes recipes that define how a given glyph should be generated from component glyphs. If you place your own alias.dat file in the Data subfolder inside FontLab’s user data folder, FontLab will use that instead. FontLab will use in the alias.dat file to try to find the recipe that describes the generation of the glyph that uses that name. If it cannot find the recipe for that glyph name, it will try to find a recipe for a synonym glyph name (the synonyms are defined in standard.nam).

For example: When you generate the uni00C0 glyph (“À”), FontLab will look up alias.dat for a glyph recipe for uni00C0. If it does not find any such recipes, it’ll look for recipes for synonym glyph names. Agrave is a synonym for uni00C0, and several recipes for Agrave are provided in alias.dat. If it finds one or more such recipes, it will:

  • Find the first recipe, and then will find the A base glyph, then find the the grave.case mark glyph, and insert them as components into Agrave glyph. The Agrave glyph will get the advance width of A since that is the base glyph.
  • If any of the component glyphs cannot be found in the font, FontLab will attempt a fallback recipe, which is to insert the A glyph and the gravecomb glyph. If those are not found, it will try A and grave.
  • If none of the recipes give the full result, FontLab will use the last recipe and build the glyph using as many component glyphs as it can find.

If your glyph generation code only includes a glyph name, FontLab will attempt to use a built-in glyph recipe for that glyph name.

Custom recipes»

If FontLab’s or your own alias.dat doesn’t know how to generate your glyph, or if you use a different glyph naming scheme, or if you’d like to provide some positioning clues for your component glyphs, you can use custom glyph recipes.

FontLab allows you to generate composite and auto glyphs using one of two code syntaxes:

  • simple_recipe consists of one or more component glyph names separated by _ for ligatures or + for mark attachment. Spaces within simple recipes are not permitted. This syntax is backwards-compatible with FontLab Studio 5 and is used in the alias.dat file.
  • extended_recipe consists of one or more component glyph names separated by & for ligatures or + for mark attachment, and followed by additional operators. Spaces with extended recipes are permitted. This syntax is based on the Glyph Construction syntax.

To build an auto layer with a custom recipe, type into the recipe field simple_recipe without any prefix to use the simple syntax (e.g. A+acute), or type = followed by extended_recipe to use the extended syntax (e.g. = A + acute).

To generate one or more glyphs with custom recipes in Font > Generate Glyphs > Custom:

  • to use only simple syntax, turn on Use legacy (FLS5) code and type simple_recipe=result_glyphName entries, separated by newlines or spaces, e.g. G+caron=Gcaron
  • to use only extended syntax, turn off Use legacy (FLS5) code and type result_glyphName = extended_recipe entries, separated by newlines, e.g. Aacute = A + acute
  • to mix simple and extended syntax, turn on Use legacy (FLS5) code and type newline-separated entries: either in simple syntax (e.g. G+caron=Gcaron) or, with the ! prefix, in extended syntax (e.g. !uni01E5 = M@,~)

Simple syntax»

Ligatures: _ (underscore)»

_: append the following glyph to the right of the preceding glyph, and extend the resulting glyph’s width by its own advance width. Surround glyph names with single quotes (') if they already use _ in their glyph name. For example f_l, f_i, 'f_f'_i.

Marks: + (plus)»

+: attach the following glyph as a mark to the preceding base glyph, but do not modify the advance width, for example C+caron, A+dieresis.

Auto layers and Generate Glyphs (if Use anchors is on) position the mark using corresponding anchors. The mark’s _top anchor will snap to the top anchor of the base glyph. Any mark anchor with the _ prefix will snap to a base anchor with the same name but without _.

If Use anchors is off or the glyphs don’t have anchors, you can follow + the operator by a horizontal and/or a vertical positioning suboperator, for example A+^>dotaccentcomb. Add a number after alignment suboperator to additionally shift the component, in UPM size ‰ (500 is always half UPM), for example A+|-200~50acutecomb.

(h)orizontal and (v)ertical positioning
h: center on the preceding glyph box
| h: place at the preceding glyph origin
< h: left-align to the preceding glyph box
> h: right-align to the preceding glyph box
v: shift only if preceding is uppercase letter
~ v: place at the baseline
^ v: shift by caps heightx-height

Extended syntax»

Ligatures: & (ampersand)»

&: append the following glyph to the right of the preceding glyph, and extend the resulting glyph’s width by its own advance width. For example = f & f & i. Use &\ to use kerning, e.g. = A &\ V

Marks: + (plus)»

+: attach the following mark to the preceding base, but do not modify the advance width. E.g. = A + ringcomb + acutecomb.

Metrics: ^ (circumflex)»

^: customize the resulting glyph metrics. width, lsb, rsb can be values or simple expressions that refer to other glyphs.

Metric Syntax Example with expression
Advance width glyph + glyph ^ width = A + acute ^ 400 = A + acute ^ A * 2
Sidebearings glyph + glyph ^ lsb, rsb = A + acute ^ 30, 30 = A + acute ^ A / 3, B * 2

Positioning: @ (at)»

  • place acute within the A coordinate space at x = 200, y = 100: = A + acute@200,-100
  • place acute within the A coordinate space at x = 100, y = 100: = A + acute@100
  • place acute on A so that in x, 90% of the acute’s bounding width will be at 10% of the A’s bounding width, and in y, 20% of the acute’s bounding height will be at 80% of the A’s bounding height: = A + acute@10%,80%
Transformation Syntax Example
Flip horizontally @…~,… = P@~, or = A + grave@~center,`top+120`
Flip vertically @…,…~ = M@,~ or = A + caron@center,~top
Flip in both axes @…~,…~ = g + commaaccent@~center,~top
Transformation matrix @xx, xy, yx, yy, x, y = A + acute@1, 0, 0, 1, 100, 100
Use expression wrap with ` = A + ring@center,`top+10` + acute@center,`top-10`
Specify preceding glyph @glyph:pos = A + acute@55%,`top+150` + ogonek@A:innerRight
Named parameters @xpar,ypar anchorName, guideName, descender, xHeight, capHeight, ascender, left, right, innerLeft, innerRight, width, bottom, top, origin, center

Unless you specify the preceding glyph, it is always the last component added.

Named parameters, e.g. = A + acute@center,top, are be processed in this order:

  • corresponding anchors: anchorName will in the 1st glyph will match _anchorName in the 2nd glyph, e.g. for = A + acute@top, the _top anchor of acute will be positioned on the top anchor of A
  • a single anchorName: anchors with the same name in both glyphs will match
  • a glyph guideName
  • a font guideName
  • a font metric: descender, xHeight, capHeight, ascender
  • for x, one of these:
  • left: the right edge of the 2nd component will be at the left edge of the 1st component
  • right: the left edge of the 2nd component will be at the right edge of the 1st component
  • innerLeft: the left edge of the 2nd component will be at the left edge of the 1st component
  • innerRight: the right edge of the 2nd component will be at the right edge of the 1st component
  • width: the left edge of the 2nd component will be at the bounding width of the 2nd component
  • origin: the x=0 of the 2nd glyph (not box) will be at x=0 of the 1st glyph (not box)
  • center: the center of the 2nd component will be at the center of the 1st component
  • for y, one of these:
  • bottom: the top of the 2nd component will be at the bottom of the 1st component
  • top: the bottom of the 2nd component will be at the top of the 1st component
  • origin: the baseline of the 2nd glyph will be at the baseline of the 1st glyph
  • center: the center of the 2nd component will be at the center of the 1st component

Comments and glyph notes»

In both syntaxes, separate the recipes with newlines and follow each entry with:

  • #comment to make a comment
  • #!glyph_note to create a glyph note, e.g. = A+acutecomb #!My note will make an auto layer with My note as the glyph note

Unsupported extended syntax»

The FontLab extended glyph recipe syntax does not support the following aspects of the Glyph Construction syntax:

  • $name = variable declaration and {name} variable usage
  • ! operator to specify a color flag
  • | operator to assign a Unicode codepoint
  • ? operator to ignore existing glyphs