AFDKO (and feaKit?) also sort by GID, which is bonkers, what does GID have to do with any of this?
Yes, feaKit follows the few spec on this one. I’ll see if I can change that.
Would it make sense to only sort by number of components? Otherwise it might break too many existing fonts?
Sorting by number of components would fix the issue here (I think) and would match what feaLib is doing.
I had a look at the code. It seem that the ligatures inside one subtable need to be sorted by the first char. Those are stored in a coverage table and it will store its content by glyphID.