From ce1d50aca8642b52b28deb0d0cb4f3e8594e574e Mon Sep 17 00:00:00 2001 From: jvr Date: Sun, 12 May 2002 17:02:50 +0000 Subject: [PATCH] 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 --- Lib/fontTools/ttLib/sfnt.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Lib/fontTools/ttLib/sfnt.py b/Lib/fontTools/ttLib/sfnt.py index 8e112db47..fbdf80ad8 100644 --- a/Lib/fontTools/ttLib/sfnt.py +++ b/Lib/fontTools/ttLib/sfnt.py @@ -33,7 +33,14 @@ class SFNTReader: 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)