Contextual glyph insertion (mk II)

I have a line like this:

trigger @class1 @class1 @class2 @class3

After the last class, I would like to insert a glyph:

@class3 (in this specific context) –> @class3 inserted_glyph

So, there are classes, contextual substitution & one-to-many all at once. Is this even possible?

(I noticed the old thread on the topic, but was not able to apply it to my specific challenge.)

What I wanted to do, but can’t be done is:

sub trigger @class1 @class1 @class2 @class3' by @class3 inserted_glyph;

This is just one of many lines, all requiring an inserted glyph in a specific context.

That can be done by chaining substitutions. Check out the Adobe FDK feature code page about details.

One-to-many substitutions cannot be done contextually. One workaround is to have one lookup that replaces group 3 with ligatures of group 3 glyphs and the insertion glyph. And then a separate lookup with simple one-to-many rules, that split the ligatures into group 3 glyphs plus the insertion glyph.

Yes, they can. it is something like this (type in Safari…)

# this goes in a prefix, not in the features section.
lookup oneToMany {
   sub a by b c;
} oneToMany;

# this goes in a feature:

sub @class1 @class2 a' lookup oneToMany @class3;


1 Like

Thanks. This works perfectly.