Skip to content

Commit

Permalink
Merge pull request #1048 from googlefonts/uniqueid
Browse files Browse the repository at this point in the history
Add mapping for uniqueID
  • Loading branch information
anthrotype authored Nov 14, 2024
2 parents 3fc6177 + 5928be4 commit 74c6324
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
3 changes: 1 addition & 2 deletions Lib/glyphsLib/builder/custom_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
17 changes: 17 additions & 0 deletions tests/builder/custom_params_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 74c6324

Please sign in to comment.