Skip to content

Commit

Permalink
Merge pull request #970 from googlefonts/ss-empty-name
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype authored Jan 9, 2024
2 parents ac74ae0 + 5202592 commit eda7aba
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Lib/glyphsLib/builder/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def _is_manual_kern_feature(feature):
return feature.name == "kern" and not feature.automatic


def _to_ufo_features(
def _to_ufo_features( # noqa: C901
font: GSFont,
ufo: Font | None = None,
generate_GDEF: bool = False,
Expand Down Expand Up @@ -140,16 +140,19 @@ def _to_ufo_features(
feature_names = ["featureNames {", f' name "{name}";', "};"]
elif font.format_version == 3 and feature.labels:
feature_names = []
feature_names.append("featureNames {")
for label in feature.labels:
langID = _to_name_langID(label["language"])
name = label["value"]
if name == "":
continue
name = name.replace("\\", r"\005c").replace('"', r"\0022")
if langID is None:
feature_names.append(f' name "{name}";')
else:
feature_names.append(f' name 3 1 0x{langID:X} "{name}";')
feature_names.append("};")
if feature_names:
feature_names.insert(0, "featureNames {")
feature_names.append("};")
if notes:
lines.append("# notes:")
lines.extend("# " + line for line in notes.splitlines())
Expand Down

0 comments on commit eda7aba

Please sign in to comment.