Is there a method or existing script for importing instance definitions from an external data source such as a text file or spreadsheet?
I have a bunch of masters in a .glyphs file, from which I want to interpolate a lot of instances. Rather than adding each one manually in the Glyphs UI, I would like to be able to define them in an external data source of some kind and then import them into Glyphs.
My current project has 4 masters in Glyphs, I’ve used Superpolator to build out the 2 axis family of instances in a visual manner and now I’d like to find a way to import the Superpolator instances (22) into a multi-axis Glyphs MM file for production, kerning, OT features, brace layers etc. Maybe this is asking a lot of automation, but the translation of the Superpolator axis values to Glyphs axis values is alluding me.
Any help or insight would be appreciated, it seems as if there could be correlation in surmounting the obstacles John and I are facing at the moment.
@composerjk At the moment, my data is just a spreadsheet containing style names, weight and width class, and instance interpolation values. I’d want to add style linking information to complete the basic set of instance data for Glyphs. Not sure whether I’d need a way to set custom parameter data in the external source, but perhaps someone would find that useful?
@DaveBailey Can you point us to a Superpolator source? I’m guessing, since it’s a EvB project, there’s some text representation format?
This isn’t scripting, and I may be stating the obvious, but are you aware that most data can be copy & pasted between instances? It is manual work, and susceptible to mistakes, but I find that each project only takes a couple minutes defining instances (even for families with 100+ fonts).
You can also select multiple instances in the left area and modify values for all of those on the right.
Finally, you can select the instances on the left area, then copy & paste that into a text editor, edit the values, then re-paste it back into Glyphs. Formatting your spreadsheet data to to match Glyphs’ syntax should be possible.
Thanks Rob, that’s super helpful advice. I’m very new to Glyphs and doing some fairly limited and specific tasks with the tool, so I’m only just getting an intuitive grasp of how things like that might work.
Select any existing instance in the sidebar and copy paste it into a text editor. That will give you the syntax you need. Then build a list of those instances in the same (plist) format, copy the whole text, click in the instances list and paste.
You can write a script that add the instances like the one composerjk linked to.
You can also write a script that writes a .glyphsProject file directly and then use that to export your instance.
You can also control Glyphs from the outside to export instances. If that is interesting, I post some sample code.
Thanks, Georg. The paste to text editor, edit data, paste back into Glyphs’ instance window seems to be working pretty well, and I have about half the instances in place now.
I’ve noticed one weird thing: sometimes when I paste in the instances, one or a few glyphs suddenly stop being interpolable because the start node in one or other master has moved. Easy to fix, but very odd.
The calculation of compatibility is done only between masters that are actually used in interpolations. If you add an instance that interpolates two Masters that where not interpolated before, it will reveal the incompatibility.