There's a whole, let's say, scripting engine that lets the font decide which glyph is going to be used that goes way further than just simple ligature substitution. People have even implemented "games" as fonts this way: https://www.coderelay.io/fontemon.html