Today we’re starting a new series of educational posts about PDF optimization. Reducing the size of a document without losing its quality becomes a crucial issue when more and more documents need to be stored and archived online.

For a general overview of fonts in PDF documents, you can read our previous article here.

Text is one of the fundamental tools for information interchange. In PDF the text is represented by text elements in page content streams. A text element specifies that characters should be drawn at certain positions. The characters are specified using various encoding techniques and font resource types. Fonts in PDF exist in two main categories. Simple fonts and Composite fonts.

In Simple fonts, the glyphs (outlines) are selected by single-byte character. These codes are indexed in a table of 256 glyphs. The mapping from codes to glyphs is called the font’s encoding which is built in each font program.

Composite fonts use CID’s (character identifier) as an intermediary step during processing. They are typically used to handle writing systems where there are a very large number of characters, such as in Japanese or Chinese writing systems.

Except for Type 3 fonts and standard Type 1 fonts, every font dictionary contains a subsidiary dictionary, the font descriptor, containing font-wide metrics and other attributes of the font. Among those attributes is an optional font file stream containing the font program.

This allows the font to be distributed with the document and avoids potential problems that can occur if the required fonts are not available on the system that is processing the PDF document. Because of this many of the specialized PDF standards require all fonts to be embedded in the PDF document.

This, however, comes with a potentially negative impact on document file size. Embedding typical TrueType font in a document can in many cases lead to inflating the file size by several orders of magnitude.

We can use several techniques to reduce the size of the font program and keep the document content and quality unaffected.

One of the most effective and universal is font data stream compression.