If you prefer I can send coding issues to fop-users. I'm aware of the
auto detect. I'm just not aware of how it works, if it will find the
file I'm specifically trying to reference or if it might use a search
path which would refer to a different file. I was trying to pass it a
specific path to the font file I put in a jar rather than use the auto
detection and it doesn't seem to handle specific paths to files inside
jars unless I'm missing something. It appears the EmbedFileInfo string
path parameter gets used to create a StreamSource for
CustomFontMetricsMapper and doesn't like that StreamSource as a
From: Jeremias Maerki [mailto:d...@jeremias-maerki.ch]
Sent: Tuesday, August 10, 2010 5:21 AM
Subject: Re: Embedding font from jar
once again, a post that should have gone to fop-users.
It will tell you how to create a JAR with fonts that FOP will
automatically detect. No Java code necessary.
On 06.08.2010 17:58:55 Eric Douglas wrote:
> I created some embedded code using EmbedFontInfo to load custom font
> files into the Renderer setFontList and setupFontInfo methods.
> I have a program with embedded Java running on the server which is
> working fine for creating a PDF and getting output to a printer.
> Now I'm trying to use client Java through Webstart to get the awt
> PreviewPanel working and it doesn't like the file path to the fonts.
> I'm trying to simplify file references by putting fonts, images in a
> jar. That jar should be on the classpath and the server and client
> should be able to reference the files in it the same way.
> I recompiled my FOP 0.95 jar to embed those files. I can put them in
> a separate jar if it makes more sense.
> Is there a simple way to reference the jar font file from embedded
> I tried creating an EmbedFontInfo object using
> "jar:file:c:/web/public/fop.jar!/Fonts/LTYPEB.TTF" for the embedFile
> parameter, and it crashes on the createFont method in the
> CustomFontMetricsMapper object.
> WARNING: Unable to load custom font from file
> java.io.IOException: Problem reading font data.
> at java.awt.Font.createFont(Unknown Source)