ENH: Better text SDF calculation

This improves the SDF calculation a little bit. Ready for review/merge from my end.
Any particular reason for this?