Fixup 41caf2d for DeltaValue tables
Not that I can find any fonts having these... Had to construct one
to test.
diff --git a/Lib/fontTools/ttLib/tables/otBase.py b/Lib/fontTools/ttLib/tables/otBase.py
index e6fd0ab..43123f1 100644
--- a/Lib/fontTools/ttLib/tables/otBase.py
+++ b/Lib/fontTools/ttLib/tables/otBase.py
@@ -555,7 +555,7 @@
else:
table[conv.name] = conv.read(reader, font, countVars)
- if conv.isCount:
+ if conv.isCount or conv.isSize:
counts.append(conv.name)
countVars[conv.name] = table[conv.name]
@@ -618,6 +618,9 @@
countVars[name] = storeValueFactory(table, name)
else:
conv.write(writer, font, countVars, value)
+ if conv.isSize:
+ countVars[conv.name] = value
+ counts.append(conv.name)
for count in counts:
del countVars[count]
diff --git a/Lib/fontTools/ttLib/tables/otConverters.py b/Lib/fontTools/ttLib/tables/otConverters.py
index 240979b..ba8c61a 100644
--- a/Lib/fontTools/ttLib/tables/otConverters.py
+++ b/Lib/fontTools/ttLib/tables/otConverters.py
@@ -49,6 +49,7 @@
self.repeatOffset = repeatOffset
self.tableClass = tableClass
self.isCount = name.endswith("Count")
+ self.isSize = name.endswith("Size") or name=="DeltaFormat"
def read(self, reader, font, countVars):
"""Read a value from the reader."""
@@ -290,10 +291,9 @@
class DeltaValue(BaseConverter):
def read(self, reader, font, countVars):
- table = countVars.getTop()
- StartSize = table["StartSize"]
- EndSize = table["EndSize"]
- DeltaFormat = table["DeltaFormat"]
+ StartSize = countVars["StartSize"]
+ EndSize = countVars["EndSize"]
+ DeltaFormat = countVars["DeltaFormat"]
assert DeltaFormat in (1, 2, 3), "illegal DeltaFormat"
nItems = EndSize - StartSize + 1
nBits = 1 << DeltaFormat
@@ -314,11 +314,10 @@
return DeltaValue
def write(self, writer, font, countVars, value, repeatIndex=None):
- table = countVars.getTop()
- StartSize = table["StartSize"]
- EndSize = table["EndSize"]
- DeltaFormat = table["DeltaFormat"]
- DeltaValue = table["DeltaValue"]
+ StartSize = countVars["StartSize"]
+ EndSize = countVars["EndSize"]
+ DeltaFormat = countVars["DeltaFormat"]
+ DeltaValue = value
assert DeltaFormat in (1, 2, 3), "illegal DeltaFormat"
nItems = EndSize - StartSize + 1
nBits = 1 << DeltaFormat