Eric, once again, a post that should have gone to fop-users. Please see: http://xmlgraphics.apache.org/fop/latest/fonts.html#autodetect 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 code? > 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 > 'jar:file:c:/web/public/fop.jar!/Fonts/LTYPEB.TTF' > java.io.IOException: Problem reading font data. > at java.awt.Font.createFont(Unknown Source) > at > org.apache.fop.render.java2d.CustomFontMetricsMapper.initialize(CustomFo > ntMetricsMapper.java:109) > ... Jeremias Maerki
