Embedding fonts: Font substitution file

The Fixup "Embed missing fonts" offers the possiblity to define a "Font substitution file", which can contain one or more lines of text, defining rules of how fonts (which are not available on the respective system) shall be replaced with other fonts.

Besides other options, the "Font substitution policy" can be defined in the Fixup.

Apart from choosing the options from the drop down, own substitution policies can be created based on the following syntax. Clicking the + button opens the following window where substitution policies can be defined.

Syntax for font substitution files

Please use a simple text editor to edit or create the policy files and save them as UTF-8.
All values have to be tabulator-separated. Hash signs "#" at the beginning of a line means they are comments and will not be taken into account by the engine.

The following substitution modes are available:


The first font of a list of font names is substituted by the following fonts. The order of the possible replacement fonts is regarded.
SubstituteFirst<tab>font substituted<tab>fontname<tab>fontname<tab>fontname ...

Regular Expressions

It is possible to use RegEx in SubstituteFirst lines. Example:
SubstituteFirst   '(.*)Bold(.*)Italic'   'Arial(.*)Bold(.*)Italic'   '\1Regular'   '\1'

Any font name that uses "Bold" and "Italic" with any additional characters will be replaced by any font that uses  "Arial", "Bold" and "Italic" (with any additional characters in between of these phrases). If that cannot be found any font that has the same characters at the beginning (indicated by \1) and then "Regular" and if that is also not present any font that only has the same beginning.
Font substitution with RegEx will be used if normal substitution (without RegEx) was not successful.

Substitute All

This mode allows to define a list of fonts in which all fonts can substitute each other.
If any of the fonts of a list is missing it will be substituted with the next font in the list.
If this next font is also missing the previously listed font name will be searched.
If that is also missing, the font after the next font is tried and so on.
SubstituteAll<tab>fontname<tab>fontname<tab>fontname ...

Regular Expressions

In SubsituteAll RegularExpressions are not supported for performance reasons.

The engine ignores all characters other than a-z, A-Z and 0-9. That means "Helvetica Bold", "Helvetica-Bold" and "HelveticaBold" are all the same. It might still make sense to have them all in a configuration file for documentation and clarity (and that is the reason why they are all present in the predefined fontsubsitution.cfg).


The entry below defines that Arial is substituted with Helvetica and Helvetica with Arial.
At the end of this example, there are further entries allowing more comprehensive font substitutions.
To use them the '#' at the beginning of the line needs to be removed.

SubstituteAll	Arial	ArialMT	Helvetica	Helvetica Neue	Futura	Helvetica Neue	Microsoft Sans Serif	MS PGothic	Trebuchet MS	Verdana
SubstituteAll	Arial Bold	Arial-Bold	ArialMT,Bold	Helvetica Bold	Futura-Bold	Futura Bold	Helvetica-Bold
SubstituteAll	Arial Italic	Arial-Italic	ArialMT,Italic	Helvetica Italic	Helvetica-Italic	Futura-Italic	Futura Italic	Arial Oblique	Arial-Oblique	Helvetica Oblique	Helvetica-Oblique	Futura-Oblique	Futura Oblique
SubstituteAll	Arial Bold Italic	Arial-Bold-Italic	ArialMT,BoldItalic	Helvetica Bold Italic	Futura-Bold-Italic	Futura Bold Italic	Arial Bold Oblique	Arial-Bold-Oblique	Arial-BoldOblique	Helvetica Bold Oblique	Helvetica-BoldOblique	Futura-Bold-Oblique	Futura Bold Oblique
SubstituteAll	Arial Black	Arial-Black	Helvetica Black	Helvetica-Black	Futura-Bold	Futura Bold	Arial-Bold
SubstituteAll	Arial Narrow	Helvetica Narrow
SubstituteAll	Arial Narrow Bold	Helvetica Narrow Bold	Arial Narrow Fett	Helvetica Narrow Fett
SubstituteAll	Arial Narrow Bold Italic	Helvetica Narrow Bold Italic	Arial Narrow Fett Kursiv	Helvetica Narrow Fett Kursiv
SubstituteAll	Times-Roman	Times	Times New Roman	Garamond
SubstituteAll	Times-Bold	Times-Roman Bold	Times Bold	Times New Roman Bold	Times Fett	Times New Roman Fett
SubstituteAll	Times-Italic	Times-Roman Italic	Times New Roman Italic	Times Italic	Times Kursiv	Times New Roman Kursiv
SubstituteAll	Times-Bold-Italic	Times-Roman Bold Italic	Times Bold Italic	Times New Roman Bold Italic	Times Fett Kursiv	Times New Roman Fett Kursiv
SubstituteAll	Courier	Courier New	Courier Std New	Lucida Console	MS Gothic
SubstituteAll	CourierStd-Bold	Courier Std Bold	Courier Bold	Courier-Bold	Courier New Bold	Courier New-Bold
SubstituteAll	CourierStd-Oblique	Courier Std Oblique	CourierStd-Italic	Courier Std Italic	Courier Italic	Courier-Italic	Courier New Italic	Courier New-Italic	Courier Oblique	Courier-Oblique	Courier New Oblique	Courier New-Oblique
SubstituteAll	CourierStd-BoldOblique	Courier Std Bold Oblique	Courier BoldItalic	Courier-BoldItalic	Courier New Bold Italic	Courier New-Bold-Italic	Courier BoldOblique	Courier-BoldOblique	Courier New Bold Oblique	Courier New-Bold-Oblique
#SubstituteFirst	'(.*)Regular'	Arial	Helvetica	'\1Regular'	'\1'
#SubstituteFirst	'(.*)Medium'	Arial	Helvetica	'\1Regular'	'\1'
#SubstituteFirst	'(.*)Bold'	'Arial(.*)Bold'	'Helvetica(.*)Bold'	'\1Regular'	'\1'
#SubstituteFirst	'(.*)Italic'	'Arial(.*)Italic'	'Helvetica(.*)Italic'	'\1Regular'	'\1'
#SubstituteFirst	'(.*)Black'	'Arial(.*)Black'	'Helvetica(.*)Black'	'\1Regular'	'\1'	Arial(.*)Bold'	'Helvetica(.*)Bold'
#SubstituteFirst	'(.*)Bold(.*)Italic'	'Arial(.*)Bold(.*)Italic'	'Helvetica(.*)Bold(.*)Italic'	'\1Regular'	'\1'
#SubstituteFirst	'(.*)Bold(.*)'	'Arial(.*)Bold'	'Helvetica(.*)Bold'	'\1Regular'	'\1'
#SubstituteFirst	'(.*)Italic(.*)'	'Arial(.*)Italic'	'Helvetica(.*)Italic'	'\1Regular'	'\1'
#SubstituteFirst	'(.*)'	'\1Regular'	'\1Medium'	'\1'	Arial	Helvetica 

Syntax for glyph substitution in font substitution files

For font embedding the font needs to have glyphs for all character codes in the PDF.
Some PDFs use malformed character names in which case font embedding will fail. The SubstituteGlyphName entry allows for defining mapping of malformed character names to correct character names.
The first entry is the correct character name, after that an unlimited number of malformed entries can be specified.
As a result all malformed character names will be corrected in the PDF and the result will be taken into account for font embedding.

SubstituteGlyphName <tab> nonbreakingspace <tab> no_break_space <tab> non_breaking_space

SubstituteGlyphName <tab> Hungarumlaut <tab> hungarumlaut__now_576