Interpolation through scripting

Is there an easy way to interpolate two glyph layers by scripting?
I’m trying to do something similar to Impallari’s Simplepolator. It interpolates two selected glyphs and generate x new glyphs with each instance.


Yes it is, but why?

You can do individual Foreground/Background interpolation with Filter > Transformation > Background (no need for keeping two different glyphs compatible).

If you still want to do it, you simply:

  1. check if the two layers you want to interpolate are compatible with thisLayer.compareString()
  2. step through the range of path and node indices, and calculate a new node coordinate by node1.x + node2.x * factor, where factor steps between 0.0 and 1.0; then append the new GSNodes to the new GSPaths, and in turn those GSPaths to the respective layer of the new GSGlyphs.

Feel free to take a peek in my scripts on

The reason is I need to automatically generate a set of glyphs (from two original compatible glyphs or foreground/background) with different shape length and a different suffix with a value number, and I need to interpolate them. Doing a script like Simplepolator is exactly what I needed. Foreground/Background interpolation is great (and it is what I used to now) but still needs manual input for each instance. The idea was to do it to generate devanagari iMatra variation (about 20 different lenghts in each master) automatically, with the correct glyph names, different component generation and feature output.

Thanks for your clear explanation and your work.
I always have your Glyphs-scripts up to date :slight_smile:

Sorry, I made a mistake. It should read:
interpolatedX = node1.x * (1.0-factor) + node2.x * factor
interpolatedY = node1.y * (1.0-factor) + node2.y * factor

In short, node1 needs to multiplied as well.

Look for Masters > Variation Interpolator.

Creates a user-defined number of glyph variations with a user-defined suffix, containing interpolations between the layers and their respective backgrounds. Overwrites glyphs with same name. Needs Vanilla (see Readme for installation instructions).

Absolutely great!