"Rename Glyphs" causes crash in glyphsLib.builder.instances
Opened this issue · 0 comments
simoncozens commented
I'm trying to build a variable font setting which has a Rename Glyphs
custom parameter. This causes us to go down the _to_designspace_varfont
code path, which does this:
glyphsLib/Lib/glyphsLib/builder/instances.py
Lines 93 to 95 in 050ef62
When processing custom parameters on this new, empty UFO, glyphsLib tries to process the Rename Glyphs
custom parameter by swapping the glyph assignments around, but of course there are no glyphs in the font, so we get a KeyError
and a crash:
line 95, in _to_designspace_varfont
to_ufo_custom_params(self, ufo, instance, set_default_params=False)
File "/Users/simon/others-repos/glyphsLib/Lib/glyphsLib/builder/custom_params.py", line 1112, in to_ufo_custom_params
handler.to_ufo(self, glyphs_proxy, ufo_proxy)
File "/Users/simon/others-repos/glyphsLib/Lib/glyphsLib/builder/custom_params.py", line 1072, in to_ufo
ufo[newname], ufo[oldname] = ufo[oldname], ufo[newname]
~~~^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/ufoLib2/objects/font.py", line 240, in __getitem__
return self.layers._defaultLayer[name]
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/ufoLib2/objects/layer.py", line 189, in __getitem__
glyph_object = self._glyphs[name]
~~~~~~~~~~~~^^^^^^
KeyError: 'A.ss02'