Edit online

If an XML document is transformed to PDF using the built-in Apache FOP processor but it contains some Unicode characters that cannot be rendered by the default PDF fonts, then a special font that is capable to render these characters must be configured and embedded in the PDF result.

Important: On Windows, fonts are located into the C:\Windows\Fonts directory. On Mac, they are placed in /Library/Fonts. To install a new font on your system, it is enough to copy it in the Fonts directory. If a special font is installed in the operating system, there is a simple way of telling FOP to look for it. See the simplified procedure for adding a font to FOP.
  1. Locate the font.

    First, find out the name of a font that has the glyphs for the special characters you used. One font that covers most characters, including Japanese, Cyrillic, and Greek, is Arial Unicode MS.

  2. Register the font in the FOP configuration.
    Note: DITA PDF transformations have their own fop.xconf (DITA-OT-DIR/plugins/org.dita.pdf2.fop/fop/conf/fop.xconf). If the font is not installed in the system, it needs to be referenced in the fop.xconf.
    1. For information about registering the font in the FOP Configuration, see: https://xmlgraphics.apache.org/fop/2.3/fonts.html.
    2. Open the Preferences dialog box (Options > Preferences), go to XML > XSLT/FO/XQuery > FO Processors, and enter the path of the FOP configuration file in the Configuration file text field.
  3. Set the font on the document content.
    This is usually done with XSLT stylesheet parameters and depends on the document type processed by the stylesheet.

    DocBook Example: For DocBook documents, you can start with the built-in scenario called DocBook PDF, edit the XSLT parameters, and set the font name (for example, Arialuni) to the body.font.family and title.font.family parameters.

    TEI Example: For TEI documents, you can start with the built-in scenario called TEI PDF, edit the XSLT parameters, and set the font name (for example, Arialuni) to the bodyFont and sansFont parameters.

    DITA Example: For DITA to PDF transformations using DITA-OT modify the following two files:
    • DITA-OT-DIR/plugins/org.dita.pdf2/cfg/fo/font-mappings.xml - The <font-face> element included in each <physical-font> element that has the char-set="default" attribute must contain the name of the font.
    • DITA-OT-DIR/plugins/org.dita.pdf2/fop/conf/fop.xconf - A <font> element must be inserted in the <fonts> element, which is inside the <renderer> element that has the mime="application/pdf" attribute.

    For more information, see: https://xmlgraphics.apache.org/fop/2.1/fonts.html.