refactored slightly to make later specializations easier
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@330 4cde692c-a291-49d1-8350-778aa11640f8
diff --git a/Lib/fontTools/ttLib/tables/otBase.py b/Lib/fontTools/ttLib/tables/otBase.py
index 1ddea2d..9d18cab 100644
--- a/Lib/fontTools/ttLib/tables/otBase.py
+++ b/Lib/fontTools/ttLib/tables/otBase.py
@@ -299,6 +299,7 @@
def decompile(self, reader, font, tableStack=None):
if tableStack is None:
tableStack = TableStack()
+ self.readFormat(reader)
table = {}
self.__rawTable = table # for debugging
tableStack.push(table)
@@ -321,6 +322,7 @@
if tableStack is None:
tableStack = TableStack()
table = self.preWrite(font)
+ self.writeFormat(writer)
tableStack.push(table)
for conv in self.getConverters():
value = table.get(conv.name)
@@ -344,6 +346,12 @@
conv.write(writer, font, tableStack, value)
tableStack.pop()
+ def readFormat(self, reader):
+ pass
+
+ def writeFormat(self, writer):
+ pass
+
def postRead(self, table, font):
self.__dict__.update(table)
@@ -415,14 +423,12 @@
def getConverterByName(self, name):
return self.convertersByName[self.Format][name]
- def decompile(self, reader, font, tableStack=None):
+ def readFormat(self, reader):
self.Format = reader.readUShort()
assert self.Format <> 0, (self, reader.pos, len(reader.data))
- BaseTable.decompile(self, reader, font, tableStack)
- def compile(self, writer, font, tableStack=None):
+ def writeFormat(self, writer):
writer.writeUShort(self.Format)
- BaseTable.compile(self, writer, font, tableStack)
#