I have programmed “r.init” to be a contextual alternate to come after a space. But at the beginning of a line, the “r.init” is not replacing the regular “r”. Please see the sample font and the other attachment for reference. How do I fix this?
script latn {
feature ContextualAlternates;
}
class @hightail [b o q v w b.high o.high q.high v.high w.high b.init o.init q.init v.init w.init];
class @lowercase [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];
class @lowercasehigh [a.high b.high c.high d.high e.high f.high g.high h.high i.high j.high k.high l.high m.high n.high o.high p.high q.high r.high s.high t.high u.high v.high w.high x.high y.high z.high];
class @lowercaseinit [a.init b.init c.init d.init e.init f.init g.init h.init i.init j.init k.init l.init m.init n.init o.init p.init q.init r.init s.init t.init u.init v.init w.init x.init y.init z.init];
class @lowercasefina [a.fina b.fina c.fina d.fina e.fina f.fina g.fina h.fina i.fina j.fina k.fina l.fina m.fina n.fina o.fina p.fina q.fina r.fina s.fina t.fina u.fina v.fina w.fina x.fina y.fina z.fina];
class @lowercase_all [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 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 a.high b.high c.high d.high e.high f.high g.high h.high i.high j.high k.high l.high m.high n.high o.high p.high q.high r.high s.high t.high u.high v.high w.high x.high y.high z.high a.init b.init c.init d.init e.init f.init g.init h.init i.init j.init k.init l.init m.init n.init o.init p.init q.init r.init s.init t.init u.init v.init w.init x.init y.init z.init a.fina b.fina c.fina d.fina e.fina f.fina g.fina h.fina i.fina j.fina k.fina l.fina m.fina n.fina o.fina p.fina q.fina r.fina s.fina t.fina u.fina v.fina w.fina x.fina y.fina z.fina];
feature ContextualAlternates calt {
lookup ChainingContextInit;
lookup ChainingContextFina;
lookup ChainingContextBetween;
lookup ChainingContextHighTail;
}
lookup ChainingContextBetween {
context (@lowercase_all) @lowercaseinit (@lowercase_all);
sub 0 SingleSubstitutionInitToNormal;
}
lookup ChainingContextFina {
context (@lowercase_all) @lowercase;
sub 0 SingleSubstitutionFina;
}
lookup ChainingContextHighTail {
context (@hightail) @lowercase;
sub 0 SingleSubstitutionHighTail;
}
lookup ChainingContextInit {
context @lowercase (@lowercase);
sub 0 SingleSubstitutionInit;
}
lookup SingleSubstitutionFina {
sub @lowercase -> @lowercasefina;
}
lookup SingleSubstitutionHighTail {
sub @lowercase -> @lowercasehigh;
}
lookup SingleSubstitutionInit {
sub @lowercase -> @lowercaseinit;
}
lookup SingleSubstitutionInitToNormal {
sub @lowercaseinit -> @lowercase;
}
Each line starts as a new glyph run, so you can’t add a newline within feature code.
the /r is designed like that so that the letters coming before it can attach seamlessly. So yes, I would like the r.init to be the replacement in situations where there is a space or a new line before the r.
Which, with them swapped around, is what the version I uploaded does. Just need to add appropriate letters into the class for when /r (the swapped around version) it is preceded by the class letter.