Ported some changes over from the trueType branch