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

[varLib_instancer - updateNameRecords] Allow NameRecord that do not exist for an platform #2941

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
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
29 changes: 19 additions & 10 deletions Lib/fontTools/varLib/instancer/names.py
Expand Up @@ -209,13 +209,20 @@ def _updateNameRecords(varfont, axisValues):
# we cannot update this set of name Records.
continue

subFamilyName = " ".join(
getName(n, *platform).toUnicode() for n in ribbiNameIDs
)
if nonRibbiNameIDs:
typoSubFamilyName = " ".join(
getName(n, *platform).toUnicode() for n in axisValueNameIDs
try:
subFamilyName = " ".join(
getName(n, *platform).toUnicode() for n in ribbiNameIDs
)
except AttributeError:
subFamilyName = None

if nonRibbiNameIDs:
try:
typoSubFamilyName = " ".join(
getName(n, *platform).toUnicode() for n in axisValueNameIDs
)
except AttributeError:
typoSubFamilyName = None
else:
typoSubFamilyName = None

Expand All @@ -226,10 +233,12 @@ def _updateNameRecords(varfont, axisValues):
subFamilyName = getName(elidedNameID, *platform).toUnicode()
else:
typoSubFamilyName = getName(elidedNameID, *platform).toUnicode()

familyNameSuffix = " ".join(
getName(n, *platform).toUnicode() for n in nonRibbiNameIDs
)
try:
familyNameSuffix = " ".join(
getName(n, *platform).toUnicode() for n in nonRibbiNameIDs
)
except AttributeError:
familyNameSuffix = None

_updateNameTableStyleRecords(
varfont,
Expand Down