From 53c99df8f8faed4092447f87a097b10c6490fa34 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Thu, 16 Jan 2020 18:31:35 -0800 Subject: [PATCH] subset: downgrade SinglePos to format 1 if all ValueRecords are same Fixes https://github.com/fonttools/fonttools/issues/1709 --- Lib/fontTools/subset/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Lib/fontTools/subset/__init__.py b/Lib/fontTools/subset/__init__.py index 7205c347e..fadda3436 100644 --- a/Lib/fontTools/subset/__init__.py +++ b/Lib/fontTools/subset/__init__.py @@ -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)