More refactoring of the text renderer.

R=amoser@google.com

Review URL: https://codereview.appspot.com/107460044