Just check out the code for it to see how it works!
I've been using my text engine for a while and I just thought I would share it now :D Feel free to use but please give credit!