Typographic quality of dynamically generated PDF outputs

By Jan Tošovský on Mar 12, 2016

When browsing various documents it is noticeable some of them are pleasing to the eye more than others. Attractivity is related mainly to the symmetry of page elements, text homogeneity or color combinations. These conventions are covered by discipline called typography. The majority of rules can be fulfilled by thoughtful choices of page layout, fonts and advanced settings of paragraph styles.

The larger text areas, the more disruptive elements that affect the visual appearance. It is caused mainly by punctuation, spaces or even certain combinations of ordinary characters. This disharmony becomes even worse when the block of text is justified into a narrow column. To eliminate these artifacts several techniques were developed. They are usually referred as microtypography. Without its support in the layout engine its hard to fix related issues just by tweaking the design like in the previous case. Neither manual interventions helps as outputs are produced dynamically and content may vary.

Without high quality tools it is barely possible to achieve high quality outputs. The key functionality is the support for advanced OpenType font features and the availability of microtypographic techniques.

Font Features

The choice of the font has essential influence on the final appearance. But it is not only the glyph design what determines the font quality. The font should also contain the rich set of various features enhancing its versatility. The ways of improving the low font quality during the processing are very limited.


Without the tweaking of horizontal positions of certain character combinations a visually disturbing gap would be apparent between these characters. There are corresponding differences specified in high quality fonts covering the majority of these combinations.

Source file: ConTeXt, XeLaTeX, HTML

These values are optimized usually for typical body text sizes. In case of large titles they may be suboptimal and this is the reason why e.g. Adobe InDesign offers a special option 'Optical' kerning utilizing custom algorithms.


Certain combinations of characters produce optically disturbing effects. Hight quality fonts contains well designed single character replacements for them which can be applied automatically during the processing.

Source file: ConTeXt, XeLaTeX, HTML

Besides common ligatures (a) there are also decorative (b) or historical (c) ones. Their replacement is usually deactivated by default.

Source file: ConTeXt, XeLaTeX, HTML

Distribution of ligatures into the particular ligature class is font specific. While in Minion Pro the Th combination belongs to the group (a), hence replaced automatically, in Palatino Linotype it is part of decorative ligatures (b) and its replacement has to be forced. Also ct, sp and st ligatures are treated differently. It is worth mentioning that InDesign doesn't distinguish groups (b) and (c) so they cannot be activated independently.

Small Capitals and Old-Style Figures

In certain documents the text is emhasised using small capitals. High quality fonts have the special set of characters for this purpose (c), which unlike faked small caps, i.e. capital letters downsized to the size of body text (b), optically matches.

Default figures may be too heavy in common text (a, b). They can be lightened optically using special figure variants (c) that match with the body text.

Source file: ConTeXt, XeLaTeX, HTML


It stands for the set of techniques, the goal of which is to enhance the aesthetic value of the output. It is beneficial especially for justified text.

Optical Edge

In case of certain characters located at the line edge the line itself appears optically shorter. This can be enhanced by protruding given characters completely or partially outside the text block.

Source file: ConTeXt, XeLaTeX

Text Block Homogenization

This technique is based on local modifications of default letter and word spacing as well as character widths. The aim is to eliminate all disturbing effects, especially in the narrow text blocks, without any naked-eye apparent character deformations. For dynamically generated outputs it is desirable to handle all this automatically.

In specific cases when the text contains lot of short words difficult to hyphenate it also helps to fit everything into the text box.

Source file: ConTeXt

Support in dynamic PDF producers

Engine Input Format Unicode RTL, bidi Font Features Optical Edge Auto Text Block Homogenization Price Active Development
Adobe InDesign Server proprietary yes yes yes yes yes ??? yes
QuarkXPress Server proprietary yes yes yes yes no ??? yes
LuaTeX TeX yes yes yes yes yes (1) 0 yes
XeTeX TeX yes yes yes yes no 0 yes
pdfTeX TeX no no yes yes yes (2) 0 no
Heirloom troff troff yes yes yes yes no 0 no
Apache FOP XSL-FO yes yes partial (3) no no 0 yes
RenderX XEP XSL-FO yes yes partial (3) no no from $400 yes
Antenna House Formatter XSL-FO yes yes partial (3) no no from $1250 yes
PrinceXML HTML+CSS yes yes yes no no from $495 yes


  1. With a ConTeXt pre-processing (the LuaTeX engine itself offers the font expansion only).

  2. http://texdoc.net/texmf-dist/doc/latex/microtype/microtype.pdf

  3. Without a font feature switching (not covered in the XSL-FO standard). Only few features are available, e.g. kerning or ligatures.


There is apparent winner in this race, LuaTeX. It is worth noting that LuaTeX consumes low level TeX commands only, so it is used rather indirectly in conjunction with e.g. ConTeXt macropackage. This tool-chain has been used for producing all the images in this article.

These images can be produced in alternative engines using corresponding source files. XeLaTeX macros for XeTeX engine and HTML files for e.g. PrinceXML engine.