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.

KeyError: 'glyf' when trying to convert Gilbert font to COLR

See original GitHub issue

Hi,

I wanted to convert the Gilbert font from https://www.typewithpride.com/ to COLRv1 so that it also works in Chrome.

The default file name of Gilbert-Color Bold Preview5.otf seems to fail because of the spaces in the name.

But even after renaming the file, I can’t seem to get it to work with maximum_color /path/to/test.otf:

I0921 12:00:26.850657 139996433276864 maximum_color.py:449] Generating build.ninja
I0921 12:00:27.044305 139996433276864 ninja.py:113] ninja -C /home/lukas/tmp/nanoemoji/build
ninja: Entering directory `/home/lukas/tmp/nanoemoji/build'
[904/906] /home/lukas/.virtualenvs/te...tput_file MergeSource.glyf_colr_1.ttf
W0921 12:01:18.666877 140660174471104 glyph_reuse.py:69] affine_between failed: M505.3699951171875,289.093994140625 L384.42999267578125,289.093994140625 L384.42999267578125,0.1820068359375 L505.3699951171875,0.1820068359375 L505.3699951171875,289.093994140625 M505.3699951171875,698.9450073242188 L384.42999267578125,698.9450073242188 L384.42999267578125,410.03399658203125 L505.3699951171875,410.03399658203125 L505.3699951171875,698.9450073242188 M160.9600067138672,288.7039794921875 L40.02000045776367,288.7039794921875 L40.02000045776367,-0.59100341796875 L160.9600067138672,-0.59100341796875 L160.9600067138672,288.7039794921875 M160.9600067138672,698.9249877929688 L40.02000045776367,698.9249877929688 L40.02000045776367,410.05401611328125 L160.9600067138672,410.05401611328125 L160.9600067138672,698.9249877929688 
[ some more lines like this]
I0921 12:01:25.416941 140660174471104 __init__.py:47] Pre-processing glyphs
I0921 12:01:25.456688 140660174471104 base.py:178] Running DecomposeComponentsFilter on AnEmojiFamily-Regular
I0921 12:01:25.457893 140660174471104 base.py:178] Running CubicToQuadraticFilter on AnEmojiFamily-Regular
I0921 12:01:25.530013 140660174471104 cubicToQuadratic.py:46] New spline lengths: 1: 844, 2: 796, 3: 372, 4: 30, 5: 9
I0921 12:01:25.530156 140660174471104 __init__.py:243] Building OpenType tables
I0921 12:01:25.994717 140660174471104 write_font.py:247] Writing MergeSource.glyf_colr_1.ttf
I0921 12:01:26.125555 140660174471104 write_font.py:833] Wrote MergeSource.glyf_colr_1.ttf
[905/906] /home/lukas/.virtualenvs/te...eep_glyph_names.added_glyf_colr_1.ttf
FAILED: test.keep_glyph_names.added_glyf_colr_1.ttf 
/home/lukas/.virtualenvs/tempenv-512d212064b6f/bin/python -m nanoemoji.glue_together -v 0 --color_table COLR --target_font test.keep_glyph_names.ttf --donor_font MergeSource.glyf_colr_1.ttf --output_file test.keep_glyph_names.added_glyf_colr_1.ttf
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/lukas/.virtualenvs/tempenv-512d212064b6f/lib/python3.10/site-packages/nanoemoji/glue_together.py", line 219, in <module>
    app.run(main)
  File "/home/lukas/.virtualenvs/tempenv-512d212064b6f/lib/python3.10/site-packages/absl/app.py", line 308, in run
    _run_main(main, args)
  File "/home/lukas/.virtualenvs/tempenv-512d212064b6f/lib/python3.10/site-packages/absl/app.py", line 254, in _run_main
    sys.exit(main(argv))
  File "/home/lukas/.virtualenvs/tempenv-512d212064b6f/lib/python3.10/site-packages/nanoemoji/glue_together.py", line 202, in main
    _copy_colr(target, donor)
  File "/home/lukas/.virtualenvs/tempenv-512d212064b6f/lib/python3.10/site-packages/nanoemoji/glue_together.py", line 60, in _copy_colr
    target_glyphs = target["glyf"].glyphs
  File "/home/lukas/.virtualenvs/tempenv-512d212064b6f/lib/python3.10/site-packages/fontTools/ttLib/ttFont.py", line 406, in __getitem__
    table = self._readTable(tag)
  File "/home/lukas/.virtualenvs/tempenv-512d212064b6f/lib/python3.10/site-packages/fontTools/ttLib/ttFont.py", line 413, in _readTable
    data = self.reader[tag]
  File "/home/lukas/.virtualenvs/tempenv-512d212064b6f/lib/python3.10/site-packages/fontTools/ttLib/sfnt.py", line 105, in __getitem__
    entry = self.tables[Tag(tag)]
KeyError: 'glyf'
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "/home/lukas/.virtualenvs/tempenv-512d212064b6f/bin/maximum_color", line 8, in <module>
    sys.exit(main())
  File "/home/lukas/.virtualenvs/tempenv-512d212064b6f/lib/python3.10/site-packages/nanoemoji/maximum_color.py", line 479, in main
    app.run(_run)
  File "/home/lukas/.virtualenvs/tempenv-512d212064b6f/lib/python3.10/site-packages/absl/app.py", line 308, in run
    _run_main(main, args)
  File "/home/lukas/.virtualenvs/tempenv-512d212064b6f/lib/python3.10/site-packages/absl/app.py", line 254, in _run_main
    sys.exit(main(argv))
  File "/home/lukas/.virtualenvs/tempenv-512d212064b6f/lib/python3.10/site-packages/nanoemoji/maximum_color.py", line 474, in _run
    maybe_run_ninja(build_file)
  File "/home/lukas/.virtualenvs/tempenv-512d212064b6f/lib/python3.10/site-packages/nanoemoji/ninja.py", line 114, in maybe_run_ninja
    subprocess.run(ninja_cmd, check=True)
  File "/usr/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-C', '/home/lukas/tmp/nanoemoji/build']' returned non-zero exit status 1.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:18 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
anthrotypecommented, Nov 23, 2022

@Findus23 FYI, I fixed the bug with spaces in filenames #442 and added a --colr_version flag to maximum_color (so one can select version 0 instead of the default version 1) in #443. I filed a separate #444 for tracking support for CFF-flavored OT-SVG, but won’t work on it immediately as there’s the otf2ttf.py workaround.

1reaction
Findus23commented, Sep 21, 2022

Okay, I think I have summarized everything at https://github.com/Findus23/RainbowRoad/tree/main/src/font

Thanks again for all the help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

FAQ — Type With Pride
Beyond their creative qualities, all the characters in the Gilbert Color font feature multi-colored designs, based on a color palette inspired by the...
Read more >
Re: Gilbert color font - Adobe Support Community - 11900289
Illustrator does not support color fonts on the iPad. Only on the desktop version. Illustrator is not the only app on the iPad....
Read more >
Colors and fonts | PyCharm Documentation - JetBrains
Press Ctrl+Alt+S to open the IDE settings and select Editor | Color Scheme | Python. Select any code element you want to customize...
Read more >
SVG color fonts - Pixelmator Community
It should work well with the bright colours in the Gilbert Color font, though. Hold down the Option key if you want to...
Read more >
mozilla-central: pushlog - Mercurial
870ce315712c4484f69ebe14fdc21f826c674d3f, abhinav — Bug 1382184 - Change text color of notification-box to 'theme-toolbar-color'. r=Honza.
Read more >

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