Substituting sequences of letters (Ordinal feature)

Hey all, so I’m trying to write an Ordinal feature that will substitute sequences of letters like TH, RD, and ND with the corresponding modifier glyphs when placed after a number.

I’ve tried all sorts of different things so far but the closest I’ve got to getting it to work is the following:

sub [zero one two three four five six seven eight nine] [A a]’ by ordfeminine;
sub [zero one two three four five six seven eight nine] [O o]’ by ordmasculine;
sub [zero one two three four five six seven eight nine] [T H]’ by [tmod hmod];
sub [zero one two three four five six seven eight nine] [R D]’ by [rmod dmod];
sub [zero one two three four five six seven eight nine] [N D]’ by [nmod dmod];

The problem is that this code doesn’t successfully substitute the second letter.

Any help would be much appreciated!

You are trying to do a contextual many to many substitution. That is not supported by OpenType or more precisely the Adobe Feature file syntax.
Something like this might work:

sub [zero one two three four five six seven eight nine] [N]' [D] by nmod;
sub [zero one two three four five six seven eight nine] [nmod] [D]' by dmod;

1 Like

Perfect. Thanks, Georg!