GlyphsLib/FontMake now support Glyphs feature variations syntax! Is there a way to build to VF *and* static fonts?

Apologies in advance if this question falls a bit beyond the purview of this glyphs forum.

GlyphsLib/FontMake now support Glyphs feature variations syntax! But if I am using “ifdef” feature syntax, is there a way to build to VF and static fonts? I’ve asked this question in the glyphsLib GitHub repo, so an answer/discussion there might be ideal. But, I wanted to get a bit of extra visibility on the question, and I know there are a few experts here. :slight_smile:

I assume a couple of Glyphs-centric answers to my question are:

  1. Yes – use bracket layers to swap shapes. This works pretty well if I only need one area of shape switching, but I can’t get it to work for multiple areas, as needed in a current width+weight family I’m working on. So, thus my excitement about using feature variations.
  2. Yes – export from the app, or build with the recently released Glyphs CLI tool. Those are both decent answers, and I may move towards the CLI tool. Still, I like having the ability to use FontMake and open-source tools in builds, when possible.

So, if I am trying to build via FontMake, is there some approach that might work?

I’ve just realized I miiight be able to get there with some combination of setting up exports/instances using custom parameters “Add Features” or “Remove Features” (for variable vs static exports) as well as “Rename Glyphs” and “Remove Glyphs” (for static swaps).

I’ll try it out, and report back if I find a way!

Aside from that, I’d still love to know if there might be some kind of more automatic approach. I’m imagining something like:

  • Some way to make FontMake or glyphsLib put the “ifdef” conditions into designspace rules, where multiple conditionsets can be used. I think this might be done for bracket layers, but my builds are failing if I have multiple conditions declared in bracket layers.
  • Custom parameters to control features and glyph swaps in exports. This is what I’ll experiment with and share results on!

I think you answered it yourself pretty well.

For statics, use Feature parameters per instance.

If the #ifdef VARIABLE is not in glyphLib/feaLib yet, this code needs to be in a “Add Feature” parameter in the variable export settings.

Thanks for the reply!

Unfortunately, I can’t get any of my ideas to fully work.

The good news:

  • FontMake will successfully build variable fonts from Glyphs sources with ifdef VARIABLE conditions in features, and these variable substitutions work in the exported fonts.
  • (It’s not as new, but) FontMake will successfully process “Rename Glyphs” parameters for static instances. So, I can control glyph alts in exported static fonts.

But, there’s bad news:

  • FontMake (/glyphsLib) doesn’t seem to support parameters for “Add Feature” or “Remove Feature.”
  • A static build from FontMake fails if the feature code include ifdef VARIABLE conditions. (Compiling UFO failed: :34:1: Cannot add feature variations to a font without an 'fvar' table) And, because one cannot remove this feature in static exports, or add this in variable exports, there seems to be no current way to use FontMake to export both variable and static fonts from the same source, if semi-complex feature variations are desired.

Wasn’t that discussed and fixed in the glyphsLib repo?