Shrunk headings and a turned label

A heading whose length you do not control is a small crisis: a product name, a customer's company, a title that grew by a third on its way into German. Choose a size small enough for the worst case and the ordinary one looks timid; choose one that suits the ordinary case and the worst runs off the page. Neither is a decision anybody should be making by hand, document after document.

Here each heading is set at the largest size that still fits the column, so long ones come down to meet short ones and the page keeps one width. The other thing on the page is a quarter turn: a line running up the left margin the way a title runs up the spine of a book. That margin is room already paid for, and a reference or a copyright line put there costs the page nothing.

What this example shows

  • The largest size at which a line still fits its column.
  • Text turned a quarter turn about a point you choose.
  • Headings of unequal length brought to one common width.

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

Shrunk headings and a turned label, first page

Optimised, this document weighs 10.6 kB — at least 90 % 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