You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
However, when I run it, I get the following traceback:
Traceback (most recent call last): File "/Users/stephennixon/type-repos/VintageVoyageDesign/../font-tools/set-glyphs-italic-angle.py", line 37, in <module> main() File "/Users/stephennixon/type-repos/VintageVoyageDesign/../font-tools/set-glyphs-italic-angle.py", line 29, in main master.italicAngle = angle ^^^^^^^^^^^^^^^^^^ File "/Users/stephennixon/.pyenv/versions/3.11.3/lib/python3.11/site-packages/glyphsLib/classes.py", line 1907, in italicAngle self._set_metric("italic angle", value) File "/Users/stephennixon/.pyenv/versions/3.11.3/lib/python3.11/site-packages/glyphsLib/classes.py", line 1782, in _set_metric metricIndex = metricLabels.index(metricname) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ValueError: 'italic angle' is not in list
This is surprising, as it looks like glyphsLib does try to add a metric if it doesn’t yet exist:
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!
The text was updated successfully, but these errors were encountered:
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)
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:
glyphsLib/Lib/glyphsLib/classes.py
Lines 1780 to 1782 in e2ebf5b
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!
The text was updated successfully, but these errors were encountered: