http://xml.apache.org/http://www.apache.org/http://www.w3.org/


Google


About FOP
News
Status
Download
Release Notes
How to get Help

Running FOP
Embedding
Output Formats
Features
TODO
Limitations
Examples

SVG
Extensions
Fonts
Configuration

NEW DESIGN
Getting involved
Compiling
Testing

FAQ
Bugs
Resources
License


Font Support
Status

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.

Note

The Font is simply embedded into the PDF file, it is not converted.


Adding additional Type 1 fonts

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.

Generating a font metrics file

Run the class org.apache.fop.fonts.apps.PFMReader to generate the XML file.

Windows:

Unix:

Note

The tool will construct some values (FontBBox, StemV and ItalicAngle) based on assumptions and calculations which are only an approximation to the real values. FontBBox and Italic Angle can be found in the human-readable part of the PFB file. The PFMReader tool does not yet interpret PFB files, so if you want to be correct, you may have to adjust the values in the XML file manually. The constructed values however appear to have no visible influence.


Register the fonts within FOP

if the fonts section, ie:

  <font-triplet name="Cyberbit" style="normal" weight="normal">
</font>

Note

If you do not want the font embedded in the PDF then remove the "embed-file" attribute. The PDF will then contain text using the font with the font metrics and to view it properly the font will need to be installed where it is being viewed.

Note

Cocoon users will need to setup the config, see FOPSerializer for more information.



Adding additional TrueType

Adding Truetype fonts is almost identical to the process of adding type 1 fonts. The main difference is in the first step.

Generating a font metrics file

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\):


TrueType collections

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:


Register the fonts within FOP

Same as for Type 1 fonts.


Embedding fonts





Copyright © 1999-2002 The Apache Software Foundation. All Rights Reserved.