Hi,
I have designed fonts before. Persian fonts. But I had never changed too much the OpenType features except the ligatures and intial, medial,… and diacritics and stuff like that.
But now I’m designing a Persian font with detached separated glyphs (like a Latin one).
And I have decided to do a {salt}. But it is a little complicated and I only do these things with the Open Type Designer, so maybe it is my lack of scripting capabilities.
It goes like this:
Substitute Kaf (only inital and medial) with a glyph I added myself to the Persian standard glyphs named _longKaf if all the next glyphs after Kaf are some glyphs gathered in a Class for example @NotDotAbove. Also do all of these just when users set the text to {salt}.
So I want to know which kind of substitution works better here and how? I did single sub, it worked but does the sub all the time.
Any help?

I think what you need is a contextual substitution (calt)
Thanks.
I did that too, but I can’t make that to ignore some glyphs. It would apply the substitution at all times.
Should I use ChainingContext?
I have only ever used a chaining context for Ordinals.

I think what you need is a Reverse Chaining Context
Could you please tell me how to replace 2 glyphs with 1 new glyph but only when:
1- Certain Class is in front of the 2 glyphs.
2- Text is set on a salt or calt.
And also do this with reverse chaining context?
I really don’t know! 
Here is some OpenType layout feature code that will replace “12” with “3” if it is typed after a capital letter:
script latn {
feature ContextualAlternates1;
feature StylisticAlternates1;
}
class @Uppercase [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];
feature ContextualAlternates1 calt {
lookup ChainingContext1;
}
feature StylisticAlternates1 salt {
lookup ChainingContext1;
}
lookup ChainingContext1 {
context (@Uppercase) one two;
sub 0 Ligature1;
}
lookup Ligature1 {
sub one two -> three;
}
The above sample should provide enough information for you to get started.