Defaulting and substituting missing fonts
This page applies to Harlequin v13.1r0 and later; both Harlequin Core and Harlequin MultiRIP
By default the Courier font (or the appropriate alternative in the installed font set) will be used when a single-byte font requested by the job is not embedded in the job and is not available in the SW directory.
The default can be amended by defining SubstituteFont
in the $error
dictionary. The value must be a PostScript procedure that consumes the name of the missing font and returns the name of the default to use instead.
An example definition is supplied in SW/Config/FontSubstitution
:
$error /SubstituteFont { pop /Courier } bind put
For CIDfonts
the equivalent is SubstituteCIDFont
in the $error
dictionary. The default CIDFont
is CID-Bullet,
which replaces all glyphs with bullets. It is therefore useful to identify that there is an issue, but it will very rarely produce usable output.
Care should be taken in replacing CID-Bullet
, however. An alternative may work well in cases where a CID font is not available and the encoding to be used is supplied, but there are instances where that encoding information is not defined. In such cases using a “real” default CID font is quite likely to lead to the wrong glyph being used.
By default a warning is emitted when fonts are defaulted. The warning may be suppressed by setting the SilentFontFault
user parameter to true
.
<< /SilentFontFault true >> setuserparams
For a more flexible replacement a list of replacements may be defined as the value of ConditionalFontSubstitution
in statusdict
. This must be a dictionary. Each key is the name of a font that should be used as a substitute, and its value should be an array of font names that should be replaced using that substitute if they are not available.
statusdict /ConditionalFontSubstitution <<
/TimesNewRoman [ /TimesNewRomanPSMT /Times-Roman ]
/TimesNewRomanPS-BoldItalic [
/TimesNewRomanPS-BoldItalicMT
/TimesNewRoman-BoldItalic
/TimesNewRoman,BoldItalic
/Times-BoldItalic
]
/Arial [ /ArialMT /Helvetica ]
/CourierNew [ /CourierNewPSMT /Courier ]
>> put
A proforma entry is included in SW/Config/Fontsubstitution.
Note that you must ensure that:
- The two fonts are very similar in glyphs supported and glyph names; otherwise a lot of glyphs may be missing, or replaced with plain rectangles on the output.
- Single-byte fonts are not used to substitute for double-byte fonts and vice versa.
- When substituting for double-byte fonts the two fonts should use the same encoding.
- CID fonts in
ConditionalFontSubstitution
are not included; they should useConditionalCIDFontSubstitution
. You cannot use this mechanism to substitute a non-CID font for a CID font or vice versa.
By default, font replacements using the ConditionalFontSubstitution
dictionary will be reported as warnings. Those warnings may be suppressed by setting SilentConditionalFontSubstitution
to true
in statusdict
.
statusdict /SilentConditionalFontSubstitution true put
The SW/Config/FontSubstitution
file is run as the RIP boots, but all values set within it may be overridden in later RIP configuration code.
For defaulting CID fonts define ConditionalCIDFontSubstitution
in statusdict,
using exactly the same format as for ConditionalFontSubstitution
. But this capability must be used with extreme care to avoid selecting the incorrect glyphs:
- The two fonts must use the same Registry and Ordering entries. That means that they would ordinarily use the same
CMaps
. - The two fonts must be of the same
CIDFontType
. - If the font name contains any international characters (bytes > 126), you must take steps to escape the name appropriately; either use a hexadecimal string or enclose it in parentheses and prefix any parenthesis or backslash characters with a backslash.
Note: If you are not confident that these conditions will be met, do not substitute CID fonts.