googlefonts / googlefonts/fontmake

Automatic combined style map names are passed to ufo2ft with undesirable values

Open
#1,161 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
888
Forks
97
Avg merge
4d 52m
Merged PRs (30d)
1

Description

When using fontmake to instantiate a UFO from designspace with multilingual names, the instance style map family names include additional undesirable names that should not be included.

For example, if I include this Python code in ufo2ft:
```py
print(instance.localisedFamilyName)
print(instance.localisedStyleName)
print(instance.localisedStyleMapFamilyName)
print(instance.localisedStyleMapStyleName)
```
before https://github.com/googlefonts/ufo2ft/blob/9cda1f16f25d7941f0f8a82b5ae1788150bf18d1/Lib/ufo2ft/instantiator.py#L782.

Using this designspace:

```xml



Weight
字重






















械黑 GB VF





械黑 GB VF














械黑 GB
Thin





械黑 GB
Regular





械黑 GB
Bold

```

Running `fontmake -i Thin -o ufo -m test.designspace`, the output is follow:

```
INFO:fontmake.font_project:Loading 2 DesignSpace source UFOs
INFO:fontmake.font_project:Interpolating master UFOs from designspace
INFO:fontmake.font_project:Generating instance UFO for 'Thin'
{'zh': '械黑 GB'}
{'zh': 'Thin'}
{'en': 'Frex Sans GB VF Thin', 'zh': '械黑 GB VF Thin'} // <-- where do this come from???
{}
INFO:fontmake.font_project:Saving instances\FrexSansGB-Thin.uf
```

Pretty sure this isn't on ufo2ft as I've written this part and there is a test case testing this exact scenario.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the supplied designspace and `fontmake -i Thin -o ufo -m test.designspace`, then inspect the name handling around `ufo2ft/instantiator.py` line 782. Compare the localized family and style-map names with the designspace instance data; done means the generated instance no longer includes the unwanted combined names.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.