[TupleVariation] Remove unused usesSharedPoints return from tv.compile()
This commit is contained in:
parent
b3a9ef551a
commit
ef0d695de9
@ -145,18 +145,15 @@ class TupleVariation(object):
|
||||
flags |= INTERMEDIATE_REGION
|
||||
tupleData.append(intermediateCoord)
|
||||
|
||||
if pointData is NotImplemented:
|
||||
usesSharedPoints = True
|
||||
else:
|
||||
if pointData is not NotImplemented:
|
||||
flags |= PRIVATE_POINT_NUMBERS
|
||||
auxData.append(pointData)
|
||||
usesSharedPoints = False
|
||||
|
||||
auxData.append(self.compileDeltas())
|
||||
auxData = b''.join(auxData)
|
||||
|
||||
tupleData.insert(0, struct.pack('>HH', len(auxData), flags))
|
||||
return b''.join(tupleData), auxData, usesSharedPoints
|
||||
return b''.join(tupleData), auxData
|
||||
|
||||
def compileCoord(self, axisTags):
|
||||
result = bytearray()
|
||||
@ -553,9 +550,9 @@ class TupleVariation(object):
|
||||
|
||||
# Shouldn't matter that this is different from fvar...?
|
||||
axisTags = sorted(self.axes.keys())
|
||||
tupleData, auxData, _ = self.compile(axisTags)
|
||||
tupleData, auxData = self.compile(axisTags)
|
||||
unoptimizedLength = len(tupleData) + len(auxData)
|
||||
tupleData, auxData, _ = varOpt.compile(axisTags)
|
||||
tupleData, auxData = varOpt.compile(axisTags)
|
||||
optimizedLength = len(tupleData) + len(auxData)
|
||||
|
||||
if optimizedLength < unoptimizedLength:
|
||||
@ -661,7 +658,7 @@ def compileTupleVariationStore(variations, pointCount,
|
||||
for points in pointDatas]
|
||||
|
||||
for v,p in zip(variations, pointDatas):
|
||||
thisTuple, thisData, _ = v.compile(axisTags, sharedTupleIndices, pointData=p)
|
||||
thisTuple, thisData = v.compile(axisTags, sharedTupleIndices, pointData=p)
|
||||
|
||||
tuples.append(thisTuple)
|
||||
data.append(thisData)
|
||||
|
@ -284,9 +284,9 @@ def _add_gvar(font, masterModel, master_ttfs, tolerance=0.5, optimize=True):
|
||||
var_opt = TupleVariation(support, delta_opt)
|
||||
|
||||
axis_tags = sorted(support.keys()) # Shouldn't matter that this is different from fvar...?
|
||||
tupleData, auxData, _ = var.compile(axis_tags)
|
||||
tupleData, auxData = var.compile(axis_tags)
|
||||
unoptimized_len = len(tupleData) + len(auxData)
|
||||
tupleData, auxData, _ = var_opt.compile(axis_tags)
|
||||
tupleData, auxData = var_opt.compile(axis_tags)
|
||||
optimized_len = len(tupleData) + len(auxData)
|
||||
|
||||
if optimized_len < unoptimized_len:
|
||||
|
@ -231,7 +231,7 @@ class TupleVariationTest(unittest.TestCase):
|
||||
[(7,4), (8,5), (9,6)])
|
||||
axisTags = ["wght", "wdth"]
|
||||
sharedPeakIndices = { var.compileCoord(axisTags): 0x77 }
|
||||
tup, deltas, _ = var.compile(axisTags, sharedPeakIndices, pointData=NotImplemented)
|
||||
tup, deltas = var.compile(axisTags, sharedPeakIndices, pointData=NotImplemented)
|
||||
# len(deltas)=8; flags=None; tupleIndex=0x77
|
||||
# embeddedPeaks=[]; intermediateCoord=[]
|
||||
self.assertEqual("00 08 00 77", hexencode(tup))
|
||||
@ -245,7 +245,7 @@ class TupleVariationTest(unittest.TestCase):
|
||||
[(7,4), (8,5), (9,6)])
|
||||
axisTags = ["wght", "wdth"]
|
||||
sharedPeakIndices = { var.compileCoord(axisTags): 0x77 }
|
||||
tup, deltas, _ = var.compile(axisTags, sharedPeakIndices, pointData=NotImplemented)
|
||||
tup, deltas = var.compile(axisTags, sharedPeakIndices, pointData=NotImplemented)
|
||||
# len(deltas)=8; flags=INTERMEDIATE_REGION; tupleIndex=0x77
|
||||
# embeddedPeak=[]; intermediateCoord=[(0.3, 0.1), (0.7, 0.9)]
|
||||
self.assertEqual("00 08 40 77 13 33 06 66 2C CD 39 9A", hexencode(tup))
|
||||
@ -259,7 +259,7 @@ class TupleVariationTest(unittest.TestCase):
|
||||
[(7,4), (8,5), (9,6)])
|
||||
axisTags = ["wght", "wdth"]
|
||||
sharedPeakIndices = { var.compileCoord(axisTags): 0x77 }
|
||||
tup, deltas, _ = var.compile(axisTags, sharedPeakIndices)
|
||||
tup, deltas = var.compile(axisTags, sharedPeakIndices)
|
||||
# len(deltas)=9; flags=PRIVATE_POINT_NUMBERS; tupleIndex=0x77
|
||||
# embeddedPeak=[]; intermediateCoord=[]
|
||||
self.assertEqual("00 09 20 77", hexencode(tup))
|
||||
@ -274,7 +274,7 @@ class TupleVariationTest(unittest.TestCase):
|
||||
[(7,4), (8,5), (9,6)])
|
||||
axisTags = ["wght", "wdth"]
|
||||
sharedPeakIndices = { var.compileCoord(axisTags): 0x77 }
|
||||
tuple, deltas, _ = var.compile(axisTags, sharedPeakIndices)
|
||||
tuple, deltas = var.compile(axisTags, sharedPeakIndices)
|
||||
# len(deltas)=9; flags=PRIVATE_POINT_NUMBERS; tupleIndex=0x77
|
||||
# embeddedPeak=[]; intermediateCoord=[(0.0, 0.0), (1.0, 1.0)]
|
||||
self.assertEqual("00 09 60 77 00 00 00 00 40 00 40 00",
|
||||
@ -288,7 +288,7 @@ class TupleVariationTest(unittest.TestCase):
|
||||
var = TupleVariation(
|
||||
{"wght": (0.0, 0.5, 0.5), "wdth": (0.0, 0.8, 0.8)},
|
||||
[(7,4), (8,5), (9,6)])
|
||||
tup, deltas, _ = var.compile(axisTags=["wght", "wdth"], pointData=NotImplemented)
|
||||
tup, deltas = var.compile(axisTags=["wght", "wdth"], pointData=NotImplemented)
|
||||
# len(deltas)=8; flags=EMBEDDED_PEAK_TUPLE
|
||||
# embeddedPeak=[(0.5, 0.8)]; intermediateCoord=[]
|
||||
self.assertEqual("00 08 80 00 20 00 33 33", hexencode(tup))
|
||||
@ -300,7 +300,7 @@ class TupleVariationTest(unittest.TestCase):
|
||||
var = TupleVariation(
|
||||
{"wght": (0.0, 0.5, 0.5), "wdth": (0.0, 0.8, 0.8)},
|
||||
[3, 1, 4])
|
||||
tup, deltas, _ = var.compile(axisTags=["wght", "wdth"], pointData=NotImplemented)
|
||||
tup, deltas = var.compile(axisTags=["wght", "wdth"], pointData=NotImplemented)
|
||||
# len(deltas)=4; flags=EMBEDDED_PEAK_TUPLE
|
||||
# embeddedPeak=[(0.5, 0.8)]; intermediateCoord=[]
|
||||
self.assertEqual("00 04 80 00 20 00 33 33", hexencode(tup))
|
||||
@ -311,7 +311,7 @@ class TupleVariationTest(unittest.TestCase):
|
||||
var = TupleVariation(
|
||||
{"wght": (0.0, 0.5, 1.0), "wdth": (0.0, 0.8, 0.8)},
|
||||
[(7,4), (8,5), (9,6)])
|
||||
tup, deltas, _ = var.compile(axisTags=["wght", "wdth"], pointData=NotImplemented)
|
||||
tup, deltas = var.compile(axisTags=["wght", "wdth"], pointData=NotImplemented)
|
||||
# len(deltas)=8; flags=EMBEDDED_PEAK_TUPLE
|
||||
# embeddedPeak=[(0.5, 0.8)]; intermediateCoord=[(0.0, 0.0), (1.0, 0.8)]
|
||||
self.assertEqual("00 08 C0 00 20 00 33 33 00 00 00 00 40 00 33 33",
|
||||
@ -324,7 +324,7 @@ class TupleVariationTest(unittest.TestCase):
|
||||
var = TupleVariation(
|
||||
{"wght": (0.0, 0.5, 0.5), "wdth": (0.0, 0.8, 0.8)},
|
||||
[(7,4), (8,5), (9,6)])
|
||||
tup, deltas, _ = var.compile(axisTags=["wght", "wdth"])
|
||||
tup, deltas = var.compile(axisTags=["wght", "wdth"])
|
||||
# len(deltas)=9; flags=PRIVATE_POINT_NUMBERS|EMBEDDED_PEAK_TUPLE
|
||||
# embeddedPeak=[(0.5, 0.8)]; intermediateCoord=[]
|
||||
self.assertEqual("00 09 A0 00 20 00 33 33", hexencode(tup))
|
||||
@ -337,7 +337,7 @@ class TupleVariationTest(unittest.TestCase):
|
||||
var = TupleVariation(
|
||||
{"wght": (0.0, 0.5, 0.5), "wdth": (0.0, 0.8, 0.8)},
|
||||
[7, 8, 9])
|
||||
tup, deltas, _ = var.compile(axisTags=["wght", "wdth"])
|
||||
tup, deltas = var.compile(axisTags=["wght", "wdth"])
|
||||
# len(deltas)=5; flags=PRIVATE_POINT_NUMBERS|EMBEDDED_PEAK_TUPLE
|
||||
# embeddedPeak=[(0.5, 0.8)]; intermediateCoord=[]
|
||||
self.assertEqual("00 05 A0 00 20 00 33 33", hexencode(tup))
|
||||
@ -349,7 +349,7 @@ class TupleVariationTest(unittest.TestCase):
|
||||
var = TupleVariation(
|
||||
{"wght": (0.4, 0.5, 0.6), "wdth": (0.7, 0.8, 0.9)},
|
||||
[(7,4), (8,5), (9,6)])
|
||||
tup, deltas, _ = var.compile(axisTags = ["wght", "wdth"])
|
||||
tup, deltas = var.compile(axisTags = ["wght", "wdth"])
|
||||
# len(deltas)=9;
|
||||
# flags=PRIVATE_POINT_NUMBERS|INTERMEDIATE_REGION|EMBEDDED_PEAK_TUPLE
|
||||
# embeddedPeak=(0.5, 0.8); intermediateCoord=[(0.4, 0.7), (0.6, 0.9)]
|
||||
@ -364,7 +364,7 @@ class TupleVariationTest(unittest.TestCase):
|
||||
var = TupleVariation(
|
||||
{"wght": (0.4, 0.5, 0.6), "wdth": (0.7, 0.8, 0.9)},
|
||||
[7, 8, 9])
|
||||
tup, deltas, _ = var.compile(axisTags = ["wght", "wdth"])
|
||||
tup, deltas = var.compile(axisTags = ["wght", "wdth"])
|
||||
# len(deltas)=5;
|
||||
# flags=PRIVATE_POINT_NUMBERS|INTERMEDIATE_REGION|EMBEDDED_PEAK_TUPLE
|
||||
# embeddedPeak=(0.5, 0.8); intermediateCoord=[(0.4, 0.7), (0.6, 0.9)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user