FOP (building PDF files) normally supports only the base 14 font package defined in the Adobe PDF specification. That includes the following fonts: Helvetica, Times, Courier, Symbol and ZapfDingbats.
Font support in FOP can be extended by the addition of font metric files (written in XML) created from Adobe Type 1 fonts and Truetype fonts. No other font types (Type 3, etc.) are supported at this time.
As mentioned above you need an XML file containing font metrics to be able to use an additional font. FOP contains a tool that can generate such a font metrics file from a PFM file, which normally comes with the font file.
Run the class org.apache.fop.fonts.apps.PFMReader to generate the XML file.
Windows:
java -cp build\fop.jar;lib\xercesImpl-2.0.1.jar;lib\xml-apis.jar;lib\xalan-2.3.1.jar;lib\batik.jar
org.apache.fop.fonts.apps.PFMReader pfm-file xml-file
Unix:
java -cp build/fop.jar:lib/xercesImpl-2.0.1.jar:lib/xml-apis.jar:lib/xalan-2.3.1.jar:lib/batik.jar
org.apache.fop.fonts.apps.PFMReader pfm-file xml-file
Edit conf/userconfig.xml and add entries for the font if the fonts section, ie:
Adding Truetype fonts is almost identical to the process of adding type 1 fonts. The main difference is in the first step.
As mentioned above you need an XML file containing font metrics to be able to use an additional font. FOP contains a tool that can generate such a font metrics file from your truetype font file.
Create metrics for the fontfile (we assume the file has the name cmr10.ttf and exists in c:\myfonts\):
java -cp build\fop.jar;lib\xercesImpl-2.0.1.jar;lib\xml-apis.jar;lib\xalan-2.3.1.jar;lib\batik.jar org.apache.fop.fonts.apps.TTFReader C:\myfonts\cmr10.ttf C:\myfonts\cmr10.ttf ttfcm.xml
TrueType collections (.ttc files) contains more than one font. To create metrics for a ttc file you must specify the font in the collection with the -ttcname option to TTFReader.
To get a list of the fonts in a collection, just start the TTFReader as if it were a normal truetype file (without the -ttcname option). It will then display all the font names and exit with an Exception...
Example on generating metrics for a .ttc file:
java -cp build\fop.jar;lib\xercesImpl-2.0.1.jar;lib\xml-apis.jar;lib\xalan-2.3.1.jar;lib\batik.jar org.apache.fop.fonts.apps.TTFReader -ttcname "MS Mincho" msmincho.ttc msminch.xml
Same as for Type 1 fonts.
Font embedding is enabled in the userconfig.xml file.
Remember to start fop with -c conf/userconfig.xml