Breaking a paragraph up, and aligning it
A paragraph broken into lines, then laid out four ways: left, right, centred, justified.
This example sets the same paragraph twice in a column too narrow for one of its words: every layout eventually meets the word that will not fit — a chemical name, a German compound, a web address, an order reference nobody thought about. The word turns up in production, in one record out of a thousand, long after the team signed the layout off, and it comes back with the next reference, whatever width the column is given. The overlong setting decides: overflow leaves the whole word to run past the edge, break cuts it after the last glyph that fits.
Left alone, the word runs past the right edge and out of the column, over the margin and sometimes off the paper — honest, and ugly. Told to break, it is cut after the last letter that fits and the rest goes on the next line, so nothing escapes the column whatever arrives in it. The choice is made block by block, because a narrow table cell and a paragraph of running text do not want the same answer.
Nothing is left out and nothing is simplified: this is the program exactly as it runs, for the developer who uses this library. The third is the description itself: a plain list of what the page has to say, which is what the service is sent.
Read the Rust source Read the Python source Read the JSON source
The document is lighter than it was, and every page still looks exactly the same. See this document's row in the table of every example.
A paragraph broken into lines, then laid out four ways: left, right, centred, justified.
A justified column set twice: the long words breaking at their soft hyphens with a hyphen shown, or left whole, and a figure a no-break space keeps together.
A justified column set twice: file paths and compounds running past the edge with no break points, then wrapping where a break after a slash or a hyphen is allowed.
A title, a rule, two paragraphs, a heading, a table of twenty-six rows and a footnote, handed over in reading order and broken across two pages by the engine.
One line of statuses set twice: in a company font alone, where the characters it has no glyph for come out as empty boxes, then with a second font behind it that draws them.
Four samples set twice each, once plain and once with a single setting activated: joined letters, small capitals, figures that hang below the line, and pairs moved closer together.