Stamps Fitted to a Rectangle

DRAFT, COPY, PAID, SPECIMEN: the words a document says about itself, and the first thing an auditor looks for. They have to be unmissable and they have to lie across whatever they are marking — a whole page today, one table cell tomorrow, a translated word half as long again next month — so their size can never be settled in advance.

Here the word is turned first and only then made to fit, which is the order that matters: what has to sit inside the rectangle is the word as the reader sees it, on the slant, not the flat word it was before. Give it a wide rectangle, a tall one, a table cell or a whole page and it comes out filling that shape, with no size to work out and nothing to redo when the word is translated. Draw the stamp before the page and it lies under the text; draw it after and it lies over it. A watermark is the other way round: it is given to the document once, and the document lays it on the pages it names — here every even page from the second on, at the same size on each.

What This Example Shows

  • One word made to fill rectangles of four different shapes.
  • Turned before it is fitted, so the slanted word is what has to fit.
  • The same wording stamped across a page, a cell and a field.

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

Examples Near This One

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.

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.

Every example, by subject