googlefonts / fontmake

Compile fonts from sources (UFO, Glyphs) to binary (OpenType, TrueType).
Apache License 2.0
764 stars 93 forks source link

Remove unreachable "rvrn" glyphs from static outputs when these glyphs are needed in variable outputs? #1115

Open arrowtype opened 1 month ago

arrowtype commented 1 month ago

I’m building static & variable fonts from UFOs + a designspace, then checking them with Fontbakery.

The variable font includes several glyphs like dollar.rvrn, which swap forms in certain areas of the designspace, using rules elements in the designspace and the rvrn feature in the variable fonts.

These glyphs are used by FontMake to build the correct form of such glyphs into static fonts, which is great. However, the alternate form of the glyph also makes it into static fonts, where they are not needed. Then, the Fontbakery check com.google.fonts/check/unreachable_glyphs warns about these alternate glyphs being "unreachable," as they cannot be accessed via Unicode values or OpenType features. The extra glyphs don’t cause any major problems, but I’d rather them not be there.

Is there some setting or flag I could add to a build to remove such glyphs from the static fonts only?

Thank you for any insights!

anthrotype commented 1 month ago

yeah I see what you mean. I think fontmake is just playing safe here, it can't tell if those glyphs may or may not be referenced elsewhere. Removing unreferenced glyphs is the job of a subsetter (pyftsubset or hb-subset), how about you just run that as separate step after the compilation?

arrowtype commented 1 month ago

Thanks for the quick and informative response!

Okay, I suppose that answer makes sense. It would be nice if it were as simple as adding a flag to a fontmake command, but it’s helpful to confirm that this is not currently the case.

Feel free to close this if you don’t intend to take further action. Thanks again!