googlefonts / fontc

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

Support Glyphs.app alternate (aka 'bracket') layers and equivalent DS rules #533

Open anthrotype opened 1 year ago

anthrotype commented 1 year ago

spun off of #62

so-called "bracket" layers, i.e. alternate layers substituted when axis conditions are met (GSUB feature-variations) For Glyphs v3: https://glyphsapp.com/learn/switching-shapes For Glyphs v2: https://glyphsapp.com/learn/alternating-glyph-shapes and https://glyphsapp.com/learn/alternating-glyph-shapes-with-multiple-axes These are more complicated in that, even if Glyphs.app represent them as layers within a glyph, they actually end up becoming alternate glyphs to be substituted via GSUB in the final font. In fact when doing glyphs=>UFO that's what we do, we create new glyphs from them and add designspace that define when to substitute which.

Designspace rules are spec'ed here: https://fonttools.readthedocs.io/en/latest/designspaceLib/xml.html#rules-element

fontmake uses glyphsLib to turn "bracket" layers into alternate UFO glyphs and accompanying designspace 'rules' specifying the axis range or sub-space within which they are supposed to be substituted, then fontTools.varLib.featureVars turns those into OpenType FeatureVariations tables.

fonttools feaLib has experimental support for specifying conditional rules in FEA, but the effort to standardise this is somewhat stalled, see https://github.com/adobe-type-tools/afdko/issues/153

tphinney commented 1 week ago

I expect I will continue to need this in every (or nearly every?) serious variable font project I do. Used by Google/Material Symbols as well as Science Gothic.