W3C home > Mailing lists > Public > www-xsl-fo@w3.org > February 2009

problemsin register a font

From: <Barbara.Bruni@external.bnlmail.com>
Date: Fri, 13 Feb 2009 15:35:24 +0100
Message-ID: <9CE2D1EFBBC4CD4FA21065C2CE454D8D0321E1B4@GEOVSEX14.dip.banca.bnl.it>
To: <www-xsl-fo@w3.org>
hi all, i'm new in FOP
 
i need to use the "Arial Narrow" font inside my PDF, but my registration
doesn't work
 
this is my code:
 
Driver driver = new Driver();
 
String userConfig =
"C:\\ws\\pdf\\WebContent\\WEB-INF\\conf\\userconfig.xml";
File userConfigFile = new File(userConfig);
Options options = new Options();
options.loadUserconfiguration(userConfigFile);
        
 
Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_WARN);
driver.setLogger(logger);
 
MessageHandler.setScreenLogger(logger);        
driver.setRenderer(Driver.RENDER_PDF);
 
OutputStream out = new java.io.FileOutputStream(pdf);
driver.setOutputStream(out);
 
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(new StreamSource(xsl));
 
Source src = new StreamSource(xml);
Result res = new SAXResult(driver.getContentHandler());
 
transformer.transform(src, res);
 
 
and this is my userconfig.xml
 
<configuration>
  <entry>
    <key>fontBaseDir</key>
    <value>C:\windows\fonts</value>
  </entry>
<fonts>  
    <font metrics-url="file:///C:/ws/pdf/WebContent/font/arialn.xml
<file:///C:/ws/pdf/WebContent/font/arialn.xml> " kerning="yes"
embed-url="file:///C:\windows\fonts\ARIALN.TTF
<file:///C:\windows\fonts\ARIALN.TTF> ">
      <font-triplet name="Arial" style="normal" weight="normal"/>
      <font-triplet name="ArialMT" style="normal" weight="normal"/>
    </font>
</fonts>  
</configuration> 

 
i have generated the arialn.xml in this way:
 
java -cp fop.jar;avalon-framework.jar;commons-logging.jar;commons-io.jar
org.apache.fop.fonts.apps.TTFReader C:\windows\fonts\ARIALN.TTF
C:\ws\pdf\WebContent\font\arialn.xml
 
 
BUT....when i run my main class i get the error:
[ERROR] Failed to read a font metrics file: Invalid font metrics file:
null (spec must not be null)

so the PDF is produced but a default font is used.....I need to use the
Arial Narrow font form legal reason

can you help me?

thanks
barbara
 
 
barbara bruni (23521)
-------------------------------
artemide tecnologie informatiche s.r.l.
 
Received on Friday, 13 February 2009 14:47:30 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 13 February 2009 14:47:31 GMT