Reversed chaining context help needed

Reverse Chaining contextual single substitution is specifically meant for Arabic script writing styles. Unfortunately terminal forms (fina) can’t be used either as that is also meant for Arabic scripts.

But fortunately there is an elegant way to achieve what you want. This code, based on OpenType feature code from this post should do the trick:

script latn {
  feature ContextualAlternates;
}

class @lowercase [a-z];
class @lowercasefina [a.fina-z.fina];
class @lowercase_all [A-Z a-z a.fina-z.fina];

feature ContextualAlternates calt {
  lookup ChainingContextFina;
}

lookup ChainingContextFina {
  context (@lowercase_all) @lowercase;
  sub 0 SingleSubstitutionFina;
}

lookup SingleSubstitutionFina {
  sub @lowercase -> @lowercasefina;
}