ttx dies on file with no glyphs
See original GitHub issueI 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.
Issue Analytics
- State:
- Created 7 years ago
- Comments:20 (8 by maintainers)
Top Results From Across the Web
ttx(1) - Linux man page
ttx is a tool for manipulating TrueType and OpenType fonts. It can convert TrueType and OpenType fonts to and from an XML-based format...
Read more >Finding the differences in two (probably OpenType) font files
When I add the file extension .otf and open the files in a font editor, they both look the same and contain the...
Read more >How OpenType Works - Simon Cozens technical blog
It tells us the mapping that TTX has used between the Glyph IDs in the font and some human readable names. Looking at...
Read more >Fixing a PDF Bug: Part 2 - SbF₅
However, this technique led to a problem: text using ligatures could no longer be text-searched or copied. This is because PDF files ......
Read more >How to get intersection point(s) of two glyphs? - TeX
We should get a list of intersection points as a list of coordinates in a log file and/or at the terminal. The subquestion...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
“@simoncozens, exposing ambiguities in software specifications since 1999.”
“FontTools, exposing bugs in other software since 1999.” 😃