# Extreme ligatures cancel each other out?

Hey everyone - I am working on a font with tons of required ligatures, and I have come to a point where they seem to cancel each other out. The concept of the font is disobedience -may have shot myself in the foot with this one lol. Every other letter should trigger a ligature, so the meaning of the word changes as you go on typing and the writer can never fully predict the outcome. I kinda took inspiration from here. It’s experimental and fun, and I have made some good progress. But there are some ligatures i just cant get to trigger. For example the t_h ligatures - t h gets transformed into t_h, and t_h e into t_h_e without problems, but for some reason it stops there and neither t_h_e_space nor t_h_e_s work. Out of desperation i have added every possible way the string might occur but it won’t happen.

``````sub t h by t_h;
sub t_h e by t_h_e;
sub t h e by t_h_e;
sub t h_e by t_h_e;
sub t_h_e space by t_h_e_space;
sub t_h_e s by t_h_e_s;
sub t_h_e s by t_h_e_s;
sub t h e s by t_h_e_s;
sub t h e_s by t_h_e_s;
sub t_h e_s by t_h_e_s;
``````

Seeing as this is a case of ligature overkill beyond what is covered in most tutorials, I was hoping maybe some of you might help me find a better practice than just listing substitution rules. Thanks for any advice!

You have to sort the substitutions in the right way. Usually the longer ones first.
like:

``````sub t h e by t_h_e;
sub t h by t_h;
``````

Thank you!!
So I have about 250 lines sorted by name, which results in the shorter ligatures being called first. If i sub-sort by length and go long to short for each starting glyph it should be ok?

in the example you go straight from t h e to t_h_e - does it mean i can cut out all the substitution rules taking previous ligatures as starting points?

Yes and yes.

Turns out that with rlig, no matter the order
t h e s will not be turned into t_h_e_s
but with dlig, it works. I think i will use dlig for all instances where only the form is altered and in the cases i want to sub whole words by others i do it via rlig.

Can you show the full feature code?