[ttx] Always add raw=True attribute when dumping DefaultTable to XML

Needed to avoid surprises when we add new table implementations.
Recently we added VDMX table, and that broke build of projects using
VDMX with DefaultTable, eg:

https://github.com/behdad/fonttools/issues/151
This commit is contained in:
Behdad Esfahbod 2014-08-24 13:01:27 -04:00
parent bfe99090ba
commit aeeb884b4c

View File

@ -307,10 +307,13 @@ class TTFont(object):
if tag not in self: if tag not in self:
return return
xmlTag = tagToXML(tag) xmlTag = tagToXML(tag)
attrs = dict()
if hasattr(table, "ERROR"): if hasattr(table, "ERROR"):
writer.begintag(xmlTag, ERROR="decompilation error") attrs['ERROR'] = "decompilation error"
else: from .tables.DefaultTable import DefaultTable
writer.begintag(xmlTag) if table.__class__ == DefaultTable:
attrs['raw'] = True
writer.begintag(xmlTag, **attrs)
writer.newline() writer.newline()
if tag in ("glyf", "CFF "): if tag in ("glyf", "CFF "):
table.toXML(writer, self, progress) table.toXML(writer, self, progress)