fonttools: Error decompiling OTL tables when CFF glyph names contain duplicates

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)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Ok then if glyph names must be unique in CFF…

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