Skip to content

About Fonts and Character Encoding

Tim Brayshaw edited this page Dec 2, 2019 · 6 revisions

The PDF specification requires that PDF readers support a core set of fonts. These fonts are as follows:

  • Courier (Normal, Bold, Oblique, and BoldOblique variants)
  • Helvetica (Normal, Bold, Oblique, and BoldOblique variants)
  • Times (Normal, Bold, Oblique, and BoldOblique variants)
  • Symbol
  • ZapfDingbats

These fonts only support Windows ANSI encoding. In order for a PDF to display characters that are not available in Windows ANSI you must supply an external font, which will be embedded in the PDF. dompdf will embed any referenced true-type font in the PDF that has been pre-loaded or is referenced in a CSS @font-face rule.

Dompdf supports the same fonts as the underlying R&OS PDF class: Type 1 (.pfb) and TrueType (.ttf) so long as the font metrics (.afm/.ufm) are available. The bundled, PHP-based php-font-lib provides support for loading and sub-setting fonts.

As of dompdf 0.6.0 the DejaVu TrueType fonts have been pre-installed to give dompdf decent Unicode character coverage by default. To use the DejaVu fonts remember to reference the font in your stylesheet, e.g. body { font-family: DejaVu Sans; } (for DejaVu Sans).