If you're drawing more than a few words, the first thing you have to do when drawing text on the screen is to break it up into lines. Usually a text-rendering process will maintain a line starts array that lists the offset in the backing store of the first character of each line of rendered text. To draw a block of text, you must first build that line starts array.
Dividing a block of text up into lines generally proceeds in three conceptual phases:
Locate all the positions in the text where a line break has to go. This step divides the text into a series of blocks. For the purposes of this discussion, we'll call these blocks “paragraphs,” although most word processing programs allow forced line breaks within a paragraph.