The problem seems to be caused mainly by the fact, that working direcory 
is set to some obscure directory ($CATALINA_HOME/bin/ in
my case) in the container, so relative paths are relative to the middle of 
nowhere and not to a well defined point inside the application.

OK, I have found a partial solution. I have changed code for the
org.apache.fop.tools.URLBuilder.buildURL(String s), so it can use a
special format of URL in form resource:/my/direcory/file. The method now
looks like this:

if (spec == null)
        throw new NullPointerException("spec must not be null");
        File f = new File(spec);
        if (f.exists()) {
                return f.toURL();
        }

if (spec.startsWith("resource:")) {
        URL result = 
URLBuilder.class.getResource(spec.replaceFirst("resource:", ""));
        if (result != null)
                return result;
        }

URL u1 = new URL(spec);
return u1;

This "solution" isn't perfect, but someone other can find it usefull for 
purpose of his own.

> I'm using FOP in a home-written tomcat servlet.
....
> 
> <font 
> metrics-file="file:///projekty/projekt/WEB-INF/classes/component/resources/timescs.xml"
>  
>               kerning="yes" embed-file="C:\WINNT\Fonts\times.ttf">
>        <font-triplet name="TimesCS" style="normal" weight="normal" />
>        <font-triplet name="TimesCS" style="normal" weight="bold" />
>  </font>
> 
...
> This configuration works ok. But it seems impossible to change 
> filesystem paths to relative ones - the font metrics aren't found.
> 
-- 
   S pozdravem
       Ondrej Nekola
       [EMAIL PROTECTED]
       http://www.matfyz.cz/ondra
       ICQ# 160692888

PS: The font configuration now looks like this:

 <font metrics-file="resource:/module/resources/timescs.xml"  
        kerning="yes" embed-file="resource:/module/resources/times.ttf">
         <font-triplet name="TimesCS" style="normal" weight="normal" />
         <font-triplet name="TimesCS" style="normal" weight="bold" />
 </font> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to