Importing instance definitions?

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.

I’d like to piggy-back on this discussion!

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.

It shouldn’t be too difficult to write a script to create the instances given a specified data file format for those definitions. What might your data file look like, @tiro_j?

@DaveBailey: I haven’t looked at the Superpolator file formats or axis definitions, but it might be possible to figure out a reasonable conversion between those axis values. I could take a look.

Feel free to send me email with the details.

Separately, if one was wanting to insert instances based upon one of the Luc(as), Pablo, or Maciej algorithms, there’s basic code in @mekkablue’s Insert instances script: https://github.com/mekkablue/Glyphs-Scripts/blob/master/Masters/Insert%20instances.py

@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.

1 Like

@composerjk @tiro_j Here’s a link to one of my interpolation space Superpolator files: https://www.dropbox.com/s/y5zvqvrpm3sob0q/Prospectus%20Roman.sp3.zip?dl=0

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.

RTFM, I know, I know.

2 Likes

Yes, that works for me. Thanks very much.

I still like @DaveBailey idea of making more direct workflow with Superpolator possible, though, so hopefully someone will work on that independently.

2 Likes

@tiro_j I’ll work with @composerjk on this and let you know what we find. A lot of my current projects require working with other designers’ Superpolator spaces.

There are several options.

  • 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.

1 Like

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.

1 Like