Open arrowtype opened 2 months ago
looks like a bug:
metricLabels = [x.type for x in metrics]
if metricname not in metricLabels:
self.font.metrics.append(GSMetric(type=metricname))
+ metricLabels.append(metricname)
metricIndex = metricLabels.index(metricname)
This is working in the Glyphs3 branch.
I’m attempting to use glyphsLib to set the Italic Angle in masters of a Glyphs source. It seems to work if that metric is already in the masters, but it fails to add it if it doesn’t yet exist.
My code is basically this:
However, when I run it, I get the following traceback:
This is surprising, as it looks like glyphsLib does try to add a metric if it doesn’t yet exist:
https://github.com/googlefonts/glyphsLib/blob/e2ebf5b517d59bec0c9437da3a748c58f2999911/Lib/glyphsLib/classes.py#L1780-L1782
If I manually add the "Italic Angle" metric using the GlyphsApp UI, the script then does work, but this then defeats the purpose of the script.
Am I doing something wrong? E.g. is it intended that my glyphsLib script should be adding that metric if it doesn’t yet exist? Or, am I interpreting it correctly that glyphsLib is trying but failing to add it, for some reason?
Thanks so much for taking a look and sharing any insights here!