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 Jon Kofal <jo...@yahoo.com> on 2002/07/31 09:11:28 UTC

Embedding Fonts in FOP

I have tried to follow the example, but to no avail.

I use the org.apache.for.apps.Driver class to generate PDF.

I need custom Fonts in the PDF.

I have created the Font metrics files using the command-line utility.

I have edited the userconfig.xml and added the following lines to the
<fonts/> element:

    <font
metrics-file="file:///c:/repository/jdk1.4.0/fop-0.20.4/build/font/VERDREF.TTF">
      <font-triplet name="Verdana Ref" style="normal" weight="normal"/>
    </font>

In my XSL, I reference the font as:
    <fo:root font-family="Verdana Ref" font-style="normal"
font-weight="normal ...

When I instantiate the org.apache.fop.apps.Options with the code:

    try {
        File configFile = 
            new
File("C:/repository/jdk1.4.0/fop-0.20.4/build/conf/userconfig.xml");
        org.apache.fop.apps.Options options = 
           new org.apache.fop.apps.Options(configFile);
    } catch (Exception ex) {
        ex.printStackTrace();
    }

I get the error message:

    DEBUG   10280   [fop     ] (): reading user configuration file
    ERROR   10280   [fop     ] (): Could not load user configuration
file C:\repository\jdk1.4.0\fop-0.20.4\build\conf\userconfig.xml -
error: null
    ERROR   10280   [fop     ] (): using default values
h

Removing the <font/> tag from the userconfig.xml yields the following
message:

    DEBUG   10280   [fop     ] (): reading user configuration file

In both cases, I get also the following error message about the Font:

    [ERROR]: unknown font Verdana Ref,normal,normal so defaulted font
to any

Does anyone have insight into this error.  Seems to me to be in the
definitions in the userconfig.xml file.

Thanks,
Jon Kofal



__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

Re: Embedding Fonts in FOP

Posted by Jon Kofal <jo...@yahoo.com>.
Thanks for the advice on the Web App configuration.

My real problem was version 0.20.3, not 0.20.4 version conflicts.

I upgraded the version, now it goes.

Thanks,
Jon Kofal
--- Balaji Loganathan <ba...@yahoo.com> wrote:
> Hi,
>  I guess there is something wrong with ur
> userconfig.xml file,did u able run it from command
> propmt by supplying -c option
>  i mean fop -c userconfig.xml -xsl -xml -pdf
> if that works then it should work in servlet as well.
> 
> i tried with tomcat by placing my fonts,fontxml &
> userconfig.xml under bin directory and in my servlet i
> just placed the below code before initializing driver
> object.
>  Options options = new Options(new
> File("userconfig.xml"));
> 
> Hope this helps
> Regards
> Balaji
> 
> http://digital.yahoo.com.au - Yahoo! Digital How To
> - Get the best out of your PC!


__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

Re: Embedding Fonts in FOP

Posted by Balaji Loganathan <ba...@yahoo.com>.
Hi,
 I guess there is something wrong with ur
userconfig.xml file,did u able run it from command
propmt by supplying -c option
 i mean fop -c userconfig.xml -xsl -xml -pdf
if that works then it should work in servlet as well.

i tried with tomcat by placing my fonts,fontxml &
userconfig.xml under bin directory and in my servlet i
just placed the below code before initializing driver
object.
 Options options = new Options(new
File("userconfig.xml"));

Hope this helps
Regards
Balaji

http://digital.yahoo.com.au - Yahoo! Digital How To
- Get the best out of your PC!