Copy of GSInstance

Hi,

I am not sure if this is a bug or I am doing something wrong. When I create a copy of an instance from my font the “Internalaxes” values are not copied. Here is the script and below is the output

from GlyphsApp import *
font = Glyphs.font
print('Original axes: ',font.instances[3].internalAxesValues)
instance_copy = font.instances[3].copy()
print('Copy axes: ',instance_copy.internalAxesValues)

Output:

Original axes:  (
	300.0,
	0.0,
	600.0,
	100.0
)
Copy axes:  ()

Any help much appreciated!

You need to add the axis to a font in order for it to return the correct values. So, in your case, append it to Font.instances with a simple .append(instance_copy). Don’t forget to remove it again afterwards.

Not on my Mac right now, but IIRC you can also do it the other way around. Something like instance.font=myFont. YMMV. This way you don’t compromise the instances of the font.