Applied patch from Owen Taylor that allows zero-length tables to be ignored. Added comment why.
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@219 4cde692c-a291-49d1-8350-778aa11640f8
diff --git a/Lib/fontTools/ttLib/sfnt.py b/Lib/fontTools/ttLib/sfnt.py
index 8e112db..fbdf80a 100644
--- a/Lib/fontTools/ttLib/sfnt.py
+++ b/Lib/fontTools/ttLib/sfnt.py
@@ -33,7 +33,14 @@
for i in range(self.numTables):
entry = SFNTDirectoryEntry()
entry.fromfile(self.file)
- self.tables[entry.tag] = entry
+ if entry.length > 0:
+ self.tables[entry.tag] = entry
+ else:
+ # Ignore zero-length tables. This doesn't seem to be documented,
+ # yet it's apparently how the Windows TT rasterizer behaves.
+ # Besides, at least one font has been sighted which actually
+ # *has* a zero-length table.
+ pass
def has_key(self, tag):
return self.tables.has_key(tag)