Contextual alternate only after and before certain letters

Hello,

I have a question concerning contextual alternate. I’m working on an uppercase stencil font and need to mirror the letter T under certain conditions (depending on the letter that follows) – for example in “FIT“ and “KNITWEAR“ but not in “WITH” or “ITALY“.
Can somebody help me out with the opentype code needed for that? Or did I missed something?

Best,
Johannes

I do not understand your example because I do not see the need for ligatures. Can you post a screenshot?

That would be a contextual ligature substitution, a case for clig (technical spec). So in Font Info > Features, add a new feature via the plus button, call it clig, and add contextual rules.

For learning contextual rules, please read the tutorial about contextual substitutions. You can adapt it with a many-to-one substitution (as opposed to the one-to-one substitution in the example in the tutorial).

Alternatively (and preferably), I would look into a simple contextual alternate, i.e., only replace the I, and not introduce a ligature. This makes it easier for diacritics. Think of Í, Ì, Î, etc.

I do not understand your example because I do not see the need for ligatures. Can you post a screenshot?

That would be a contextual ligature substitution, a case for clig (technical spec). So in Font Info > Features, add a new feature via the plus button, call it clig, and add contextual rules.

For learning contextual rules, please read the tutorial about contextual substitutions. You can adapt it with a many-to-one substitution (as opposed to the one-to-one substitution in the example in the tutorial).

Alternatively (and preferably), I would look into a simple contextual alternate, i.e., only replace the I, and not introduce a ligature. This makes it easier for diacritics. Think of Í, Ì, Î, etc.

Thank you for the quick answer @mekkablue. Contextual alternates seem to be what I was looking for – I changed the thread’s topic. Sorry for the confusion.
I can’t post screenshots right now but I need the alternates to get better readability.

I read the tutorial some days ago but all what I found was how to change a glyph depending on the previous glyph. What I need is: How do I alternate a glyph depending of the previous glyph and the next.
Let’s say: I want to alternate the T when the previous glyphs is an I but not when it’s followed by an H the same time (like shown above: alternate the I in “FIT“but not in “WITH”).

I found the solution on the web, finally. This is the code using the calt-Feature for a contextual alternate that is ignored under certain circumstances:

ignore sub I T' H;
sub w o r' d s by r.calt;

This solves the problem I had in the post before – it alternates the T when the previous glyph is an I but ignores it when the T is followed by an H the same time (like the I in “FIT“ but not in “WITH”).