fonttools: ttx dies on file with no glyphs
I created a new file in Glyphs, turned off exporting for all characters, and exported as OTF. Then I fed it to ttx
:
$ ttx TTXTest-Regular.otf
Dumping "TTXTest-Regular.otf" to "TTXTest-Regular.ttx"...
Dumping 'GlyphOrder' table...
Dumping 'head' table...
Dumping 'hhea' table...
Dumping 'maxp' table...
Dumping 'OS/2' table...
Dumping 'name' table...
Dumping 'cmap' table...
Dumping 'post' table...
Dumping 'CFF ' table...
.notdef
A
ERROR: Unhandled exception has occurred
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/FontTools/fontTools/ttx.py", line 383, in main
process(jobs, options)
File "/Library/Python/2.7/site-packages/FontTools/fontTools/ttx.py", line 356, in process
action(input, output, options)
File "/Library/Python/2.7/site-packages/FontTools/fontTools/misc/loggingTools.py", line 372, in wrapper
return func(*args, **kwds)
File "/Library/Python/2.7/site-packages/FontTools/fontTools/ttx.py", line 256, in ttDump
bitmapGlyphDataFormat=options.bitmapGlyphDataFormat)
File "/Library/Python/2.7/site-packages/FontTools/fontTools/ttLib/__init__.py", line 302, in saveXML
self._tableToXML(tableWriter, tag, progress)
File "/Library/Python/2.7/site-packages/FontTools/fontTools/ttLib/__init__.py", line 338, in _tableToXML
table.toXML(writer, self, progress)
File "/Library/Python/2.7/site-packages/FontTools/fontTools/ttLib/tables/C_F_F_.py", line 42, in toXML
self.cff.toXML(writer, progress)
File "/Library/Python/2.7/site-packages/FontTools/fontTools/cffLib.py", line 86, in toXML
font.toXML(xmlWriter, progress)
File "/Library/Python/2.7/site-packages/FontTools/fontTools/cffLib.py", line 1549, in toXML
BaseDict.toXML(self, xmlWriter, progress)
File "/Library/Python/2.7/site-packages/FontTools/fontTools/cffLib.py", line 1508, in toXML
conv.xmlWrite(xmlWriter, name, value, progress)
File "/Library/Python/2.7/site-packages/FontTools/fontTools/cffLib.py", line 720, in xmlWrite
value.toXML(xmlWriter, progress)
File "/Library/Python/2.7/site-packages/FontTools/fontTools/cffLib.py", line 564, in toXML
charStr, fdSelectIndex = self.getItemAndSelector(name)
File "/Library/Python/2.7/site-packages/FontTools/fontTools/cffLib.py", line 546, in getItemAndSelector
return self.charStringsIndex.getItemAndSelector(index)
File "/Library/Python/2.7/site-packages/FontTools/fontTools/cffLib.py", line 407, in getItemAndSelector
return self[index], sel
File "/Library/Python/2.7/site-packages/FontTools/fontTools/cffLib.py", line 337, in __getitem__
item = self.items[index]
IndexError: list index out of range
The .notdef
and A
lines in there are a debugging print which I inserted into cffLib.py
:
def toXML(self, xmlWriter, progress):
names = sorted(self.keys())
i = 0
step = 10
numGlyphs = len(names)
for name in names:
print(name)
So it sees that something in the font is claiming to have an A
glyph, but there isn’t one defined. I don’t know if Glyphs is producing broken OTFs (fontlint doesn’t think so) but you’re certainly missing an index check somewhere.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 20 (8 by maintainers)
“@simoncozens, exposing ambiguities in software specifications since 1999.”
“FontTools, exposing bugs in other software since 1999.” 😃
Here you go!
ttx-669.zip