It is common for fonts to contain glyphs which are made out of other glyphs. For example: accented glyphs, ligatures, fractions, etc.

Font formats and font editors have special features and data types to enable the reuse of glyph shapes in a font:

A component is a reference to another glyph in the same layer of the same font. If a component’s base glyph is edited, all references to it are also updated.
Anchors are invisible single points with a position and a name. They are commonly used to position components and glyphs in relation to each another.

Building composed glyphs

There are different ways to build composed glyphs in RoboFont:

Using the Add Glyphs sheet

The Add Glyphs sheet can be used to create new glyphs in a font. It supports a basic syntax for building glyphs using components and anchors.

Add Glyphs sheet

Using Glyph Construction

The Glyph Construction language offers a more powerful syntax for building new glyphs from components. The Glyph Construction extension includes the Glyph Builder interface which can be used to preview and build composed glyphs.

Glyph Builder

Building composed glyphs with a script

RoboFont 3 comes with the glyphConstruction module embedded, so you can import it into a script and build glyphs from a string with glyph constructions.

Build accented glyphs in RoboFont3 using Glyph Construction.


from glyphConstruction import ParseGlyphConstructionListFromString, GlyphConstructionBuilder

# define glyph constructions
txt = '''\
agrave = a + grave@center,top
aacute = a + acute@center,top

# get the actual glyph constructions from text
constructions = ParseGlyphConstructionListFromString(txt)

# get the current font
font = CurrentFont()

# iterate over all glyph constructions
for construction in constructions:

    # build a construction glyph
    constructionGlyph = GlyphConstructionBuilder(construction, font)

    # get the destination glyph in the font
    glyph = font.newGlyph(constructionGlyph.name)

    # draw the construction glyph into the destination glyph

    # copy construction glyph attributes to the destination glyph
    glyph.name = constructionGlyph.name
    glyph.unicode = constructionGlyph.unicode
    glyph.width = constructionGlyph.width
    glyph.markColor = 1, 0.5, 0, 0.5

In RoboFont 1, you can build accented glyphs using RoboFab’s RFont.compileGlyph.

Build accented glyphs in RoboFont1 using RoboFab’s font.compileGlyph.


# get current font
font = CurrentFont()

# a dictionary of glyph constructions
accentsDict = {
    # accented glyph : [base glyph, [(accent, anchor)]],
    'agrave' : ['a', [('grave', 'top')]],
    'aacute' : ['a', [('acute', 'top')]],
    # ...add more accented glyphs here...

# iterate over all accented glyphs
for accentedGlyph in accentsDict.keys():

    # get base glyph and accents/anchors
    baseGlyph, accents = accentsDict[accentedGlyph]

    # build accented glyph using components
    font.compileGlyph(accentedGlyph, baseGlyph, accents)

Useful extensions

Last edited on 13/03/2019