aboutsummaryrefslogtreecommitdiff
path: root/Lib/fontTools/misc/xmlReader.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/fontTools/misc/xmlReader.py')
-rw-r--r--Lib/fontTools/misc/xmlReader.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/fontTools/misc/xmlReader.py b/Lib/fontTools/misc/xmlReader.py
index b2707e99..6ec50de4 100644
--- a/Lib/fontTools/misc/xmlReader.py
+++ b/Lib/fontTools/misc/xmlReader.py
@@ -93,11 +93,12 @@ class XMLReader(object):
if not stackSize:
if name != "ttFont":
raise TTXParseError("illegal root tag: %s" % name)
- sfntVersion = attrs.get("sfntVersion")
- if sfntVersion is not None:
- if len(sfntVersion) != 4:
- sfntVersion = safeEval('"' + sfntVersion + '"')
- self.ttFont.sfntVersion = sfntVersion
+ if self.ttFont.reader is None and not self.ttFont.tables:
+ sfntVersion = attrs.get("sfntVersion")
+ if sfntVersion is not None:
+ if len(sfntVersion) != 4:
+ sfntVersion = safeEval('"' + sfntVersion + '"')
+ self.ttFont.sfntVersion = sfntVersion
self.contentStack.append([])
elif stackSize == 1:
if subFile is not None: