Cool - yep - soon as I got rid of the metrics and properly configured it in
the conf, the fonts worked again. 

I had to use the full font name as it appears in a font viewer though

I guess previously the font's name was overridden when imported into the FOP
processor (looks like the previous person was using Antenna XSL Formatter,
but hacked into the fop.bat script)

Thanks
Martin.


-----Original Message-----
From: Jeremias Maerki [mailto:[EMAIL PROTECTED] 
Sent: Monday, 2 June 2008 4:54 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: importing fonts

On 02.06.2008 02:59:51 Martin Edge wrote:
> Hey Guys,
> 
> I’m trying to import two fonts – Barcode3of9 and BC4State..
> 
> The BC4 State one seems to work fine from first creating the metrics file
:
> 
> java -cp
>
build\fop.jar;lib\avalon-framework-4.2.0.jar;lib\commons-logging-1.0.4.jar;l
> ib\commons-io-1.3.1.jar org.apache.fop.fonts.apps.TTFReader -fn "BC4State"
> fonts/bc4state.ttf bc4state.xml
> 
> I use the same step to create the 3 of 9 metric:
> 
> java -cp
>
build\fop.jar;lib\avalon-framework-4.2.0.jar;lib\commons-logging-1.0.4.jar;l
> ib\commons-io-1.3.1.jar org.apache.fop.fonts.apps.TTFReader -fn "3 of
> 9Barcode" fonts/3of9BarCode.ttf 3Of9barcode.xml
> 
> In my configuration I have:
> 
> <fonts>                
> <font metrics-url="file:///C:/pdfbin/fop-0.94beta/3Of9barcode.xml"
> kerning="yes"
> embed-url="file:///C:/pdfbin/fop-0.94beta/fonts/3Of9Barcode.ttf">
> <font-triplet name="Barcode3of9" style="normal" weight="normal" />
> </font>
>         
> <font metrics-url="file:///C:/pdfbin/fop-0.94beta/bc4state.xml"
> kerning="yes"
embed-url="file:///C:/pdfbin/fop-0.94beta/fonts/bc4state.TTF">
> <font-triplet name="bc4state" style="normal" weight="normal" />
> </font>
> </fonts>
> 
> (in both the PDF renderer and the PCL renderer block)
> 
> The command line I’m using is:
> 
> C:\pdfbin\fop-0.94\fop.bat "E:\work\printer_test\test.fo" -c
> "c:\pdfbin\fop-0.94\conf\fop.xconf" -pcl "e:\work\printer_test\test.pcl"
> 
> I do not see any errors for BC4State.. as when both were failing I would
> see:
> WARNING: Font 'Barcode3of9,normal,400' not found. Substituting with
> 'any,normal,400'.
> WARNING: Font 'BC4State,normal,400' not found. Substituting with
> 'any,normal,400'.

I'd guess that the format of your config file is not 100% correct. Are
the "font" tags really configured for the PCL section, too? At the
moment font configuration needs to happen for each renderer separately.

> However, on startup, I see this error:
> 
> 2/06/2008 10:45:57 org.apache.fop.fonts.FontCache loadFrom
> WARNING: I/O exception while reading font cache
> (org.apache.fop.fonts.FontCache;
>  local class incompatible: stream classdesc serialVersionUID =
> 605232520271754718, local class serialVersionUID = 605232520271754717).
> Discarding font cache file.
> 2/06/2008 10:45:57 org.apache.fop.apps.FopFactoryConfigurator configure

You can ignore that.

> And further down when trying to use the font:
> WARNING: Font 'Barcode3of9,normal,400' not found. Substituting with
> 'any,normal,400'.

See comment above.

> As extra information – I tried to create a metrics file using the same
> command line above in fop-0.95beta and I get:
> 
> C:\pdfbin\fop-0.95beta>java -cp
>
build\fop.jar;lib\avalon-framework-4.2.0.jar;lib\commons-logging-1.0.4.jar;l
> ib\commons-io-1.3.1.jar org.apache.fop.fonts.apps.TTFReader -fn "3 of
> 9Barcode" fonts/3of9BarCode.ttf 3Of9barcode.xml
> TTF Reader for Apache FOP 0.95beta
> 
> Parsing font...
> Reading fonts/3of9BarCode.ttf...
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/xmlgraphics/fonts/Glyphs

xmlgraphics-commons-*.jar is missing in the classpath. But in FOP 0.95
you don't need the XML font metrics files anymore. See:
http://xmlgraphics.apache.org/fop/0.95/fonts.html#custom

>         at
> org.apache.fop.fonts.truetype.TTFFile.initAnsiWidths(TTFFile.java:444)
>         at
org.apache.fop.fonts.truetype.TTFFile.readFont(TTFFile.java:493)
>         at org.apache.fop.fonts.apps.TTFReader.loadTTF(TTFReader.java:209)
>         at org.apache.fop.fonts.apps.TTFReader.main(TTFReader.java:164)
> Caused by: java.lang.ClassNotFoundException:
> org.apache.xmlgraphics.fonts.Glyphs
>         at java.net.URLClassLoader$1.run(Unknown Source)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(Unknown Source)
>         at java.lang.ClassLoader.loadClass(Unknown Source)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>         at java.lang.ClassLoader.loadClass(Unknown Source)
>         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>         ... 4 more
> 
> I figure I have to get the fonts embedded correctly if I am to jump
straight
> from FO -> PCL.
> 
> Am I doing anything obviously wrong here? 

No, except that the config file could be wrong.

> Additionally – is there any problems with me using Saxon to do the XSL/XML
> processing to create an FO file, then using FOP to convert to my desired
> format?

You said you're on .NET. So does that mean the .NET version of SAXON?
Generally, it doesn't make any functional difference which XSLT
processor you use. You can even use Microsoft's. In terms of performance
the choice of XSLT processor and the way you combine XSLT + FOP can make
a difference. Usually, you lose some performance if you have to
serialize the intermediate FO file because it just has to be parsed
again later.

> Thanks Guys,
> Martin.
> 



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to