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
inst.internalAxesValues[axis.axisId] = 600
proxy = inst.interpolatedFontProxy
g = proxy.glyphs["H"]
l = g.layers[proxy.fontMaster().id]
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?
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