Use tableDict for DeltaValue lookbacks
Was abusing the set/getCount machinery before.
diff --git a/Lib/fontTools/ttLib/tables/otBase.py b/Lib/fontTools/ttLib/tables/otBase.py
index 5191ec3..5745fe1 100644
--- a/Lib/fontTools/ttLib/tables/otBase.py
+++ b/Lib/fontTools/ttLib/tables/otBase.py
@@ -574,7 +574,7 @@
else:
table[conv.name] = conv.read(reader, font, table)
- if conv.isCount or conv.isSize:
+ if conv.isCount:
reader.setCount(conv.name, table[conv.name])
self.postRead(table, font)
@@ -617,8 +617,6 @@
writer.writeCountReference(table, conv.name)
else:
conv.write(writer, font, table, value)
- if conv.isSize:
- writer.setCount(conv.name, value)
def readFormat(self, reader):
pass
diff --git a/Lib/fontTools/ttLib/tables/otConverters.py b/Lib/fontTools/ttLib/tables/otConverters.py
index 765c5fe..1c473ef 100644
--- a/Lib/fontTools/ttLib/tables/otConverters.py
+++ b/Lib/fontTools/ttLib/tables/otConverters.py
@@ -46,7 +46,6 @@
self.repeatOffset = repeatOffset
self.tableClass = tableClass
self.isCount = name.endswith("Count")
- self.isSize = name.endswith("Size") or name=="DeltaFormat"
def read(self, reader, font, tableDict):
"""Read a value from the reader."""
@@ -283,9 +282,9 @@
class DeltaValue(BaseConverter):
def read(self, reader, font, tableDict):
- StartSize = reader.getCount("StartSize")
- EndSize = reader.getCount("EndSize")
- DeltaFormat = reader.getCount("DeltaFormat")
+ StartSize = tableDict["StartSize"]
+ EndSize = tableDict["EndSize"]
+ DeltaFormat = tableDict["DeltaFormat"]
assert DeltaFormat in (1, 2, 3), "illegal DeltaFormat"
nItems = EndSize - StartSize + 1
nBits = 1 << DeltaFormat
@@ -306,9 +305,9 @@
return DeltaValue
def write(self, writer, font, tableDict, value, repeatIndex=None):
- StartSize = writer.getCount("StartSize")
- EndSize = writer.getCount("EndSize")
- DeltaFormat = writer.getCount("DeltaFormat")
+ StartSize = tableDict["StartSize"]
+ EndSize = tableDict["EndSize"]
+ DeltaFormat = tableDict["DeltaFormat"]
DeltaValue = value
assert DeltaFormat in (1, 2, 3), "illegal DeltaFormat"
nItems = EndSize - StartSize + 1