Best way to get interpolated paths for a glyph?

Hello, let’s say I have two masters with weights 40 and 200.

I have an a and would like to get the Bézier paths for, let’s say, wght=100. And for wght=150. In fact, I would like to get them for any axis location as quickly as possible.

According to the Python API doc, I could use GSInstance.interpolatedFontProxy(), which “only interpolates the glyphs you ask it for”. I haven’t been able to figure out how to use this.

Another option is to make an intermediate layer, update its axis coordinates and re-interpolate it every time.

Both methods don’t seem very efficient. Is there some other way, or do I need to write my own interpolation function? Some guidance on how to achieve this would be much appreciated.


inst = GSInstance()
inst.font = Font
axis = Font.axes[0]
inst.internalAxesValues[axis.axisId] = 600

proxy = inst.interpolatedFontProxy
g = proxy.glyphs["H"]
l = g.layers[proxy.fontMaster().id]
1 Like


Is that faster than generating an intermediate layer, updating its coordinates a hundred times, re-interpolating it every time and getting the paths from there?

Not sure. You can try.

With 100 steps, I found:

With your method above:

  1. Initiate a GSInstance
  2. Set new axis values 100 times
  3. Get an interpolatedFontProxy each time, get layers from there

Time: 7.5s

Other method:

  1. Add a proxy glyph to the font
  2. Add an intermediate layer
  3. Set new axis coordinates 100 times
  4. Get layer from the re-interpolated intermediate layer each time
  5. Delete the proxy glyph

Time: 5.6s

Just for reference.

Could you wrap your code in this:

import cProfile, pstats, io
from pstats import SortKey
pr = cProfile.Profile()

# Put your code here

s = io.StringIO()
sortby = SortKey.CUMULATIVE
ps = pstats.Stats(pr, stream=s).sort_stats(sortby)

And post the result.

Or send me the code that I can run this (I might need to run the profiler in Glyphs itself