Parameters “Add Feature” and “Replace Feature” don’t seem to work (G4)

I’m working on a width+weight family, and want to have multiple areas of variable glyph swaps. I want these to work in variable font exports, and also affect what gets built into static fonts.

As an example, I want the G to have a crossbar in narrower widths and lighter weights – basically, I want there to be a crossbar when there is room for it, but not when there’s not (as in wider/bolder areas). So, it’s something like this:

#ifdef VARIABLE
condition wght < 340;sub G by G.crossbar;
#endif
#ifdef VARIABLE
condition wght < 850, 50 < wdth < 75;
sub G by G.crossbar;
#endif
#ifdef VARIABLE
condition wght < 440, 75 < wdth < 100;
sub G by G.crossbar;
#endif

I can now build with ifdef feature variation syntax via FontMake, but it only works for variable font builds, and fails for static fonts.

So, one thought is that I could perhaps set up a variable font export, and use the “Add Feature” custom parameter to add the feature variations there.

Unfortunately, I can get these parameters to work at all.

Even if I try to do something simple, like a single substitution:

Once I click “OK” and reopen the parameter, it is blank:

The same thing happens in the more complex case trying to add rvrn and then some ifdef feature variations code.

Perhaps this could be a UI issue related to my macOS version? I’m currently on macOS Sonoma, 14.8.9 (23J631). (Update: it worked on a newer macOS for the simple case, but failed for the ifdef case.)

I’ll try it on an alternate computer with a newer macOS, and see if that changes anything. I can email my source file to Glyphs support, if that would be helpful.

Thanks!

Related:

I’ll have a look at the Add Feature dialog.

(You don’t need to repeat the #ifdef VARIABLE/#endif. Just wrap it in one block:

#ifdef VARIABLE
condition wght < 340;sub G by G.crossbar;
condition wght < 850, 50 < wdth < 75;
sub G by G.crossbar;
condition wght < 440, 75 < wdth < 100;
sub G by G.crossbar;
#endif
1 Like

In the file you sent, you mention “rvrn”. NEVER use it. It can be tempting as it is reliably applied. But it will not work with unencoded glyphs. So it can’t handle substitution of e.g. a.sc. Use “rlig” or “rclt”.

1 Like

Ah, great advice – thank you, Georg!

I’ll stay tuned on the Add Feature parameter.

You can “fix” it by clicking in the feature name selector above before hitting OK.

Oh nice, yes, that makes it stick!

For now, that’s a very helpful workaround. Thanks!

You don’t need the “#ifdef” in the parameter. But it will not hurt either.

Ohh that makes sense. I suppose the #ifdef is literally available in the main features to demarcate a block that will only export to variable fonts… right?

it would only be needed for fontMake to hide the code from the static instances if the #ifdef is not supported.