I can make a new master with a weightValue
with:
f = Glyphs.font
newMaster = f.masters[0].copy()
f.masters.append(newMaster)
…then separately, I can copy some of the glyphs with:
f = Glyphs.font
import copy
for glyph in f.glyphs:
glyph.layers[-1] = glyph.layers[0].copy()
if len(glyph.layers[0].components) > 0:
glyph.layers[-1].components = copy.copy(glyph.layers[0].components)
glyph.layers[-1].reinterpolate()
But somehow, these don’t work the same when run in the same script. Also, glyphs stop copying at l
, don’t copy components, and I get this error:
Traceback (most recent call last):
File "<string>", line 6, in <module>
File "GlyphsApp/GlyphsApp/__init__.py", line 2002, in __setitem__
AttributeError: 'NoneType' object has no attribute 'id'
I may come back to this later. Thanks for any pointers in the meantime, if you see how I can make this work better!