Interpolate layer with script

Hello. I would like to learn how to interpolate the currently selected layer (or any layer, for that matter) with a given factor. The core documentation seems to be missing almost every method to do with this. With Rainer’s method reporter, I can find methods for class GSGlyph such as interpolate_, interpolate_masters_decompose_error_, etc., but I can’t figure out how to use them. How do I use interpolate_? I tried passing a dict with various keys/values, but the function always returned None.


I am trying to find a way to interpolate the current layer using GSGlyph.interpolate_keepSmart_error_. The problem is that changing the current layer changes the interpolation source. So I want to create a “backup source” from which I can interpolate. Meaning, instead of setting the font for my interpolation instance to the current font, I make a backup of the current font beforehand.

I tried the following:

interpolation_instance = GSInstance()
interpolation_instance.font = Font.copy()
interpolation_instance.axes = [100]

But this crashes Glyphs. Even putting it into a try/except.

You will find sample code in some of my scripts, e.g. the Kink Finder.

Thank you. I had looked at the Variation Interpolator, but that didn’t quite work in my case. I’ll have a look at the Kink Finder :slight_smile:

1 Like