Combination between .calt and .ss01 – possible?

Hello everyone!

I’m working on an irregular font with “bouncing” characters. Whenever two equal characters stand in a row (like ii or gg), the contextual alternates feature pops in and replaces one of them with an alternative (.alt) version of that letter. So far, so good.

But now, I would like to create a second style within the same font. It should have reduced bouncing for better legibility. It should be up to the user to choose between the headline- or the textversion. In other words, I’m about to combine the calt-feature with a stylistic set (=four versions of each letter). But is this even possible in Opentype? Or do you recommend another OT-feature for this purpose?

I’m grateful for any help! :blush:

I’ve now tried to realize this plan: There are these four versions of the letter a:
a, a.alt, a.ss01, a.alt2

The contextual alternates feature looks like this:
sub a a’ by a.alt;
sub a.ss01 a.ss01’ by a.alt2;

Exporting this font ends up in an error message (unknown failure) and when I nevertheless install the fontfile and have calt and ss01 feature running at the same time, it’s replacing a.ss01 with a.alt instead of a.alt2.

I guess, this is just not possible in Opentype, or do you see a another way?

Look out for your features’ order.
Your code should work if calt is placed after ss01. But you shouldn’t do that because calt should be before all stylistic sets. Instead, in ss01 you should add something like this:
sub a a.alt' by a.alt2
and you can remove the second line of your original code.

Great, jeremie, thanks to your advice, it works now properly (although I have still this worrying error message when exporting the file)!