How to use "Replace Feature" when using multiple features of same name?

Hello,

example: I have an automatic ccmp feature and added a second ccmp feature that contains custom code.

In an export, I want to Replace the second ccmp feature’s code with different code, using the Replace Feature parameter. How can I do that?

That is not possible, yet.
But in Glyphs 4, you can add a fea Macros custom parameter in each instance that defines flags that you can use in #ifdef / #endif sections: that way you can write all of the code in the feature an switch it off/on per instance.

I’ll try that.

I tried something else:

ccmp with:

# Automatic Code
my custom code

Then in the export “Replace Feature”, the same thing again.

However, none of this works – already the first step doesn’t. Mixing Automatic Code and custom code in the same feature doesn’t result in the same font as splitting it into two features. Any insight?

The #Automatic code is only for kern and mark features.

What I meant this code in the manual ccmp:

#ifdef instance1
sub a by b;
#endif
#ifdef instance2
sub a by c;
#endif
#ifdef instance3
sub a by d;
#endif

and in the instances, add a fea Macros parameter:
in the first instance:

instance1=YES

and so on.

See attached file:
fea Macros.glyphs (1.8 KB)

I will test that later, thank you.

It’s unfortunate that the Automatic Code placeholder doesn’t work in other features as well. Is this an intentional limitation? It would be extremely useful if it also worked in any other feature, that way such custom combinations would work much more easily.

This would require # Automatic Code to work as well in a Replace Feature/Add Feature parameter.

Would this be sensible/possible to implement?

I’m not sure but I think this should be possible using :

Yes, true, I had forgotten about that new feature.

I would like to keep it as simple as possible, though, for my client.

that is to decide if the (GPOS) feature that is not in the file (kern, mark) should be above or below manual code. For GSUB, all features are there already and can be positioned manually.

I see. But is there a good reason against allowing # Automatic Code in GSUB features as well? It would be a great way to solve cases like the one I outlined above.