From 4689727928915a417ec68ae1fd0fd5c0b919dee3 Mon Sep 17 00:00:00 2001 From: rsheeter Date: Wed, 13 Nov 2024 17:53:00 -0800 Subject: [PATCH 1/2] Add mapping for uniqueID --- Lib/glyphsLib/builder/custom_params.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/glyphsLib/builder/custom_params.py b/Lib/glyphsLib/builder/custom_params.py index 65b4312e0..6aac96b3a 100644 --- a/Lib/glyphsLib/builder/custom_params.py +++ b/Lib/glyphsLib/builder/custom_params.py @@ -373,8 +373,7 @@ def register(handler): # "copyrights", ("versionString", "openTypeNameVersion", "versionString"), ("vendorID", "openTypeOS2VendorID", "vendorID"), - # TODO: Map this property to a custom parameter if applicable. - # "uniqueID", + ("uniqueID", "openTypeNameUniqueID", "uniqueID"), ("license", "openTypeNameLicense", "licenses"), ("licenseURL", "openTypeNameLicenseURL", "licenseURL"), ("trademark", "trademark", "trademarks"), From 5928be4a16efd1d0460f55d757653d0dd5b0b3d1 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Thu, 14 Nov 2024 10:14:41 +0100 Subject: [PATCH 2/2] custom_params_test: test uniqueID property/cp -> ufo.info --- tests/builder/custom_params_test.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/builder/custom_params_test.py b/tests/builder/custom_params_test.py index 2467c897d..d1c443a50 100644 --- a/tests/builder/custom_params_test.py +++ b/tests/builder/custom_params_test.py @@ -482,6 +482,23 @@ def test_meta_table(self): font = glyphsLib.to_glyphs([self.ufo]) self.assertEqual(font.customParameters["meta Table"], glyphs_meta) + def test_name_unique_id_as_property(self): + uniqueID = "Foo Bar: Version 1.234" + self.font.properties["uniqueID"] = uniqueID + self.set_custom_params() + self.assertEqual(self.ufo.info.openTypeNameUniqueID, uniqueID) + # we currently do not round-trip properties + # font = glyphsLib.to_glyphs([self.ufo]) + # self.assertEqual(font.properties["uniqueID"], uniqueID) + + def test_name_unique_id_as_custom_parameter(self): + uniqueID = "Foo Bar: Version 1.234" + self.font.customParameters["uniqueID"] = uniqueID + self.set_custom_params() + self.assertEqual(self.ufo.info.openTypeNameUniqueID, uniqueID) + font = glyphsLib.to_glyphs([self.ufo]) + self.assertEqual(font.customParameters["uniqueID"], uniqueID) + def test_name_table_entry(self): self.font.customParameters.append( GSCustomParameter("Name Table Entry", "1024; FOO; BAZ")