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)
- Create a FOP configuration file that specifies that FOP should look for fonts in
the installed fonts of the operating system.
<fop version="1.0"> <renderers> <renderer mime="application/pdf"> <fonts> <auto-detect/> </fonts> </renderer> </renderers> </fop>
- Open the Preferences dialog box , go to , and enter the path of the FOP configuration file in the Configuration file text field.
- Create a FOP configuration file that specifies that FOP should look for fonts in
the installed fonts of the operating system.
- 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 predefined scenario called DocBook PDF, edit the XSLT parameters and set the font name (in our example the font family name is Arial Unicode MS) to the parameters body.font.family and title.font.family.
- For TEI documents you can start with the predefined scenario called TEI PDF, edit the XSLT parameters and set the font name (in our example Arial Unicode MS) to the parameters bodyFont and sansFont.
- 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
- Thefont-face
element included in each elementphysical-font
having theattribute char-set="default"
must contain the name of the font (Arial Unicode MS in our example)DITA_OT_DIR/plugins/org.dita.pdf2/fop/conf/fop.xconf
- An elementauto-detect
must be inserted in the elementfonts
, which is inside the elementrenderer
that has the attributemime="application/pdf"
:<renderer mime="application/pdf"> . . . <fonts> <auto-detect/> </fonts> . . . </renderer>