Generate() API support for UFO(2|3) and WOFF(2)?

Hi, any future plans for the generate() API (http://www.docu.glyphsapp.com/#generate) to also support UFO2/UFO3 and WOFF/WOFF2 formats alongside OTF and TTF? In various workflows, it would be quite useful to be able to script exports of all supported formats from python directly (instead of manually through the menu entries). Thanks!

I’ll add the support for WOFF.

Thanks! I suspect UFO is trickier to do, but it would still be amazingly useful to have it scriptable.

It is already scriptable. Just not with one line.

font = currentDocument.font()
ufoExporter = Glyphs.objectWithClassName_("GlyphsFileFormatUFO")
ufoExporter.setConvertNames_(True)
ufoExporter.setFontMaster_(font.masters[0])
url = NSURL.fileURLWithPath_("Path/where/to/save/test.ufo")
ufoExporter.writeUfo_toURL_error_(font, url, None)

Brilliant! Thanks a lot for shedding more light on this.

I can’t seem to find how to select all the available masters for the UFO export though. What am I missing?

font = currentDocument.font()
ufoExporter = Glyphs.objectWithClassName_("GlyphsFileFormatUFO")
ufoExporter.setConvertNames_(True)
for master in font.masters:
    ufoExporter.setFontMaster_(master)
    url = NSURL.fileURLWithPath_("Path/where/to/save/test.ufo") # assign a unique file name.
    ufoExporter.writeUfo_toURL_error_(font, url, None)

1 Like

I really like being able to set parameters for the UFO export like ufoExporter.setConvertNames. Can I get more details about the ufoExporter options? Is that already documented somewhere? Thanks !

Where can I find more information about ufoExporter? Any news on the WOFF front? thanks!

@GeorgSeifert Is WOFF actually supported? I can’t seem to get it to work with instance.generate. Would be good for WOFF2 and EOT as well, with an option to choose between TTF and OpenType/CEF