Switching shapes with alternate glyphs and Google Fonts glyphsLib

I’m using the alternate glyphs solution mentioned here: https://glyphsapp.com/learn/switching-shapes

Here is a sample from my OT features:

#ifdef VARIABLE

condition 23 < wght < 124;
sub R by R.thin;
sub registered by registered.thin;

condition 124 < wght < 147;
sub R by R.thin;
sub registered by registered.thin;
sub dcroat by dcroat.ultra;
sub hbar by hbar.ultra;

I am using the Google Fonts build process to generate fonts and I get the following error via fontmake:

fontmake: Error: In ‘master_ufo/Fontname.designspace’: Generating fonts from Designspace failed: /Users/username/Desktop/Fonts/Fontname/sources/master_ufo/Fontname-Regular.ufo/features.fea:367:1: Expected glyph class definition or statement: got NAME condition

(See image for features.fea:367:1)

I think the issue may be referenced here: https://github.com/googlefonts/glyphsLib/issues/715

I thought I’d check here on this forum first to see if there were any ideas.

Thanks!

features_fea_367

If you use fontMake, you need to use their feature syntax. This is a bit annoying that there are two incompatible formats to specify feature variations.

The issue you mentioned is about bracket layers, not about manually written conditions in feature code.

OK thanks for the quick reply! I’ll look into the fontMake feature syntax.

The issue you mentioned is about bracket layers, not about manually written conditions in feature code.

If you scroll down there is a comment on Apr 28, 2022, that seems to mention the same error and adding alternate glyphs solution. Although she appears to be using rvrn.