Add a Font to the Built-in FO Processor - Advanced Version
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.
-
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.
-
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.
- For information about registering the font in the FOP Configuration, see: https://xmlgraphics.apache.org/fop/2.3/fonts.html.
- Open the Preferences dialog box , go to , and enter the path of the FOP configuration file in the Configuration file text field.
-
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
andtitle.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
andsansFont
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 thechar-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 themime="application/pdf"
attribute.
For more information, see: https://xmlgraphics.apache.org/fop/2.1/fonts.html.
- DITA-OT-DIR/plugins/org.dita.pdf2/cfg/fo/font-mappings.xml - The