googlefonts / gftools

Misc tools for working with the Google Fonts library
Apache License 2.0
243 stars 70 forks source link

Error building COLR v0 OTF font #1028

Open gredler opened 2 months ago

gredler commented 2 months ago

The changes in #610 assume that the font has a "glyf" table, which OTF fonts do not.

gftools builder sources/config.yaml

[...]

[42/60] fix
FAILED: ../fonts/otf/MyFont-ExtraBold.otf 
/home/user/myfont/.venv/bin/python3 -m gftools.builder.jobrunner gftools-fix-font -o ../fonts/otf/MyFont-ExtraBold.otf  /tmp/tmpf2k52f6_ 

Command failed:
gftools-fix-font -o ../fonts/otf/MyFont-ExtraBold.otf /tmp/tmpf2k52f6_

INFO:gftools.fix:Updated license strings
INFO:gftools.fix:Added GASP and prep tables for unhinted font
Traceback (most recent call last):
  File "/home/user/myfont/.venv/bin/gftools-fix-font", line 8, in <module>
    sys.exit(main())
  File "/home/user/myfont/.venv/lib/python3.10/site-packages/gftools/scripts/fix_font.py", line 50, in main
    font = fix_font(font, args.include_source_fixes, args.rename_family, axis_dflts)
  File "/home/user/myfont/.venv/lib/python3.10/site-packages/gftools/fix.py", line 914, in fix_font
    result = fixer(fixed_font)
  File "/home/user/myfont/.venv/lib/python3.10/site-packages/gftools/fix.py", line 808, in fix_colr_font
    return fix_colr_v0_gid1(ttfont)
  File "/home/user/myfont/.venv/lib/python3.10/site-packages/gftools/fix.py", line 702, in fix_colr_v0_gid1
    glyf_table = ttfont["glyf"]
  File "/home/user/myfont/.venv/lib/python3.10/site-packages/fontTools/ttLib/ttFont.py", line 455, in __getitem__
    table = self._readTable(tag)
  File "/home/user/myfont/.venv/lib/python3.10/site-packages/fontTools/ttLib/ttFont.py", line 462, in _readTable
    data = self.reader[tag]
  File "/home/user/myfont/.venv/lib/python3.10/site-packages/fontTools/ttLib/sfnt.py", line 108, in __getitem__
    entry = self.tables[Tag(tag)]
KeyError: 'glyf'
gredler commented 2 months ago

Is there a way to configure the tool to skip some fixes (like this one)?