From e82b4d5658a7a38cf92b4b9392861257a2cfbb36 Mon Sep 17 00:00:00 2001 From: jvr Date: Thu, 2 May 2002 20:54:08 +0000 Subject: [PATCH] only keep the orginal table around in two special cases.\n this fixes a problem with importing individual tables. git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@186 4cde692c-a291-49d1-8350-778aa11640f8 --- Lib/fontTools/ttLib/xmlImport.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Lib/fontTools/ttLib/xmlImport.py b/Lib/fontTools/ttLib/xmlImport.py index f11d084c1..1f3dfa8d0 100644 --- a/Lib/fontTools/ttLib/xmlImport.py +++ b/Lib/fontTools/ttLib/xmlImport.py @@ -38,7 +38,7 @@ class ExpatParser: def startElementHandler(self, name, attrs): stackSize = self.stackSize - self.stackSize = self.stackSize + 1 + self.stackSize = stackSize + 1 if not stackSize: if name <> "ttFont": raise TTXParseError, "illegal root tag: %s" % name @@ -62,7 +62,15 @@ class ExpatParser: tableClass = ttLib.getTableClass(tag) if tableClass is None: tableClass = DefaultTable - if self.ttFont.has_key(tag): + if tag in ('post', 'loca') and self.ttFont.has_key(tag): + # Special-case 'post' to prevent a bootstrap problem with + # ttCompile.py -i: + # - import post table from XML + # - don't import glyf table from XML + # - the glyphOrder is in the *original* binary post table + # So: we can't throw away the original post table. + # Also special-case the 'laca' table as we need the + # original if the 'glyf' table isn't recompiled. self.currentTable = self.ttFont[tag] else: self.currentTable = tableClass(tag)