Fonts kept inside the file

Text set in a font the file carries inside it, cut down to the letters actually used.

The text is set in a font the file carries inside it, so the page looks the same on a computer that has never had that font installed. Only the letters actually written are carried: a page of a dozen words holds a dozen letter shapes, not the whole alphabet.

Cutting the font down to size is the easy half. The hard half is that the words have to come back out again: the file carries a table tying every shape it drew to the letter that shape stands for, and the engine's checks pull the text back out of the finished PDF to prove it. Without that table the page looks perfect and nothing in it can be searched or copied.

What this example shows

  • A TrueType font embedded and subset to the glyphs drawn.
  • A character map that keeps the text searchable and copyable.
  • Any font file named on the command line, not one fixed choice.

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 Fonts kept inside the file

What this document weighs

Before 111,279 bytes
Now 41,000 bytes
Saved 63.2 %

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

Examples near this one

A minimal PDF

The smallest complete file: a page, and shapes drawn on it.

A boarding pass

A boarding pass carrying the IATA BCBP string a gate scanner reads.

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.

Every example, by subject

Glossary

subset
Putting into the file only the letters the document actually draws, instead of the whole typeface. A typeface holds thousands of shapes; a letter or an invoice uses a few dozen. Carrying only those is what makes the files here small.
glyph
One drawn shape of a typeface. The letter A is a character; the particular drawing of it that lands on the page is a glyph.