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 decompiling OTL tables when CFF glyph names contain duplicates

See original GitHub issue

Thank you guys for developing this great tool and made it Open Source! Even if I rarely have issues with pyftsubset, it failed while creating a subset of the italic and bold-italic variant of Linux Libertine OTF. No file was created and I got this terminal output. My fonttools version is 3.39.0.

$ pyftsubset LinLibertine_RBI.otf --output-file=test.subset.otf --verbose --unicodes="U+0020"
Text: ''
Unicodes: [32]
Glyphs: []
Gids: []
maxp pruned
cmap pruned
post pruned
CFF  pruned
GPOS pruned
GSUB pruned
name pruned
Added .notdef to subset
Closing glyph list over 'GSUB': 2 glyphs before
Glyph names: ['.notdef', 'space']
Glyph IDs:   [0, 1]
Closed glyph list over 'GSUB': 2 glyphs after
Glyph names: ['.notdef', 'space']
Glyph IDs:   [0, 1]
Closing glyph list over 'CFF ': 2 glyphs before
Glyph names: ['.notdef', 'space']
Glyph IDs:   [0, 1]
Closed glyph list over 'CFF ': 2 glyphs after
Glyph names: ['.notdef', 'space']
Glyph IDs:   [0, 1]
Retaining 2 glyphs
head subsetting not needed
hhea subsetting not needed
maxp subsetting not needed
OS/2 subsetting not needed
cmap subsetted
post subsetted
CFF  subsetted
WARNING: FFTM NOT subset; don't know how to subset; dropped
GDEF subsetted
Traceback (most recent call last):
  File "/usr/bin/pyftsubset", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/fontTools/misc/loggingTools.py", line 375, in wrapper
    return func(*args, **kwds)
  File "/usr/lib/python2.7/site-packages/fontTools/subset/__init__.py", line 2830, in main
    subsetter.subset(font)
  File "/usr/lib/python2.7/site-packages/fontTools/subset/__init__.py", line 2633, in subset
    self._subset_glyphs(font)
  File "/usr/lib/python2.7/site-packages/fontTools/subset/__init__.py", line 2579, in _subset_glyphs
    retain = table.subset_glyphs(self)
  File "/usr/lib/python2.7/site-packages/fontTools/subset/__init__.py", line 1419, in subset_glyphs
    lookup_indices = self.table.LookupList.subset_glyphs(s)
  File "/usr/lib/python2.7/site-packages/fontTools/subset/__init__.py", line 1204, in subset_glyphs
    return [i for i,l in enumerate(self.Lookup) if l and l.subset_glyphs(s)]
  File "/usr/lib/python2.7/site-packages/fontTools/subset/__init__.py", line 1176, in subset_glyphs
    self.SubTable = [st for st in self.SubTable if st and st.subset_glyphs(s)]
  File "/usr/lib/python2.7/site-packages/fontTools/subset/__init__.py", line 612, in subset_glyphs
    mark_indices = self.MarkCoverage.subset(s.glyphs)
  File "/usr/lib/python2.7/site-packages/fontTools/subset/__init__.py", line 400, in subset
    indices = self.intersect(glyphs)
  File "/usr/lib/python2.7/site-packages/fontTools/subset/__init__.py", line 390, in intersect
    return [i for i,g in enumerate(self.glyphs) if g in glyphs]
  File "/usr/lib/python2.7/site-packages/fontTools/ttLib/tables/otBase.py", line 543, in __getattr__
    self.decompile(reader, font)
  File "/usr/lib/python2.7/site-packages/fontTools/ttLib/tables/otBase.py", line 640, in decompile
    self.postRead(table, font)
  File "/usr/lib/python2.7/site-packages/fontTools/ttLib/tables/otTables.py", line 533, in postRead
    (r.StartCoverageIndex, len(glyphs))
AssertionError: (28, 25)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
behdadcommented, May 8, 2019

Ok then if glyph names must be unique in CFF…

It’s not like they are allowed non-unique in non-CFF…

0reactions
anthrotypecommented, May 9, 2019

yes, I was referring exactly to that when I commented earlier

For TTF we make sure that the post glyph names are unique.

Should we do the same (and issue a warning) for CFF?

I wonder how broken/invalid that Libertine font with duplicate glyph names actually is. FWIW, it passes the opentype-sanitizer.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NEWS.rst - third_party/fonttools - Git at Google
- [ttFont] Update glyf's glyphOrder when calling TTFont.setGlyphOrder() (#2544). - [ttFont] Added ``ensureDecompiled`` method to load all tables irrespective.
Read more >
fonttools [python-library] - Occam :: Details
[merge] Handle duplicate glyph names better: instead of appending font index to all glyph names, use similar code like we use in post...
Read more >
afdko | Adobe Font Development Kit for OpenType
By using the same font more than once as a source with different mapping files, glyphs can be duplicated under other names. It...
Read more >
How get symbols of glyphs in CFF font - Stack Overflow
If the second, the names for each glyph are stored in the String block, like every other string in a CFF (but offset...
Read more >
Release Notes Archive - FontLab VI Help
Elements; FontAudit; Preview panel; Variations; Glyph names and Unicode; TrueType Smoothing (gasp table); Python installation on Windows. Bug fixes.
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