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

Generating fonts from Designspace failed: list index out of range (encore) #1143

Open
driehuis opened this issue Jan 29, 2025 · 0 comments
Open

Comments

@driehuis
Copy link

Just like in #1071, the OpenType build of DINish fails, where the TrueType build from the same sources succeeds:

$ fontmake --verbose DEBUG --validate-ufo --flatten-components DINish-Variable.designspace -o variable-cff2
[...]
INFO:fontTools.varLib:Generating HVAR
ERROR:root:In 'DINish-Variable.designspace': Generating fonts from Designspace failed: list index out of range

I tried throwing in --validate-ufo and --verbose DEBUG, but unlike in #1071, this did not produce a light bulb moment.

I've attached the log.

The traceback looks like this:

Traceback (most recent call last):
  File "/home/bert/.venv/dinish-tools/lib/python3.10/site-packages/fontmake/font_project.py", line 1208, in run_from_designspace
    self._run_from_designspace_interpolatable(
  File "/home/bert/.venv/dinish-tools/lib/python3.10/site-packages/fontmake/font_project.py", line 1326, in _run_from_designspace_interpolatable
    self.build_variable_fonts(
  File "/home/bert/.venv/dinish-tools/lib/python3.10/site-packages/fontmake/font_project.py", line 470, in build_variable_fonts
    fonts = ufo2ft.compileVariableCFF2s(
  File "/home/bert/.venv/dinish-tools/lib/python3.10/site-packages/ufo2ft/__init__.py", line 295, in compileVariableCFF2s
    return VariableCFF2sCompiler(**kwargs).compile_variable(designSpaceDoc)
  File "/home/bert/.venv/dinish-tools/lib/python3.10/site-packages/ufo2ft/_compilers/baseCompiler.py", line 420, in compile_variable
    vfNameToTTFont = self._merge(designSpaceDoc, excludeVariationTables)
  File "/home/bert/.venv/dinish-tools/lib/python3.10/site-packages/ufo2ft/_compilers/interpolatableOTFCompiler.py", line 32, in _merge
    return varLib.build_many(
  File "/home/bert/.venv/dinish-tools/lib/python3.10/site-packages/fontTools/varLib/__init__.py", line 1141, in build_many
    vf = build(
  File "/home/bert/.venv/dinish-tools/lib/python3.10/site-packages/fontTools/varLib/__init__.py", line 1241, in build
    _add_CFF2(vf, model, master_fonts)
  File "/home/bert/.venv/dinish-tools/lib/python3.10/site-packages/fontTools/varLib/__init__.py", line 869, in _add_CFF2
    merge_region_fonts(varFont, model, ordered_fonts_list, glyphOrder)
  File "/home/bert/.venv/dinish-tools/lib/python3.10/site-packages/fontTools/varLib/cff.py", line 266, in merge_region_fonts
    cvData = merge_charstrings(glyphOrder, num_masters, top_dicts, model)
  File "/home/bert/.venv/dinish-tools/lib/python3.10/site-packages/fontTools/varLib/cff.py", line 335, in merge_charstrings
    region_charstring.draw(var_pen)
  File "/home/bert/.venv/dinish-tools/lib/python3.10/site-packages/fontTools/misc/psCharStrings.py", line 1168, in draw
    extractor.execute(self)
  File "/home/bert/.venv/dinish-tools/lib/python3.10/site-packages/fontTools/misc/psCharStrings.py", line 636, in execute
    super().execute(charString)
  File "/home/bert/.venv/dinish-tools/lib/python3.10/site-packages/fontTools/misc/psCharStrings.py", line 360, in execute
    rv = handler(index)
  File "/home/bert/.venv/dinish-tools/lib/python3.10/site-packages/fontTools/misc/psCharStrings.py", line 727, in op_rlineto
    self.rLineTo(point)
  File "/home/bert/.venv/dinish-tools/lib/python3.10/site-packages/fontTools/misc/psCharStrings.py", line 654, in rLineTo
    self.pen.lineTo(self._nextPoint(point))
  File "/home/bert/.venv/dinish-tools/lib/python3.10/site-packages/fontTools/pens/basePen.py", line 328, in lineTo
    self._lineTo(pt)
  File "/home/bert/.venv/dinish-tools/lib/python3.10/site-packages/fontTools/varLib/cff.py", line 538, in _lineTo
    self.add_point("rlineto", pt_coords)
  File "/home/bert/.venv/dinish-tools/lib/python3.10/site-packages/fontTools/varLib/cff.py", line 488, in add_point
    cmd = self._commands[self.pt_index]
IndexError: list index out of range

Issue reproduces after updating to today's fontmake and fonttools. I tried reading the source code and even digging in with pdb, but this is way over my head...

The issue raised its head after I made extensive changes to the font, including rewriting the designspace from scratch. As I also struggled with toolchain updates in the meantime it is very hard for me to pin the issue on a particular change. Do the traceback or the log give any indication of where I could start looking? Is there any other diagnostic that could turn up the source of the issue?

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