Contextual Alternates not working in the middle of words


#1

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.

56%20AM

weird…

John


#2

What was the string you originally typed? I suspect you typed an upper and lowercase E next to each other.


#3

Uh, no. :slight_smile:

here’s another snapshot. i typed “aabbccdd”. Only the first pair substitutes.

john


#4

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.


#5

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!


#6

Got it! Set up the consonants and vowels to replace separately and it’s working perfectly.

Con0 = lowercase cons.
Con1 = uppercase cons.
Vow1 = lowercase vowels
Vow2 = uppercase vowels

sub @Con0 @Con0’ by @Con1;
sub @Vow0 @Vow0’ by @Vow1;

second of each double letter is a substitute. Thanks for the clue!

John