Rename repeatOffset to aux

To be used for other purposes soon.
This commit is contained in:
Behdad Esfahbod 2013-11-24 22:11:41 -05:00
parent d58c38dc36
commit 6b6e9fae23
2 changed files with 10 additions and 10 deletions

View File

@ -551,7 +551,7 @@ class BaseTable(object):
else: else:
# conv.repeat is a propagated count # conv.repeat is a propagated count
countValue = reader.getCount(conv.repeat) countValue = reader.getCount(conv.repeat)
for i in range(countValue + conv.repeatOffset): for i in range(countValue + conv.aux):
l.append(conv.read(reader, font, table)) l.append(conv.read(reader, font, table))
table[conv.name] = l table[conv.name] = l
else: else:
@ -582,7 +582,7 @@ class BaseTable(object):
if conv.repeat: if conv.repeat:
if value is None: if value is None:
value = [] value = []
countValue = len(value) - conv.repeatOffset countValue = len(value) - conv.aux
if conv.repeat in table: if conv.repeat in table:
ref = table[conv.repeat] ref = table[conv.repeat]
table[conv.repeat] = None table[conv.repeat] = None

View File

@ -8,7 +8,7 @@ def buildConverters(tableSpec, tableNamespace):
the results are assigned to the corresponding class in otTables.py.""" the results are assigned to the corresponding class in otTables.py."""
converters = [] converters = []
convertersByName = {} convertersByName = {}
for tp, name, repeat, repeatOffset, descr in tableSpec: for tp, name, repeat, aux, descr in tableSpec:
if name.startswith("ValueFormat"): if name.startswith("ValueFormat"):
assert tp == "uint16" assert tp == "uint16"
converterClass = ValueFormat converterClass = ValueFormat
@ -22,13 +22,13 @@ def buildConverters(tableSpec, tableNamespace):
else: else:
converterClass = converterMapping[tp] converterClass = converterMapping[tp]
tableClass = tableNamespace.get(name) tableClass = tableNamespace.get(name)
conv = converterClass(name, repeat, repeatOffset, tableClass) conv = converterClass(name, repeat, aux, tableClass)
if name in ["SubTable", "ExtSubTable"]: if name in ["SubTable", "ExtSubTable"]:
conv.lookupTypes = tableNamespace['lookupTypes'] conv.lookupTypes = tableNamespace['lookupTypes']
# also create reverse mapping # also create reverse mapping
for t in conv.lookupTypes.values(): for t in conv.lookupTypes.values():
for cls in t.values(): for cls in t.values():
convertersByName[cls.__name__] = Table(name, repeat, repeatOffset, cls) convertersByName[cls.__name__] = Table(name, repeat, aux, cls)
converters.append(conv) converters.append(conv)
assert not convertersByName.has_key(name) assert not convertersByName.has_key(name)
convertersByName[name] = conv convertersByName[name] = conv
@ -40,10 +40,10 @@ class BaseConverter(object):
"""Base class for converter objects. Apart from the constructor, this """Base class for converter objects. Apart from the constructor, this
is an abstract class.""" is an abstract class."""
def __init__(self, name, repeat, repeatOffset, tableClass): def __init__(self, name, repeat, aux, tableClass):
self.name = name self.name = name
self.repeat = repeat self.repeat = repeat
self.repeatOffset = repeatOffset self.aux = aux
self.tableClass = tableClass self.tableClass = tableClass
self.isCount = name.endswith("Count") self.isCount = name.endswith("Count")
self.isPropagatedCount = name in ["ClassCount", "Class2Count"] self.isPropagatedCount = name in ["ClassCount", "Class2Count"]
@ -226,7 +226,7 @@ class LTable(Table):
class SubTable(Table): class SubTable(Table):
def getConverter(self, tableType, lookupType): def getConverter(self, tableType, lookupType):
tableClass = self.lookupTypes[tableType][lookupType] tableClass = self.lookupTypes[tableType][lookupType]
return self.__class__(self.name, self.repeat, self.repeatOffset, tableClass) return self.__class__(self.name, self.repeat, self.aux, tableClass)
class ExtSubTable(LTable, SubTable): class ExtSubTable(LTable, SubTable):
@ -237,8 +237,8 @@ class ExtSubTable(LTable, SubTable):
class ValueFormat(IntValue): class ValueFormat(IntValue):
def __init__(self, name, repeat, repeatOffset, tableClass): def __init__(self, name, repeat, aux, tableClass):
BaseConverter.__init__(self, name, repeat, repeatOffset, tableClass) BaseConverter.__init__(self, name, repeat, aux, tableClass)
self.which = name[-1] == "2" self.which = name[-1] == "2"
def read(self, reader, font, tableDict): def read(self, reader, font, tableDict):
format = reader.readUShort() format = reader.readUShort()