Google Fonttools vs. Glyphs Native Export - Automation

Hi,

I’ve been using Glyphs app for a while now. I’ve also written scripts within the app, and read other threads about how to hack Apple Scripts, etc to make a headless process.

My goal is to dynamically go from Glyphs Source → OTF/TTF. I’ve tried Glyphs source to UFO + DesignSpace to OTF/TTF, but it takes about 18 mins for 168 OTF files (super family).

But, if I export from Glyphs app GUI, it is done within 10 seconds. It’s super fast. However, I can’t run Glyphs app programmatically on a server. The reason for dynamically building fonts is we want to give customers ability to customize font alternatives without using OpenType features. We’d just build custom fonts for them, on the fly. Currently that takes 18 mins per customer on a macOS server (M2 chip) using Google Fonttools.

I would absolutely love to know how to run Glyphs natively in headless mode in a robust manner. Happy to pay for more Glyphs licenses if that’s required, even per server. We need this capability badly :slight_smile:

Thank you.

I’ve been at this for many days, would appreciate some comments about how best to automate exports. Please, just your thoughts would be helpful Glyphs developer. What do you recommend in terms of best way to approach this?

I have tried so many things and I am tired now.

  • Use Glyphs to export master UFOs, then use Fonttools (GlyphLib + ufoLib2) to generate designspace file. Then write instances using mutatorMath.

  • Read Glyphs file directly into GlyphsLib and generate designspace + ufo masters. Then use, mutatorMath lib to interpolate masters.

  • Convert all instances into Glyphs masters. Then export everything as UFO. Then interpolate.

I must have spent about 2 months on this project and I would very much appreciate some thoughts of where I should go. Thank you.

Furthermore, any thoughts on this question I asked a few months ago: Where is Glyphs python library located? - #3 by npgatech

If I can run Glyphs python script without launching Glyphs + macro window that would make my day (or life!!!). I would come hug you!

Haven’t used it much myself but there is some sample code for controlling headless Glyphs. You’ll find it in the GlyphsSDK.

Yea I tried it but not able to get pyobjc behaving. Always get “NSObject cannot be imported”. Also installed xcode and dev tools.

I feel like without objc API documentation, it’s hard to use internal methods and calls.

Have you installed pyobjc in the python you are using?

Yes, Requirement already satisfied: pyobjc. I believe that some internal Objc lib/hooks are not available on my system. Based on Stackoverflow answers, it seems to me an xcode issue.

Glyphs internal font engine is so wonderfully fast, I wish there was a good API to run it headless. Please consider making one that runs across platforms (macOS, Linux, etc). While there are python options, I think a native Glyphs API would be absolutely wonderful without the bridge stuff and having to rely on the GUI app. Perhaps too big of an ask, I know :slight_smile:

Building a purely command line version of Glyphs that even can run on different platforms it too much work. There are too many pieces (custom plugins, custom GlyphData …).

What happens when you run the “testExternal.py” file from GlyphsSDK/Glyphs remote scripts at Glyphs3 · schriftgestalt/GlyphsSDK · GitHub

Are you sure you are using the same python interpret when you run the script and pip?