Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Rename Glyphs" causes crash in glyphsLib.builder.instances #1043

Open
simoncozens opened this issue Nov 6, 2024 · 0 comments
Open

"Rename Glyphs" causes crash in glyphsLib.builder.instances #1043

simoncozens opened this issue Nov 6, 2024 · 0 comments

Comments

@simoncozens
Copy link
Collaborator

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:

# to_ufo_custom_params() wants a UFO, create a dummy one
ufo = self.ufo_module.Font()
to_ufo_custom_params(self, ufo, instance, set_default_params=False)

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'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant