Add a Font to the Built-in FO Processor - Simple Version
If the font that must be set to Apache FOP is one of the fonts that are installed in the operating system you should follow the next steps for creating and setting a FOP configuration file that looks for the font that it needs in the system fonts. It is a simplified version of the procedure for setting a custom font in Apache FOP.
-
Register the font in FOP configuration. (This is not necessary for DITA PDF
transformations, skip to the next step)
-
Set the font on the document content.
This is done usually with XSLT stylesheet parameters and depends on the document type processed by the stylesheet.
- 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,
Arial Unicode MS) to the
body.font.family
andtitle.font.family
parameters. - 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,
Arial Unicode MS) to the
bodyFont
andsansFont
parameters. - For DITA transformations to PDF using DITA-OT you should 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 (for example, Arial Unicode MS) - DITA-OT-DIR/plugins/org.dita.pdf2.fop/fop/conf/fop.xconf - An
<auto-detect>
element must be inserted in the<fonts>
element, which is inside the<renderer>
element that has themime="application/pdf"
attribute:<renderer mime="application/pdf"> . . . <fonts> <auto-detect/> </fonts> . . . </renderer>
- DITA-OT-DIR/plugins/org.dita.pdf2/cfg/fo/font-mappings.xml - The
- 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,
Arial Unicode MS) to the