Breaking an Overlong Word
A word longer than the column that holds it: the library leaves it whole, cuts it at the column's edge, or cuts it and closes the line on a hyphen.
Text longer than a caption has to be broken into lines. Its length varies, the column has a fixed width, and the library decides where each line ends. The break is set block by block: the column width and the alignment you choose hold for every line of that block, on every page.
Nothing here counts characters, because a letter is not a fixed width: an i takes a third of the room an m takes. Every candidate line is measured in the very font that will draw it, at the size it will be drawn at, which is the only way the right edge of a justified column comes out straight instead of ragged by a hair. The same paragraph is set four ways here, so the four can be compared side by side rather than described.
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
Open the document in English Open the document in French Open the document in German Open the document in Spanish Open the document in Italian Open the document in Portuguese
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 word longer than the column that holds it: the library leaves it whole, cuts it at the column's edge, or cuts it and closes the line on a hyphen.
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 four times: file paths and compounds running past the edge with no break points, wrapping where a break after a slash or a hyphen is allowed, then wherever their punctuation allows one, and last with no-break hyphens that keep each compound whole.
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.
A delivery slip poured into two boxes, the second taking up where the first stopped, and a poster whose picture no box can hold, each box saying what became of the stack in it.
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.