Fix text utils for vertical text.

Close #504.