I have a large family in separated .glyphs files (because kerning groups differ). I’d like to export them all at once. Is it possible to script this? Or is there any way to export all open .glyphs files?
You don’t even need to open them in Glyphs.
You can use the following methods:
Loop through the directory with the glyphs files and open each in Glyphs:
for filename in os.listdir(directory):
if filename.endswith(".glyphs") or filename.endswith(".glyphspackage"):
font = GSFont(directory + filename)
Then export each (active) instance:
for instance in font.instances:
if instance.active:
instance.generate()
You can find documentation on how to use instance.generate() in the Glyphs Python API Documentation.
1 Like