Skip to content

Commit 6f1d254

Browse files
committed
Merge remote-tracking branch 'origin/master' into partial-instancer
2 parents d21aa29 + f07cd0a commit 6f1d254

30 files changed

+4221
-379
lines changed

Lib/fontTools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55

66
log = logging.getLogger(__name__)
77

8-
version = __version__ = "3.42.1.dev0"
8+
version = __version__ = "3.43.1.dev0"
99

1010
__all__ = ["version", "log", "configLogger"]

Lib/fontTools/otlLib/builder.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import print_function, division, absolute_import
2+
from collections import namedtuple
23
from fontTools import ttLib
34
from fontTools.ttLib.tables import otTables as ot
45
from fontTools.ttLib.tables.otBase import ValueRecord, valueRecordFormatDict
@@ -488,17 +489,25 @@ def _getSinglePosValueKey(valueRecord):
488489
return tuple(result)
489490

490491

492+
_DeviceTuple = namedtuple("_DeviceTuple", "DeltaFormat StartSize EndSize DeltaValue")
493+
494+
491495
def _makeDeviceTuple(device):
492496
"""otTables.Device --> tuple, for making device tables unique"""
493-
return (device.DeltaFormat, device.StartSize, device.EndSize,
494-
tuple(device.DeltaValue))
497+
return _DeviceTuple(
498+
device.DeltaFormat,
499+
device.StartSize,
500+
device.EndSize,
501+
() if device.DeltaFormat & 0x8000 else tuple(device.DeltaValue)
502+
)
503+
495504

496505
def _getSinglePosValueSize(valueKey):
497506
"""Returns how many ushorts this valueKey (short form of ValueRecord) takes up"""
498507
count = 0
499-
for k in valueKey[1:]:
500-
if hasattr(k[1], '__len__') and len(k[1]):
501-
count += len(k[1][3]) + 3
508+
for _, v in valueKey[1:]:
509+
if isinstance(v, _DeviceTuple):
510+
count += len(v.DeltaValue) + 3
502511
else:
503512
count += 1
504513
return count

0 commit comments

Comments
 (0)