This library provides a bridge from Glyphs source files (.glyphs) to UFOs via defcon.
The main methods for conversion are found in __init__.py
.
Intermediate data can be accessed without actually writing UFOs, if
needed.
Masters:
master_dir = 'master_ufos'
ufos = glyphsLib.build_masters('MyFont.glyphs', master_dir)
Interpolated instances (depends on MutatorMath):
master_dir = 'master_ufos'
instance_dir = 'instance_ufos'
ufos = glyphsLib.build_instances('MyFont.glyphs', master_dir, instance_dir)
ufos = glyphsLib.load_to_ufos('MyFont.glyphs')
with open('MyFont.glyphs', 'rb') as glyphs_file:
font = glyphsLib.load(glyphs_file)
with open('MyFont.glyphs', 'wb') as glyphs_file:
glyphsLib.dump(font, glyphs_file)
The glyphsLib.classes
module aims to provide an interface similar to
Glyphs.app's Python Scripting API.
Note that currently not all the classes and methods may be fully implemented. We try to keep up to date, but if you find something that is missing or does not work as expected, please open a issue.