From 1aafae816d1792c592d8efd3d36205c68c42677c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 14 Dec 2017 19:02:28 -0800 Subject: [PATCH] Allow decompiling fonts with bad Coverage format number --- Lib/fontTools/ttLib/tables/otBase.py | 2 +- Lib/fontTools/ttLib/tables/otTables.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/fontTools/ttLib/tables/otBase.py b/Lib/fontTools/ttLib/tables/otBase.py index f337f7075..0743eed0e 100644 --- a/Lib/fontTools/ttLib/tables/otBase.py +++ b/Lib/fontTools/ttLib/tables/otBase.py @@ -779,7 +779,7 @@ class FormatSwitchingBaseTable(BaseTable): return NotImplemented def getConverters(self): - return self.converters[self.Format] + return self.converters.get(self.Format, []) def getConverterByName(self, name): return self.convertersByName[self.Format][name] diff --git a/Lib/fontTools/ttLib/tables/otTables.py b/Lib/fontTools/ttLib/tables/otTables.py index 3bdb6f969..237864bb2 100644 --- a/Lib/fontTools/ttLib/tables/otTables.py +++ b/Lib/fontTools/ttLib/tables/otTables.py @@ -481,7 +481,8 @@ class Coverage(FormatSwitchingBaseTable): endID = len(glyphOrder) glyphs.extend(glyphOrder[glyphID] for glyphID in range(startID, endID)) else: - assert 0, "unknown format: %s" % self.Format + self.glyphs = [] + log.warning("Unknown Coverage format: %s" % self.Format) def preWrite(self, font): glyphs = getattr(self, "glyphs", None)