Refactor out duplicated font scaling bits.