Apache FOP XLS-FO PDF Rendering And Fonts

It’s essentially for aesthetics, even in an automatic generated technical documentation, to use typography and layout as you intended it. One fundamental topic are fonts.

In Apache FOP 1.0 a convenience feature for XSL-FO to PDF rendering was added: automatic detection and use of fonts. This can be fonts registered by the operating system or fonts lying in directories you point at by mentioning them in the FOP configuration file. But if you want to use the auto feature, you have to tell FOP to use your configuration file, even it’s the standard configuration in <fop directory>/conf/fop.xconf – often forgetting the -c parameter and wondering why your fonts are not detected costs endless hours.

To use costum-fonts just add the following (just one or both sections, as you need it) to your fop.xconf under the <fonts> node:

<!-- use fonts located in a special directory -->
<!-- automatically detect operating system installed fonts -->

Runnig the auto-detection font feature can result in a huge memory consumption by fop building it’s font cache file (~.fop/fop-fonts.cache). If you get the message: Exception in thread „main“ java.lang.OutOfMemoryError: Java heap space – try this options (entered in a shell just before you start FOP or add this to the FOP start script):

export FOP_OPTS='-Xmx512m'

or if that doesn’t work, then

export FOP_OPTS='-Xmx1024m'

Ein Kommentar

  1. Spencer Rugaber
    | Permalink

    Your approach didn’t work for me on my MacBook. I got messages like the following:

    Sep 13, 2013 4:17:04 PM org.apache.fop.fonts.truetype.TTFFile readCMAP
    SEVERE: Unsupported TrueType font: No Unicode or Symbol cmap table not present. Aborting
    Sep 13, 2013 4:17:04 PM org.apache.fop.events.LoggingEventListener processEvent
    WARNING: Unable to load font file: file:/System/Library/Fonts/ZapfDingbats.ttf. Reason: java.io.IOException: TrueType font is not supported: file:/System/Library/Fonts/ZapfDingbats.ttf

    I see these messages for all the fonts in /Library/fonts regardless of which of your
    two approaches I use.

    Do you have any suggestions on how to go forward?



Einen Kommentar hinterlassen

Ihre E-Mail wird niemals veröffentlicht oder weitergegeben. Erforderliche Felder sind mit * markiert

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


Ich stimme der Datenschutzerklärung zu

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.