Set a Font for PDF Output Generated with FO Processor

When a DITA map is transformed to PDF using an FO processor and it contains some Unicode characters that cannot be rendered by the default PDF fonts, a font that is capable of rendering these characters must be configured and embedded in the PDF result.

The settings that must be modified for configuring a font for the built-in FO processor are detailed in Add a Font to the Built-in FO Processor.

DITA OT PDF Font Mapping

The DITA OT contains a file DITA_OT_DIR/plugins/org.dita.pdf2/cfg/fo/font-mappings.xml that maps logical fonts used in the XSLT stylesheets to physical fonts that will be used by the FO processor to generate the PDF output.

The XSLT stylesheets used to generate the XSL-FO output contain code like this:

<xsl:attribute name="font-family">monospace</xsl:attribute>

The font-family is defined to be monospace, but monospace is just an alias. It is not a physical font name. Therefore, another stage in the PDF generation takes this monospace alias and looks in the font-mappings.xml.

If it finds a mapping like this:

<aliases>
      <alias name="monospace">Monospaced</alias>
 </aliases>

then it looks to see if the Monospaced has a logical-font definition and if so, it will use the physical-font specified there:

<logical-font name="Monospaced">
      <physical-font char-set="default">
        <font-face>Courier New, Courier</font-face>
      </physical-font>
............
</logical-font>

Important

If no alias mapping is found for a font-family specified in the XSLT stylesheets, the processing defaults to Helvetica.

Was this helpful?