googlefonts / fontc

Where in we pursue oxidizing (context: https://github.com/googlefonts/oxidize) fontmake.
Apache License 2.0
73 stars 12 forks source link

should add .notdef when missing from the source #149

Closed anthrotype closed 12 months ago

anthrotype commented 1 year ago

.notdef (GID=0) is required glyph in a font (a glyph at index 0 is special for cmap, for example). Sometimes sources do not contain one and expect the compiler to synthesize one for them. fontmake (via ufo2ft) adds one when the input doesn't contain it, using font dimensions like upem and vertical metrics to draw a nice tofu box. I'd expect fontmake-rs to do something similar.

See https://github.com/googlefonts/ufo2ft/blob/5b22f201b4650ab9ef1169357702a732e3127a5e/Lib/ufo2ft/outlineCompiler.py#L241-L270

anthrotype commented 1 year ago

even when .notdef glyph may be present, we need to make sure it is the first in the glyph order. some font sources do contain an explicit public.glyphOrder list but forget that .notdef should be the placed as the first in the list. Ufo2ft always ensures that gid=0 is a .notdef glyph whether or not the sources contain a glyph named like that, and whether they do place it or not as the first

e.g. https://github.com/googlefonts/googlesans/issues/590