Can #ifndef VARIABLE have conditions

I’m trying to add some Contextual Substitutions to just some of my instances. In the Glyphs 3 release post I saw two code snippets for this:

#ifdef VARIABLE
condition 600 < wght < 900, 70 < wdth < 90;
sub won by won.boldcondensed;
#endif
#ifndef VARIABLE
sub x by x.static; # ignored in variable fonts
#endif

The latter is supposed to only apply to static fonts, but the example has no conditions like the variable one. Naturally I tried this but it didn’t work:

#ifndef VARIABLE
condition 119 < wght < 168;
sub a b' by c;
#endif

What I want is the substitution to apply to all instances at weights above 119. Is this possible today? If so have I done something wrong?

For static fonts, you would work with parameters.

But that’s a good point. Why not open the condition keyword for static fonts as well. We will discuss it internally. Thank you for the input!

1 Like

Thanks @mekkablue

What’s the best way to go about it with parameters?
I have other substitutions in CALT as well that should apply to all instances.

There’s a new tutorial called Switching Shapes, it covers both static and variable fonts.

I think what I want is something different, but it could be that I don’t understand how to apply it in my specific scenario. So let me explain.

  • I have /g, that looks different in the Bold weight compared to the other instances. That I’ve solved with Rename Glyphs parameter.

  • The Bold /g connects awkwardly to /j, so I’ve created a j.after.g that I want after each /g. The effect is a connecting /g and /j. But only in the Bold instance.

So I originally planned to put substitution in rlig(or where makes sense) within a #ifndef VARIABLE with conditions, only on bold. But as you said it’s not supported(yet at least).

My option is then to add a Custom Parameter to the Bold instance:

  • I tried Add Feature with calt, but it doesn’t work:
  • I tried the same with rlig, and it didn’t work.

I did tested the code straight in the feature panel, and it works, so not sure if I’m doing something wrong. I have some calt features already, but no dlig. I’m testing in InDesign 2020.

The Add Feature should work. Will investigate.

Thanks Rainer.
And just so I understand how it’s intended to work. Add Feature shouldn’t override all existing feature code, right? It’s should append feature code in that case?

Yes. For replacing the feature you should use the ‘Replace Feature’ parameter.

Great, thanks for clarification Georg

Did you have time to investigate the Add Feature?

Sorry, I forgot. It appears to be a bug. I could reproduce it and filed an error report.

Ok, great to hear.