I followed the instructions for “contextual cycling” in part 3 of the alternates tutorial. The font is all-uppercase, with different versions of each letter in the upper and lower case glyphs. Whenever there’s two of the same letter in a row, I want to substitute the alternate.
I created two classes:
DEFAULT = A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z
ALT = a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
and then put
sub @DEFAULT@DEFAULT’ by @ALT;
into the liga feature
It works, but only at the beginning of words, not in the middle of words. Here’s a double E at the beginning, and in the middle. The first one substitutes, the second does not.
Isn’t your code set up to substitute the second of any pair of alphabetic characters, not just identical ones? So it’s substituting the second of the pairs aa, Ab, etc., not just aa and bb.
Oh yes, you’re right. It’s substituting the second letter in the word, whether they’re duplicates or not. I misunderstood what it did. Thanks. Will try something else!