Moved new-line inserts to before line rendering.

This fixed a bug where the new line inserts result in an incorrect
amount of space inserted if the font size changed to a larger or smaller
one.