mPDF Manual – Fonts & Languages

Character substitution

(mPDF ≥ 5.0)

Core fonts

In documents using core fonts only, only characters included in the win-1252 codepage are available in the Arial/Helvetica, Times or Courier fonts. If the document includes characters which are included in the other core Adobe fonts - Symbols, or  Dingbats - these will be substituted. Because they are displayed using a different font they may appear ‘odd’.

Unicode fonts

In Unicode Truetype files, the limitation is whether the font file contains a “glyph” for each character in the document. Character substitution (i.e. substituting a different font solely to display that character) can be enabled by setting the useSubstitution configuration variable.

<?php

$this->useSubstitutions = true;

mPDF will try to find substitutions for any missing characters:

  1. if the character is in Unicode Plane 2 (SIP) i.e. Unicode value > U+20000:
    1. looks in the sip-ext font file (see Fonts in mPDF 5.x)
    2. looks in the font defined by backupSIPFont configuration variable
  2. looks to see if the character is available in the core fonts: Arial/Helvetica, Times, Courier, Symbols or ZapfDingbats
  3. looks in each of the the font(s) set by backupSubsFont configuration variables

It is not recommended to enable this for regular use, as it will add to the processing time.

Fork me on GitHub