W3C home > Mailing lists > Public > www-xsl-fo@w3.org > August 2002

Embedded FOP with new font in userconfig.xml file

From: Deborah Lin <dlin@ceira.com>
Date: Fri, 16 Aug 2002 17:43:12 -0400 (EDT)
Message-ID: <10373FCB06A19442BB875B052B7D105501E20EA0@dcexc02.DCTC.COM>
To: <www-xsl-fo@w3.org>
I added font "Arial Narrow" to FOP on Windows 2000 server. 

I followed the instructions in FOP web site to generate font metrics xml
file and register it within FOP. 

The code in userconfig.xml is:

 

<!-- Arial Narrow -->

<font metrics-file="file:///c:/fop/fop-0.20.4/fonts/arialn.xml"
kerning="yes" embed-file="c:\winnt\fonts\arialn.ttf">

    <font-triplet name="Arial Narrow" style="normal" weight="normal"/>

    <font-triplet name="ArialMTN" style="normal" weight="normal"/>

 </font>

 <font metrics-file="file:///c:/fop/fop-0.20.4/fonts/arialnb1.xml"
kerning="yes" embed-file="c:\winnt\fonts\arialnb.ttf">

    <font-triplet name="Arial Narrow" style="normal" weight="bold"/>

    <font-triplet name="ArialMTN" style="normal" weight="bold"/>

 </font>

 <font metrics-file="file:///c:/fop/fop-0.20.4/fonts/arialni.xml"
kerning="yes" embed-file="c:\winnt\fonts\arialni.ttf">

    <font-triplet name="Arial Narrow" style="italic" weight="normal"/>

    <font-triplet name="ArialMTN" style="italic" weight="normal"/>

 </font>

 <font metrics-file="file:///c:/fop/fop-0.20.4/fonts/arialnbi.xml"
kerning="yes" embed-file="c:\winnt\fonts\arialnbi.ttf">

    <font-triplet name="Arial Narrow" style="italic" weight="bold"/>

    <font-triplet name="ArialMTN" style="italic" weight="bold"/>

 </font>

 

When I used the following command line to excute:

 

C:\fop\fop-0.20.4>fop -c conf/userconfig1.xml -xsl test.xsl -xml
test.xml -pdf test.pdf

 

It works fine. However if I use FOP embedded mode with code:

 

            Driver driver = new Driver();

            String userConfig = "c:/fop/fop-0.20.4/conf/userconfig.xml";

            File userConfigFile = new File(userConfig);

            Options options = new Options();

            options.loadUserconfiguration(userConfigFile);

            driver.setLogger(log);

            driver.setRenderer(Driver.RENDER_PDF);

            driver.setOutputStream(out);

            driver.render(input.getParser(), input.getInputSource());

 

I get the following errors:

 

[ERROR] Failed to read font metrics file
/c:/fop/fop-0.20.4/fonts/arialnb1.xml : File
"/c:/fop/fop-0.20.4/fonts/arialnb1.xml" not found. 

org.apache.fop.apps.FOPException: java.lang.NullPointerException 

at org.apache.fop.apps.Driver.render(Unknown Source) 

at
com.ceira.apriaups.UPSManifest.FopPrintUPS.FilerenderXML(FopPrintUPS.jav
a:82)   

at
com.ceira.apriaups.UPSManifest.FopPrintUPS.ManifestReporter(FopPrintUPS.
java:58)      

at com.ceira.apriaups.UPSManifest.FopPrintUPS.main(FopPrintUPS.java:226)


---------

 

Does anyone know the work around of this problem?

 

Thanks

Deborah

 

 
Received on Monday, 19 August 2002 04:44:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:06:09 GMT