A contents page with dot leaders

Everybody has met the contents page where the dots run right into the page number on one line and stop two centimetres short on the next. It happens because the dots were typed in, and the day a title changes length the count is wrong. Nobody sees it while the document is being written; it shows up on the printed copy, at the customer's.

Here nobody types a dot. Each row is filled with exactly as many as the room left over holds, once the title and the page number are in place. Change a title, translate the whole document, set it in another font: the dots still meet the numbers, on every line, without anybody going back through the list.

What this example shows

  • Rows of dots filled to the room left over, never typed by hand.
  • Titles on the left and page numbers hard against the right.
  • Entries that survive translation without the dots going wrong.

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

A contents page with dot leaders, first page

Optimised, this document weighs 14.2 kB — at least 85 % lighter than most PDF generators would write it

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.

Examples near this one

Breaking an overlong word

A word longer than the column that holds it: the library leaves it whole, or cuts it at the column's edge.

Break points after a slash or a hyphen

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 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