You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Florent Georges <da...@yahoo.fr> on 2006/01/06 19:15:37 UTC

How to use a relative URI in the config file (in 'renderer/fonts/font/@embed-url')

  Hi

  I have a little trouble to use a relative URI in the FOP config file.
 Here is an excerpt:

    <renderer mime="application/pdf">
      <fonts>
        <font metrics-url="../fonts/arial.xml"
              embed-url="../fonts/arial.ttf">
          <font-triplet name="Arial"
                        style="normal"
                        weight="normal"/>
        </font>
      </fonts>
    </renderer>

  I got the following:

    pdf.Failed to embed fontfile: ../fonts/arial.ttf(URI could not be
resolved (no protocol: ../fonts/arial.ttf): ../fonts/arial.ttf)

  I tried to use "file://../", "file://.././", etc., but no one works. 
The only one that works is an absolute one, but I really can't use
this.

  Any idea?  PS: I use FOP-0.91.

  Regards,

--drkm



















	

	
		
___________________________________________________________________________ 
Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.
Téléchargez sur http://fr.messenger.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: How to use a relative URI in the config file (in 'renderer/fonts/font/@embed-url')

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Jan 7, 2006, at 02:35, Paul Vinkenoog wrote:

( A bit OT, but anyways... )

> <snip />
> I haven't tried 0.91 yet, but in 0.20.5 the above URLs did work as
> relative (although indeed they shouldn't). Worse: if you left out the
> //, they didn't work anymore. I have fontBaseDirs for several
> languages that look like this (relative to baseDir):
>
>   ../../../config/ru
>
> But if I put it like that in userconfig.xml, FOP complains about the
> missing protocol. This shouldn't be an issue, but OK, I change it to:
>
>   file:../../../config/ru
>
> Now the resolver seems to eat the first four dots (waiting until it
> encounters two slashes?)

Well, as I remember from my read of the related RFC, the trailing  
double slash in the protocol in a URL string is not optional, so the  
above URL is 'erroneous'. What the resolver probably could do in this  
case is much like what any decent browser does when you type  
'http:www.some-site.net', and append the double slash to the protocol  
string, so the URL would eventually become your intended result

>   file://../../../config/ru/

It seems like it depends on how you extract the protocol string from  
a given URL. Do you wait for the two slashes, or stop at the first  
colon and then check whether two slashes immediately follow and  
insert them if necessary?


Cheers,

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: How to use a relative URI in the config file (in 'renderer/fonts/font/@embed-url')

Posted by Paul Vinkenoog <pa...@vinkenoog.nl>.
Hi all,

> FOP 0.91 currently can't deal with relative URLs for embedding. Neat
> comment in the relevant code:
>              /**@todo Temporary hack to compile, improve later */
>             return new java.net.URL(uri).openStream();
> Don't expect a quick fix,Getting the necessary information for
> resolving relative URLs at this point will need some work.
>
> [snip]
>> I tried to use "file://../", "file://.././", etc., but no one works.
>
> Neither of these two is an relative URL, as you might have thought.

I haven't tried 0.91 yet, but in 0.20.5 the above URLs did work as
relative (although indeed they shouldn't). Worse: if you left out the
//, they didn't work anymore. I have fontBaseDirs for several
languages that look like this (relative to baseDir):

  ../../../config/ru

But if I put it like that in userconfig.xml, FOP complains about the
missing protocol. This shouldn't be an issue, but OK, I change it to:

  file:../../../config/ru

Now the resolver seems to eat the first four dots (waiting until it
encounters two slashes?) and looks in ../config/ru, which doesn't
exist. To make FOP find the dir, I can specify this:

  file:../../../../config/ru  (notice the *extra* ../)

or even this:

  file:./../../../config/ru

or this:

  file://../../../config/ru

There's also something wrong at the other end: if the location isn't
found, the "/ru" part will be left out of the "not found" message. If
I put a slash at the end, this doesn't happen.

So, to wrap it all up, in order to have FOP look for my metrics files
in ../../../config/ru *and* give me the right error message if it
doesn't find them, I have to specify the fontBaseDir as:

  file://../../../config/ru/

BTW, there seems to be a similar (though not exactly equal) problem
in Ant.


All that said, let me also make clear that I love FOP and that I
HUGELY appreciate the efforts of all you people who brought it to us
and are working hard to improve it. Without Apache FOP, the Firebird
open source project would have no PDF documentation, or at least we
would be dependent on individuals who had the money to buy a
proprietary FO processor and the time and kindness to build our docs.
Now every project member can build great-looking PDFs, using only
open-source tools. Thanks!


Greetings,
Paul Vinkenoog

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: How to use a relative URI in the config file (in 'renderer/fonts/font/@embed-url')

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Manuel Mall wrote:
> Have enough of these complaints and fixed it (I hope so at least).

Ouch. That was quick!

J.Pietschmann

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: How to use a relative URI in the config file (in 'renderer/fonts/font/@embed-url')

Posted by Manuel Mall <mm...@arcus.com.au>.
On Sat, 7 Jan 2006 07:52 am, J.Pietschmann wrote:
> Florent Georges wrote:
> >   I have a little trouble to use a relative URI in the FOP config
> > file.
>
> FOP 0.91 currently can't deal with relative URLs for embedding. Neat
> comment in the relevant code:
>               /**@todo Temporary hack to compile, improve later */
>              return new java.net.URL(uri).openStream();
> Don't expect a quick fix,Getting the necessary information for
> resolving relative URLs at this point will need some work.
>
> [snip]

Have enough of these complaints and fixed it (I hope so at least).

http://svn.apache.org/viewcvs?rev=366718&view=rev

>
> >   I tried to use "file://../", "file://.././", etc., but no one
> > works.
>
> Neither of these two is an relative URL, as you might have thought.
>
> J.Pietschmann
>

Manuel

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: How to use a relative URI in the config file (in 'renderer/fonts/font/@embed-url')

Posted by Florent Georges <da...@yahoo.fr>.
"J.Pietschmann" wrote:

> /**@todo Temporary hack to compile, improve later */
> return new java.net.URL(uri).openStream();

> Don't expect a quick fix,Getting the necessary information
> for resolving relative URLs at this point will need some
> work.

  Ok, thanks for pointing this out.  I'll look for an other way to
achieve my goal (I unfortunately don't know FOP enough to try to
contribute here).

  Regards,

--drkm





















	

	
		
___________________________________________________________________________ 
Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.
Téléchargez sur http://fr.messenger.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: How to use a relative URI in the config file (in 'renderer/fonts/font/@embed-url')

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Florent Georges wrote:
>   I have a little trouble to use a relative URI in the FOP config file.

FOP 0.91 currently can't deal with relative URLs for embedding. Neat
comment in the relevant code:
              /**@todo Temporary hack to compile, improve later */
             return new java.net.URL(uri).openStream();
Don't expect a quick fix,Getting the necessary information for
resolving relative URLs at this point will need some work.

[snip]
>   I tried to use "file://../", "file://.././", etc., but no one works. 

Neither of these two is an relative URL, as you might have thought.

J.Pietschmann

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org