Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect overrides due to openTypeNameRecords for the predefined name IDs #727

Merged
merged 3 commits into from Mar 9, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 14 additions & 14 deletions Lib/ufo2ft/outlineCompiler.py
Expand Up @@ -382,20 +382,6 @@ def setupTable_name(self):
self.otf["name"] = name = newTable("name")
name.names = []

# Set name records from font.info.openTypeNameRecords
for nameRecord in getAttrWithFallback(font.info, "openTypeNameRecords"):
nameId = nameRecord["nameID"]
platformId = nameRecord["platformID"]
platEncId = nameRecord["encodingID"]
langId = nameRecord["languageID"]
# on Python 2, plistLib (used by ufoLib) returns unicode strings
# only when plist data contain non-ascii characters, and returns
# ascii-encoded bytes when it can. On the other hand, fontTools's
# name table `setName` method wants unicode strings, so we must
# decode them first
nameVal = nameRecord["string"]
name.setName(nameVal, nameId, platformId, platEncId, langId)

# Build name records
familyName = getAttrWithFallback(font.info, "styleMapFamilyName")
styleName = getAttrWithFallback(font.info, "styleMapStyleName").title()
Expand Down Expand Up @@ -452,6 +438,20 @@ def setupTable_name(self):
continue
name.setName(nameVal, nameId, platformId, platEncId, langId)

# Set name records from font.info.openTypeNameRecords
for nameRecord in getAttrWithFallback(font.info, "openTypeNameRecords"):
nameId = nameRecord["nameID"]
platformId = nameRecord["platformID"]
platEncId = nameRecord["encodingID"]
langId = nameRecord["languageID"]
# on Python 2, plistLib (used by ufoLib) returns unicode strings
# only when plist data contain non-ascii characters, and returns
# ascii-encoded bytes when it can. On the other hand, fontTools's
# name table `setName` method wants unicode strings, so we must
# decode them first
IvanUkhov marked this conversation as resolved.
Show resolved Hide resolved
nameVal = nameRecord["string"]
name.setName(nameVal, nameId, platformId, platEncId, langId)

def setupTable_maxp(self):
"""
Make the maxp table.
Expand Down