I’m writing a script to create an instance and access its kerning through interpolatedFont.
My issue is that interpolatedFont.kerning returns an empty dict. If I go to the actual instances panel, select the created instance once and run the script again, it’s now working and returns a valid dict with all the pairs.
Basically it happens if there are already existing instances (active or not).
If I reduce code to a minimum:
master = font.selectedFontMaster font.instances.append(GSInstance()) instance = font.instances[-1] instance.name = master.name instance.axes = master.axes instance.customParameters['Disable Masters'] = master.name print instance.interpolatedFont.kerning
This is working if there are no previously set instances, but will return an empty dict if not (until I go to the instance panel, select the new instance once, and run the script again — minus the append line).
Is this because of the way I’m accessing the instance by index?