subset: downgrade SinglePos to format 1 if all ValueRecords are same

Fixes https://github.com/fonttools/fonttools/issues/1709
This commit is contained in:
Cosimo Lupo 2020-01-16 18:31:35 -08:00
parent a32fd30c2d
commit 53c99df8f8
No known key found for this signature in database
GPG Key ID: 179A8F0895A02F4F

View File

@ -546,6 +546,11 @@ def prune_post_subset(self, font, options):
if not options.hinting:
# Drop device tables
self.ValueFormat &= ~0x00F0
# Downgrade to Format 1 if all ValueRecords are the same
if self.Format == 2 and all(v == self.Value[0] for v in self.Value):
self.Format = 1
self.Value = self.Value[0] if self.ValueFormat != 0 else None
del self.ValueCount
return True
@_add_method(otTables.PairPos)