Breaking an Overlong Word

This example sets the same paragraph three times 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, and a cut mark, where one is given, closes each line a cut ends on a hyphen.

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.

What This Example Shows

  • The same paragraph running past the edge of the column, then kept inside it, then kept inside it with a hyphen at each cut.
  • The three settings one above the other on the same page of the PDF.
  • The same choice on a block of text, on a table cell and on text that changes style part-way; this example shows only the block of text.

The Source Code, Complete

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 Itself

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

Breaking an Overlong Word, first page

In the API Reference

The Same Document in Other Languages

This document weighs 13.9 kB

Examples Near This One

Break Points After a Slash or a Hyphen

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 Stack Laid out by Hand, One Box at a Time

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.

A Font behind the Font

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.

Every example, by subject