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

Re: problemsin register a font

From: Jeremias Maerki <dev@jeremias-maerki.ch>
Date: Fri, 13 Feb 2009 21:09:19 +0100
To: <www-xsl-fo@w3.org>
Message-Id: <20090213210356.D22F.60BA733C@jeremias-maerki.ch>

Barbara, since you're new to FOP, why don't you consider using the
latest FOP version instead (0.95)? The API and the configuration format is
different (after a redesign) but configuring fonts is much easier than
with FOP 0.20.5. You don't need to create XML font metrics files anymore
using TTFReader.

Take a look at the documentation for 0.95:
http://xmlgraphics.apache.org/fop/0.95/fonts.html#basics

If you're running into problems with that, please follow up on
the official FOP support list: fop-users@xmlgraphics.apache.org
More info:
http://xmlgraphics.apache.org/fop/maillist.html#fop-user

Good luck!

On 13.02.2009 15:35:24 Barbara.Bruni wrote:
> 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.
>  




Best regards,
Jeremias Märki
_________________________________________________________
Jeremias Märki, Software-Development and Consulting
Contact Information: http://www.jeremias-maerki.ch/contact.html
Blog: http://www.jeremias-maerki.ch/blog/
Received on Friday, 13 February 2009 20:09:44 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 13 February 2009 20:09:45 GMT