(mPDF ≥ 5.0)
Note: Prior to mPDF 5.0 there were 2 configurable variables,
$this->useSubstitutionsMB. controlling behaviour of core fonts and unicode fonts respectively. From mPDF 5.0,
character substitution using core fonts is always ON and cannot be disabled by configurable variables.
$this->useSubstitutionsMB is deprecated but it is recognised as an alias for
$this->useSubstitutions controls behaviour in Unicode font documents.
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’.
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
<?php $this->useSubstitutions = true;
mPDF will try to find substitutions for any missing characters:
- if the character is in Unicode Plane 2 (SIP) i.e. Unicode value > U+20000:
- looks in the sip-ext font file (see Fonts in mPDF 5.x)
- looks in the font defined by
- looks to see if the character is available in the core fonts: Arial/Helvetica, Times, Courier, Symbols or ZapfDingbats
- looks in each of the the font(s) set by
It is not recommended to enable this for regular use, as it will add to the processing time.