ENH: Better text SDF calculation

This improves the SDF calculation a little bit. Ready for review/merge from my end.
ubyte and uint8 are the same, right?