I don't know if this is exactly what you're looking for, but my Open Source Joscelyn font (imitating English secretary hand) has three or more variants for a good many lowercase letters, mostly managed by calt. I don't know that the code is the prettiest in the world, but it is thoroughly commented. My historical script fonts mostly work the same way (see e.g. Cerne, and especially the variants for t).
Comments
Here is my code for four: