googlefonts / googlefonts/fontmake

Non-existent source layers in DS cause misleading error message

Open
#879 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
888
Forks
97
Avg merge
4d 52m
Merged PRs (30d)
1

Description

This line will blow up if the named layer for a source does not exist:

https://github.com/googlefonts/ufo2ft/blob/15f14d3c623728221feabd743cba41638483e5f8/Lib/ufo2ft/util.py#L47

fontmake will produce this error message:

> fontmake.errors.FontmakeError: In '..\aktiv-grotesk-vf\sources\test_v5_aktiv.designspace': Generating fonts from Designspace failed: '{126,100,0}'

which is a bit terse. Traceback:

```
Traceback (most recent call last):
File "c:\...\fontmake\lib\fontmake\font_project.py", line 1057, in run_from_designspace
self._run_from_designspace_interpolatable(
File "c:\...\fontmake\lib\fontmake\font_project.py", line 1147, in _run_from_designspace_interpolatable
self.build_variable_fonts(
File "c:\...\fontmake\lib\fontmake\font_project.py", line 378, in build_variable_fonts
fonts = ufo2ft.compileVariableTTFs(
File "c:\...\ufo2ft\lib\ufo2ft\__init__.py", line 588, in compileVariableTTFs
vfNameToBaseUfo = _compileNeededSources(
File "c:\...\ufo2ft\lib\ufo2ft\__init__.py", line 774, in _compileNeededSources
ttfDesignSpace = compileInterpolatableFunc(
File "c:\...\ufo2ft\lib\ufo2ft\__init__.py", line 378, in compileInterpolatableTTFsFromDS
for source, ttf in zip(result.sources, ttfs):
File "c:\...\ufo2ft\lib\ufo2ft\__init__.py", line 291, in compileInterpolatableTTFs
glyphSets = call_preprocessor(ufos, **kwargs)
File "c:\...\ufo2ft\lib\ufo2ft\__init__.py", line 63, in call_preprocessor
preProcessor = preProcessorClass(
File "c:\...\ufo2ft\lib\ufo2ft\preProcessor.py", line 280, in __init__
self.glyphSets = [
File "c:\...\ufo2ft\lib\ufo2ft\preProcessor.py", line 281, in
_GlyphSet.from_layer(
File "c:\...\ufo2ft\lib\ufo2ft\util.py", line 49, in from_layer
layer = font.layers[layerName]
File "C:\...\fontmake\.venv\lib\site-packages\ufoLib2\objects\layerSet.py", line 227, in __getitem__
layer_object = self._layers[name]
```

I wonder at which level of the stack we should catch this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.