question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

version 4.35.0 breaks our tests in gftools

See original GitHub issue

v4.35.0 breaks two of our builder checks, https://github.com/googlefonts/gftools/runs/7839959593?check_suite_focus=true#step:5:186. Here’s the traceback

ERROR:root:In 'Lora.glyphs' -> 'master_ufo/Lora.designspace': Generating fonts from Designspace failed: <fontTools.feaLib.ast.GlyphName object at 0x108267610>
Traceback (most recent call last):
  File "/Users/marcfoley/Type/fonttools/venv/lib/python3.10/site-packages/fontmake/font_project.py", line 1065, in run_from_designspace
    self._run_from_designspace_interpolatable(
  File "/Users/marcfoley/Type/fonttools/venv/lib/python3.10/site-packages/fontmake/font_project.py", line 1157, in _run_from_designspace_interpolatable
    self.build_variable_fonts(
  File "/Users/marcfoley/Type/fonttools/venv/lib/python3.10/site-packages/fontmake/font_project.py", line 384, in build_variable_fonts
    fonts = ufo2ft.compileVariableTTFs(
  File "/Users/marcfoley/Type/fonttools/venv/lib/python3.10/site-packages/ufo2ft/__init__.py", line 596, in compileVariableTTFs
    vfNameToBaseUfo = _compileNeededSources(
  File "/Users/marcfoley/Type/fonttools/venv/lib/python3.10/site-packages/ufo2ft/__init__.py", line 785, in _compileNeededSources
    ttfDesignSpace = compileInterpolatableFunc(
  File "/Users/marcfoley/Type/fonttools/venv/lib/python3.10/site-packages/ufo2ft/__init__.py", line 384, in compileInterpolatableTTFsFromDS
    for source, ttf in zip(result.sources, ttfs):
  File "/Users/marcfoley/Type/fonttools/venv/lib/python3.10/site-packages/ufo2ft/__init__.py", line 318, in compileInterpolatableTTFs
    compileFeatures(ufo, ttf, glyphSet=glyphSet, **kwargs)
  File "/Users/marcfoley/Type/fonttools/venv/lib/python3.10/site-packages/ufo2ft/__init__.py", line 507, in compileFeatures
    otFont = featureCompiler.compile()
  File "/Users/marcfoley/Type/fonttools/venv/lib/python3.10/site-packages/ufo2ft/featureCompiler.py", line 127, in compile
    self.setupFeatures()
  File "/Users/marcfoley/Type/fonttools/venv/lib/python3.10/site-packages/ufo2ft/featureCompiler.py", line 265, in setupFeatures
    writer.write(self.ufo, featureFile, compiler=self)
  File "/Users/marcfoley/Type/fonttools/venv/lib/python3.10/site-packages/ufo2ft/featureWriters/baseFeatureWriter.py", line 131, in write
    return self._write()
  File "/Users/marcfoley/Type/fonttools/venv/lib/python3.10/site-packages/ufo2ft/featureWriters/cursFeatureWriter.py", line 119, in _write
    feature = self._makeCursiveFeature()
  File "/Users/marcfoley/Type/fonttools/venv/lib/python3.10/site-packages/ufo2ft/featureWriters/cursFeatureWriter.py", line 26, in _makeCursiveFeature
    gsub = self.compileGSUB()
  File "/Users/marcfoley/Type/fonttools/venv/lib/python3.10/site-packages/ufo2ft/featureWriters/baseFeatureWriter.py", line 321, in compileGSUB
    gsub = compileGSUB(self.context.feaFile, glyphOrder)
  File "/Users/marcfoley/Type/fonttools/venv/lib/python3.10/site-packages/ufo2ft/util.py", line 230, in compileGSUB
    addOpenTypeFeatures(font, featureFile, tables={"GSUB"})
  File "/Users/marcfoley/Type/fonttools/Lib/fontTools/feaLib/builder.py", line 64, in addOpenTypeFeatures
    builder.build(tables=tables, debug=debug)
  File "/Users/marcfoley/Type/fonttools/Lib/fontTools/feaLib/builder.py", line 227, in build
    gdef = self.buildGDEF()  # build unconditionally so we can warn below
  File "/Users/marcfoley/Type/fonttools/Lib/fontTools/feaLib/builder.py", line 763, in buildGDEF
    gdef.MarkGlyphSetsDef = self.buildGDEFMarkGlyphSetsDef_()
  File "/Users/marcfoley/Type/fonttools/Lib/fontTools/feaLib/builder.py", line 822, in buildGDEFMarkGlyphSetsDef_
    return otl.buildMarkGlyphSetsDef(sets, self.glyphMap)
  File "/Users/marcfoley/Type/fonttools/Lib/fontTools/otlLib/builder.py", line 2618, in buildMarkGlyphSetsDef
    self.Coverage = [buildCoverage(m, glyphMap) for m in markSets]
  File "/Users/marcfoley/Type/fonttools/Lib/fontTools/otlLib/builder.py", line 2618, in <listcomp>
    self.Coverage = [buildCoverage(m, glyphMap) for m in markSets]
  File "/Users/marcfoley/Type/fonttools/Lib/fontTools/otlLib/builder.py", line 58, in buildCoverage
    self.glyphs = sorted(set(glyphs), key=glyphMap.__getitem__)
KeyError: <fontTools.feaLib.ast.GlyphName object at 0x108267610>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/marcfoley/Type/fonttools/venv/lib/python3.10/site-packages/fontmake/__main__.py", line 620, in main
    project.run_from_glyphs(inputs.glyphs_path, **args)
  File "/Users/marcfoley/Type/fonttools/venv/lib/python3.10/site-packages/fontmake/font_project.py", line 787, in run_from_glyphs
    self.run_from_designspace(designspace_path, **kwargs)
  File "/Users/marcfoley/Type/fonttools/venv/lib/python3.10/site-packages/fontmake/font_project.py", line 1080, in run_from_designspace
    raise FontmakeError(
fontmake.errors.FontmakeError: In 'Lora.glyphs' -> 'master_ufo/Lora.designspace': Generating fonts from Designspace failed: <fontTools.feaLib.ast.GlyphName object at 0x108267610>

I’ve narrowed it down to commit https://github.com/fonttools/fonttools/commit/e4c5c842f1638c2debd801ebc35cafd8a0e346fe.

To replicate, download the attached file and do: fontmake -g Lora.glyphs -o variable

Lora.glyphs.zip

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
simoncozenscommented, Aug 17, 2022

Turns out the fix is obvious, once you have a type checker. 😃

diff --git a/Lib/fontTools/feaLib/parser.py b/Lib/fontTools/feaLib/parser.py
index cd59e48fe..eb1e5fd2f 100644
--- a/Lib/fontTools/feaLib/parser.py
+++ b/Lib/fontTools/feaLib/parser.py
@@ -936,7 +936,7 @@ class Parser(object):
                     raise FeatureLibError("Empty class in replacement", location)
             return self.ast.MultipleSubstStatement(
                 old_prefix,
-                tuple(old[0].glyphSet())[0],
+                self.ast.GlyphName(tuple(old[0].glyphSet())[0]),
                 old_suffix,
                 tuple([list(n.glyphSet())[0] for n in new]),
                 forceChain=hasMarks,

I’ll include this in the upcoming Big Type-Checking PR.

0reactions
simoncozenscommented, Aug 16, 2022

This is a typing problem in ast.py/parser.py. I’ve tracked it down but the fix is less obvious.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found