Batch Renaming Exports

Hi everyone,

I’m working in Glyphs 3 on a complex typeface with multiple masters and variable exports. My font has three axes: Weight, Width, and Optical Size, and I’m now adding Italic and Monospace variants.

Currently, I have dozens of exports and I need to rename them to include options like Extended, Mono, or Italic to their names. Doing this manually for each export is time-consuming, so I’m looking for a way to batch rename or append a suffix to all export names at once.

Is there a built-in feature or a Python script that can help with this? Ideally, I’d like something that:

  1. Appends “Extended” to a group of selected exports within the export panel.

I’ve tried looking through the Glyphs scripts but haven’t found a straightforward solution. Any suggestions or example scripts would be greatly appreciated!

On a side note, I’m quite new to Glyphs and am always keen to find more resources to learn from.

Cheers,
Gregory

Scripting is perfect for this. Use GSInstance.active to check whether an instance is active (this is a simple way of defining the instances you want to be affected by your script). Then iterate over the active instances and use

GSInstance.name += " Extended"

to add “Extended” to their names.

Thank you so much! I ended up putting this together;

font = Glyphs.font
suffix = " Extended"
for instance in font.instances:
    if instance.active:
        instance.name += suffix

Almost. It needs to be:

instance.nane = instance.name + suffix

Or did your script work for you? Maybe I’m stupid.

@SCarewe The compound assignment operator += should work fine.

That must have changed in some version of Glyphs, I’m almost certain this used to work differently.

This seems like an XY problem. Scripting or manually renaming exports shouldn’t be necessary to export all the fonts you want.

Maybe you could share screenshots from your info window of the font and (some) exports sections?

Screenshots attached below. The goal is to create a typeface with 5 axes. I’m jumping in headfirst, my university doesn’t have a font engineering/type design program. I might be doing this all incorrectly.

This might not be the best way to create the end result, I have these exports present as a way of tracking interpolation. Any advice is appreciated.

Some things about your axis values:

Optical size should correspond to the appropriate text size in typographic units. So, for example, it should range from 6 (really small) to 72 (really large). 500 is a bit very excessive. Reason: Some layout applications (including some modern browsers) will automatically tap into this axis and modify it based on the text size you have set.

Width should correspond to a percentage of what you consider the “normal” width. So, for example, Narrow could be at wdth=50, if your Narrow design is roughly 50% the width of your normal width. It is imperative that your Regular instance is at wdth=100.

Just because you mentioned courses in the beginning: there are some excellent online courses available. One is starting in five days and is specifically about font engineering: ILT – Font Engineering. Check out other ILT courses while you’re at it. Otherwise, Practica comes to mind for type design. These are only a small selection of courses, I’m sure other people here will be happy to recommend more resources.

Ah, maybe I didn’t understand you correctly. I thought you needed to rename your exports every time you exported (a part of) the fonts. For adding an element to their name once, indeed doing it manually or with a small script is the way to go.