arrowtype / recursive

Recursive Mono & Sans is a variable font family for code & UI
https://recursive.design
SIL Open Font License 1.1
3.29k stars 53 forks source link

FontTools on generating HVAR table: KeyError: 'XPRN' #141

Closed thundernixon closed 5 years ago

thundernixon commented 5 years ago

The HVAR table describes horizontal variations, so it makes sense that it is being tripped up by the proportional side of this family.

INFO:fontTools.varLib:Generating HVAR
INFO:fontTools.varLib:Merging OpenType Layout tables
[{'wght': -1.0, 'XPRN': 1.0}, {'slnt': -1.0, 'XPRN': 1.0}, {'wght': -1.0}, {'slnt': -1.0}, {}, {'wght': 1.0}]
[{'wght': -1.0, 'XPRN': 1.0}, {'slnt': -1.0, 'XPRN': 1.0}, {'wght': -1.0}, {'slnt': -1.0}, {}, {'wght': 1.0}]
Traceback (most recent call last):
  File "/Users/stephennixon/type-repos/recursive/venv/bin/fontmake", line 10, in <module>
    sys.exit(main())
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontmake/__main__.py", line 407, in main
    project.run_from_designspace(designspace_path, **args)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontmake/font_project.py", line 914, in run_from_designspace
    **kwargs
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontmake/font_project.py", line 969, in _run_from_designspace_interpolatable
    designspace, output_path=output_path, output_dir=output_dir, **kwargs
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontmake/font_project.py", line 411, in build_variable_font
    inplace=True,
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/ufo2ft/__init__.py", line 548, in compileVariableTTF
    ttfDesignSpace, exclude=excludeVariationTables, optimize=optimizeGvar
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/__init__.py", line 864, in build
    _merge_OTL(vf, model, master_fonts, axisTags)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/__init__.py", line 591, in _merge_OTL
    merger.mergeTables(font, master_fonts, ['GSUB', 'GDEF', 'GPOS'])
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 111, in mergeTables
    for m in master_ttfs])
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 998, in mergeThings
    model, lst = masterModel.getSubModel(lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/models.py", line 224, in getSubModel
    subModel = VariationModel(subList(key, self.origLocations), self.axisOrder)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/models.py", line 209, in __init__
    self.locations = sorted(locations, key=keyFunc)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/models.py", line 252, in key
    onPointAxes = [axis for axis,value in loc.items() if value in axisPoints[axis]]
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/models.py", line 252, in <listcomp>
    onPointAxes = [axis for axis,value in loc.items() if value in axisPoints[axis]]
KeyError: 'XPRN'

I've made src/build-scripts/remove-kerning-groups-ufos.sh to quickly remove kerning out of a folder of UFOs.

And that did it! The font is now building. ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰

thundernixon commented 5 years ago

I've run into a similar problem before: every UFO needs kerning if any of them have kerning.

I'll need to make a script to add blank kerning if none exists.