Help making a Robofab script to work on Glyph

Hi there,

There is very simple Robofab script I use to create interpolations between two glyphs I would like to have in working in Glyphs. If you want take this little assignment, please shoot me an email from: ReType Foundry | Contact


You may not need to; Glyphs has its own way of spontaneous interpolation, that is with the contents of background. In G2, this is found under the Transformation filter. In G3, it’s moved under Paths menu.

It might be easier to use the build in API to do the interpolation.

Here is a snippet that is interpolating first layers from two glyphs and replacing the content in the third glyph.

A = Font.glyphs["A"]
B = Font.glyphs["B"]
C = Font.glyphs["C"]

layerA = A.layers[0].copy()
layerA.layerId = "layerA"
layerB = B.layers[0].copy()
layerB.layerId = "layerB"

layerC = A._interpolateLayers_interpolation_masters_decompose_font_error_([layerA, layerB], {"layerA":0.15, "layerB":0.85}, None, False, Font, None)

C.layers[0] = layerC

If you like to interpolate inside a glyph, it is a bit easier:

A = Font.glyphs["A"]
middleLayer = A.layers[1]
1 Like

Hi there,

What I need is a code for Glyphs that do on exactly what this FL script does: create a new glyph slot with A-B interpolations in different degrees. Can it be done?


from import CurrentFont
f = CurrentFont()
for i in range(0, 60):
	factor = i*.02
	name = "result_%f"%factor
	print "interpolating", name
	f[name].interpolate(factor, f["A"], f["B"])

This is quite close to the first snippet that I posted above. At least the pieces are there :wink:

I don’t have the time, Georg. So, if someone want to earn some money for making the exact thing, please contact me.

This function already exists. See Window > Plugin Manager > Scripts > mekkablue (all the way at the bottom) and after installation, find it in Script > mekkablue > Interpolation > Variation Interpolator. It interpolates between fore- and background.

I’ll see if I can add interpolating between different glyphs.




Hi there,
When I run Variation Interpolator, nothing happens, no windows shows up. Any idea?

Do you see anything in the macro window?

No, I don’t

Make sure you have:

  • all modules installed in Window > Plugin Manager > Modules,
  • the latest version of the scripts: uninstall and reinstall Window > Plugin Manager > Scripts > mekkablue Scripts (scroll all the way to the bottom),
  • Glyphs > Preferences > Addons > Use system console turned OFF.

Still no dice? Watch the Macro Window (Window > Macro Panel) when you run the script, it should show an error message.

All modules are freshly installed, Mekkablue’s scripts also newly installed, Addons as you indicated.

Error message:

Traceback (most recent call last):
  File "Variation", line 221
  File "Variation", line 51, in __init__
AttributeError: 'FloatingWindow' object has no attribute 'glyphname'

Ah, there is a typo. In line 51, the glyphName needs to be camelcased. I’ll fix as soon as I’m back on my Mac.

Sorry for delay, currently in a series of workshops and sessions and cannot always follow up on time with forum and emails.

Thanks! Looking forward to it.

Should be fixed. You can force the update by uninstalling and reinstalling.

It works now. Thanks, thanks, thanks!

1 Like