Don't write Format for Coverage, ClassDef, Single/Alternate/LigatureSubst

The format values for those are automatically handled in
postRead/preWrite to choose optimal format.  As such, don't write them
in XML.  Reduces noise.

https://github.com/fonttools/fonttools/pull/2236#issuecomment-804523961
This commit is contained in:
Behdad Esfahbod 2013-12-17 03:06:10 -05:00
parent 2089d05126
commit 10fe1c2636

View File

@ -558,6 +558,7 @@ class Coverage(FormatSwitchingBaseTable):
else:
self.glyphs = []
log.warning("Unknown Coverage format: %s", self.Format)
del self.Format # Don't need this anymore
def preWrite(self, font):
glyphs = getattr(self, "glyphs", None)
@ -739,6 +740,7 @@ class SingleSubst(FormatSwitchingBaseTable):
else:
assert 0, "unknown format: %s" % self.Format
self.mapping = mapping
del self.Format # Don't need this anymore
def preWrite(self, font):
mapping = getattr(self, "mapping", None)
@ -927,6 +929,7 @@ class ClassDef(FormatSwitchingBaseTable):
else:
log.warning("Unknown ClassDef format: %s", self.Format)
self.classDefs = classDefs
del self.Format # Don't need this anymore
def _getClassRanges(self, font):
classDefs = getattr(self, "classDefs", None)
@ -1015,6 +1018,7 @@ class AlternateSubst(FormatSwitchingBaseTable):
else:
assert 0, "unknown format: %s" % self.Format
self.alternates = alternates
del self.Format # Don't need this anymore
def preWrite(self, font):
self.Format = 1
@ -1085,6 +1089,7 @@ class LigatureSubst(FormatSwitchingBaseTable):
else:
assert 0, "unknown format: %s" % self.Format
self.ligatures = ligatures
del self.Format # Don't need this anymore
def preWrite(self, font):
self.Format = 1