Stamps fitted to a box

What a document says about itself — DRAFT, COPY, PAID — laid across boxes of four different shapes and scaled to each.

DRAFT, COPY, PAID: the words a document says about itself. A stamp here is scaled to the box it is given rather than set in a fixed size, so the same line stamps a whole page, a table cell or a form field without any text size having to be worked out.

It is turned first and scaled second, and the order matters: what has to fit inside the box is the line as the reader sees it, on the slant, not the horizontal line it was before. The stamp takes whatever colour it is given and nothing else, so if you want it under the page's own ink, simply draw it first.

What this example shows

  • One line of text scaled to fill a box of any shape.
  • Turned before it is scaled, so the slanted line is what fits.
  • The same call stamping a page, a cell and a field.

The code, in full

The same document is written twice, once in each language. Both files are shown in full, with the code coloured on the server, and can be copied in one click.

The document itself

The same document is written in each of these languages. Open the one you want to look at.

Open the document in English Open the document in French

Read the Rust source Read the Python source

First page of Stamps fitted to a box

What this document weighs

Before 110,127 bytes
Now 39,656 bytes
Saved 64.0 %

Not one mark on the page changed. See every document measured.

Examples near this one

Soft hyphens and no-break spaces

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.

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.

Text poured into columns

One long passage poured into three columns, each fitting the lines its height allows and handing the rest to the next.

Every example, by subject

Glossary

CMYK
The four inks a printing press lays down: cyan, magenta, yellow and black. A screen mixes light instead, so a document going to a press states its colours in inks, not in screen colours.