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

Crash in _deep_copy_contours when a glyph includes a non-existent component #411

Closed
belluzj opened this issue Mar 30, 2018 · 3 comments
Closed

Comments

@belluzj
Copy link
Collaborator

belluzj commented Mar 30, 2018

I had this problem while building a Glyphs font with fontmake -g XXXX.glyphs -i. The test font happens to have glyphs that point to non existent components. This crash happens now that googlefonts/glyphsLib#317 has been fixed in googlefonts/glyphsLib#329. glyphsLib warns about the problem as such:

INFO:fontmake.font_project:Building master UFOs and designspace from Glyphs source
INFO:glyphsLib.classes:Parsing "../../../Downloads/XXXX.glyphs" file into <GSFont>
WARNING:glyphsLib.builder.builders.UFOBuilder:Anchors not propagated for inexistent component circumflexcomb_acutecomb in glyph acircumflexacute

Now that glyphsLib does not crash anymore on references to undefined components, fontmake does, here:

https://github.com/googlei18n/fontmake/blob/aa412a101e4258c4e6da21c95556607ae03df8ec/Lib/fontmake/font_project.py#L132

I'm not actually sure we want to "fix" this by not crashing, because it means the font is at least partially broken, but maybe the error message from fontmake could be a bit better. Currently for example:

INFO:fontmake.font_project:Decomposing glyphs for XXXX-Regular
Traceback (most recent call last):
  File "c:\python27\Lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\Lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\UsersLocal\jany.belluz\Documents\venvs\glyphs\Scripts\fontmake.exe\__main__.py", line 9, in <module>
  File "c:\userslocal\jany.belluz\documents\venvs\glyphs\lib\site-packages\fontmake\__main__.py", line 186, in main
    project.run_from_glyphs(glyphs_path, **args)
  File "c:\userslocal\jany.belluz\documents\venvs\glyphs\lib\site-packages\fontmake\font_project.py", line 369, in run_from_glyphs
    designspace_path, instance_data=instance_data, **kwargs)
  File "c:\userslocal\jany.belluz\documents\venvs\glyphs\lib\site-packages\fontmake\font_project.py", line 437, in run_from_designspace
    interpolate_layout_from=interpolate_layout_from, **kwargs)
  File "c:\userslocal\jany.belluz\documents\venvs\glyphs\lib\site-packages\fontmake\font_project.py", line 476, in run_from_ufos
    ufos, remove_overlaps, **kwargs)
  File "c:\userslocal\jany.belluz\documents\venvs\glyphs\lib\site-packages\fontmake\font_project.py", line 166, in build_otfs
    self.decompose_glyphs(ufos)
  File "c:\userslocal\jany.belluz\documents\venvs\glyphs\lib\site-packages\fontTools\misc\loggingTools.py", line 372, in wrapper
    return func(*args, **kwds)
  File "c:\userslocal\jany.belluz\documents\venvs\glyphs\lib\site-packages\fontmake\font_project.py", line 124, in decompose_glyphs
    self._deep_copy_contours(ufo, glyph, glyph, Transform())
  File "c:\userslocal\jany.belluz\documents\venvs\glyphs\lib\site-packages\fontmake\font_project.py", line 132, in _deep_copy_contours
    ufo, parent, ufo[nested.baseGlyph],
  File "build\bdist.win32\egg\defcon\objects\font.py", line 219, in __getitem__
  File "build\bdist.win32\egg\defcon\objects\layer.py", line 261, in __getitem__
  File "build\bdist.win32\egg\defcon\objects\layer.py", line 178, in loadGlyph
KeyError: 'circumflexcomb_acutecomb not in layer'

Or does it make sense to build such a font anyway? Like, skip decomposing those glyphs?

@anthrotype
Copy link
Member

skip and warn should be fine I think. Does Glyphs.app complain?

@anthrotype
Copy link
Member

just tried to export the file Marc sent from within Glyphs.app. I can see the missing components are simply (silently) dropped.

@anthrotype
Copy link
Member

this should now be fixed in ufo2ft 2.0 and fontTools 3.27.1

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

2 participants