Finally I'm using a workaround in my URIResolver setting up a new prefix like "myfonts:/" which is replaced by the actual fonts base URL.

I wonder if the FOP behavior to use the URIResolver before the fonts base URL should be the standard one.


Maxime Bégnis

Le 01/09/2010 17:55, Eric Douglas a écrit :
I don't know about a simple solution but there is a workaround.
I solved this or a related issue by not using the setFontBaseURL method.
I use the Renderer.setFontList method instead to manually load in the custom font(s).
Is there a point to using a BufferedOutputStream?  I use a ByteArrayOutputStream, so I have the output in bytes so I can copy it from server to client.
I haven't figured out yet how to get it to resolve paths properly for external image references.  So far I only need one image, so I found a program to translate it to SVG code and copied it directly into my xsl.

From: Maxime Bégnis [mailto:maxime@neodoc.biz]
Sent: Wednesday, September 01, 2010 11:37 AM
To: fop-users@xmlgraphics.apache.org
Subject: fonts URL resolution

Hi list,

I am using an URIResolver with FOP to resolve the URL of external images. I found out that it tries to find fonts using the URIResolver before using the font base URL specified with fopFactory.getFontManager().setFontBaseURL("file:///path/to/fonts/")

Is there a way to make it use the URIResolver after(or not at all) the specified font base URL?

Here is the code I'm using :

fopFactory.setUserConfig(new File(FOP_USER_CFG));
OutputStream os = new BufferedOutputStream(FileUtils.openOutputStream(result));
FOUserAgent uagent = fopFactory.newFOUserAgent();
Fop fop = fopFactory.newFop(format, uagent, os);

All this with FOP 1.0

Thanks a lot!

Maxime Bégnis