ENH: Better text SDF calculation

This improves the SDF calculation a little bit. Ready for review/merge from my end.
+1  I've run into this several times as well.