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.

error when generating gvar from TTFs with different glyph names

See original GitHub issue

I just got this new error which I haven’t seen before. I have successfully generated many variable fonts already by first generating interpolatable ttfs and then running python /~username/env/lib/python2.7/site-packages/FontTools/fontTools/varLib/init.py path/to/mydesignspacefile.designspace

This time I was able to generate the interpolatable ttfs. But then when I ran the command above I got this error:

Generating gvar
Traceback (most recent call last):
  File "/Users/cjdunn/env/lib/python2.7/site-packages/FontTools/fontTools/varLib/__init__.py", line 562, in <module>
    main()
  File "/Users/cjdunn/env/lib/python2.7/site-packages/FontTools/fontTools/varLib/__init__.py", line 553, in main
    _add_gvar(gx, axes, master_fonts, master_locs, base_idx)
  File "/Users/cjdunn/env/lib/python2.7/site-packages/FontTools/fontTools/varLib/__init__.py", line 445, in _add_gvar
    allCoords = [d[0] for d in allData]
TypeError: 'NoneType' object has no attribute '__getitem__'

This is the line the error refers to in init.py:

    for glyph in font.getGlyphOrder():

        allData = [_GetCoordinates(m, glyph) for m in master_ttfs]
        allCoords = [d[0] for d in allData]

looks like it’s looping through all of the glyphs, but I’m not sure what the TypeError: ‘NoneType’ is referring to. @behdad @jamesgk Any ideas what the problem could be? Thank you.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
cjdunncommented, Oct 12, 2016

My vote would be: –try interpolating based on glyph name –skip the glyphs that don’t interpolate (and report them) –use the unicodes in the ‘base’ master if there’s ever a conflict.

This is basically what Superpolator does: if something isn’t perfect in all masters you just get the base master glyph or a weird interpolation (depending what’s wrong), but it doesn’t stop the whole process. This is very handy for early development/testing when you only care about certain glyphs, and don’t care if others fail. As long as they are reported it’s fine, and you can fix them later. Alternatively, you could have options for “ignore errors” vs “stop for errors” so the first option is for development and the second option is for final production.

0reactions
cjdunncommented, Oct 12, 2016

Sounds good. If fontmake had an option to ignore errors that would be great, I’ll post an issue.

And perhaps varLib could have an option to ignore errors too so if you have compatible glyphs in 2 out of 3 masters then those ones would work. Again, this would only be meant for early dev/testing, not final production. Does that make sense at all?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working with Font Variations - FontLab Help Center
Choose Empty master to create an empty font master with no glyph layers, no kerning classes and no kerning pairs. The Copy from...
Read more >
fonttools/__init__.py at main - GitHub
Module for dealing with 'gvar'-style font variations, also known as run-time ... Such ttf-interpolatable and designspace files can be generated from.
Read more >
fonttools [python-library] - Occam :: Details
[feaLib] Fixed bug with mixed single/multiple substitutions. If a single substitution involved a glyph class, we were incorrectly using only the first glyph...
Read more >
Source code for fontTools.varLib - Read the Docs
Such ttf-interpolatable and designspace files can be generated from a Glyphs ... from typing import List from fontTools.misc.vector import Vector from ...
Read more >
Character to Glyph Mapping Table - Apple Developer
A font intended to run on multiple platforms with different encoding conventions will require multiple encoding tables. As a result, the 'cmap' table...
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