Font Configuration

By Default the XML Server uses FOP (Formatting Objects Processor) for rendering documents in various formats. FOP supports a default set of fonts, including Helvetica, Times and Courier, and it is possible using a FOP configuration file to include support for additional fonts, for example a simplified Chinese font. The <FOP_CONFIG_FILE> configuration option allows you to specify the name and location of a FOP configuration file. The path specified for the configuration file can be absolute (c:/directory/fop-config-file.xml) or relative (./fop-config-file.xml) to the xmlserver directory. Any references to files within the FOP configuration file can also be absolute or relative to the xmlserver directory.

Figure 1. Sample FOP Configuration File
<fop>
 <renderers>
  <renderer mime="application/pdf">
    <fonts>
     <font metrics-url=".\chinese\pmingliu.xml" kerning="yes" 
       embed-url=".\chinese\mingliu.ttc">
       <font-triplet name="PMingLiu" style="normal" 
          weight="normal"/>
     </font>  
    </fonts>
   </renderer>
  </renderers>
</fop>

The example FOP configuration file above references a font metrics file (pmingliu.xml) and an embed file (mingliu.ttc). The embed file is the true type collection font file. True type collection font files can be found on a Windows machine in the installed fonts directory, for example c:/Windows/Fonts. Apache provides utilities to generate the necessary font metrics file from a true type collection font file and also from other formats. The Apache FOP documentation should be consulted for more information on font configuration.