googlefonts / googlefonts/glyphsLib

Use correct width and weight for converted masters

Open
#139 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
202
Forks
57
Avg merge
17m
Merged PRs (30d)
1

Description

When converting *.glyphs to *.ufo, glyphsLib sometimes exports design masters under the wrong name and weight class.

For example, the master for the Black weight in [NotoSansArabic-mm.glyphs](https://github.com/googlei18n/noto-source/raw/master/src/NotoSansArabic-MM.glyphs) currently gets exported as “Bold” with OS/2 weight class 700, although the exported letterforms are really those of the Black weight. I think it would be better if glyphsLib produced UFOs whose names and weight/width classes match the exported letterforms, such as “Black” and “900” for NotoSansArabic.

Somewhat confusingly, Glyphs defines an enum for the master weight, but that value [does not carry any meaning](https://forum.glyphsapp.com/t/names-and-weight-values-of-masters/1245/20). Specifically, it does _not_ correspond to the OS/2 weight class.

When converting a master to UFO, glyphsLib could check if there’s an instance with the same interpolation location as the master. If there is one, glyphsLib could take the name and weight/width class from this instance, because it’s the instance which carries the correct attributes. If no instance can be found for a master, glyphsLib should emit a warning to tell the user that the exported font will likely have the wrong name and attributes.

(Somewhat related to https://github.com/fonttools/fonttools/pull/858#issuecomment-282222430 and https://github.com/googlei18n/fontmake/issues/167).

Contributor guide

Open the contributing guide

Research direction

Start by reading glyphsLib’s conversion path for Glyphs masters and instances, then trace how interpolation locations, names, and weight/width classes are represented in the exported UFO. The issue suggests using a matching instance’s attributes and warning when no instance matches. Check the existing conversion tests and add coverage for both cases; done means names and classes reflect matching instances, with a warning otherwise.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.