I am trying to get Apache FOP to use Arial as a font. So far, no luck.
My config.xml says:
<fonts>
<font kerning="yes" embed-url="file:///C:/Windows/Fonts/Arial.ttf" encoding-mode="auto">>
<font-triplet name="Arial" style="normal" weight="normal"/>
</font>
</fonts>
But it does not seem to work. When I run FOP on the command line, it says that the Arial normal font was not found.
I tried to generate the Arial.xml file from ttf using TTFReader in FOP, but that didn't work either (even following the instructions on the fop webpage). The following error message appears:
C:\Users\xy\Desktop\FOP2>java -cp build\fop.jar;lib\avalon-framework-4.2.0.jar;lib\commons-logging-1.0.4.jar;lib\commons-io-1.3.1.jar org.apache.fop.TTFReader C:\Windows\Fonts\arial.ttf Arial.xml
TTF Reader for Apache FOP 1.1
Parsing font...
Reading C:\Windows\Fonts\arial.ttf...
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlgraphics/fonts/Glyphs
at org.apache.fop.fonts.truetype.TTFFile.initAnsiWidths(TTFFile.java:662)
at org.apache.fop.fonts.truetype.TTFFile.readFont(TTFFile.java:711)
at org.apache.fop.fonts.apps.TTFReader.loadTTF(TTFReader.java:224)
at org.apache.fop.fonts.apps.TTFReader.main(TTFReader.java:177)
Caused by: java.lang.ClassNotFoundException: org.apache.xmlgraphics.fonts.Glyphs
at java.net.URLClassLoader$1.run(Unknown Source)
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)
Perhaps I do not see the forrest for the trees, but I do not understand what to do.
Any suggestions?
UDPDATE:
fop/src/codegen
arial.tff
fop/conf/xconf
<fonts>
<directory>C:\Windows\Fonts</directory>
<font metrics-url="C:\Users\z003a5bp\Desktop\FOP2\src\codegen\fonts\arial.xml" kerning="yes" embed-url="C:\Users\z003a5bp\Desktop\FOP2\src\codegen\fonts\arial.ttf">
<font-triplet name="Arial" style="normal" weight="normal"/>
</font>
<auto-detect/>
</fonts>
, auto-detec arial-stil. , "glyph xyz Helvetica", Helvetica. PDF Times New Roman...
++ UPDATE ++
...
fop.xconf :
<fop version="1.0">
<base>.</base>
<source-resolution>72</source-resolution>
<target-resolution>72</target-resolution>
<default-page-settings height="11in" width="8.26in"/>
<renderers>
<renderer mime="application/pdf">
<filterList>
<value>flate</value>
</filterList>
<fonts>
<font metrics-url="file:///C:/Users/z003a5bp/Desktop/FOP2/src/codegen/fonts/arial.xml"
kerning="yes"
embed-url="file:///C:/Users/z003a5bp/Desktop/FOP2/arial.ttf">
<font-triplet name="Arial" style="normal" weight="normal"/>
</font>
<auto-detect/>
</fonts>
</renderer>
font-family = "Arial" : D
fop
fop -xml blabla\file.xml -xsl blabla\stylesheet.xsl -pdf output.pdf
:
Nov 07, 2013 1:34:29 PM org.apache.fop.events.LoggingEventListener processEvent
Schwerwiegend: Image not found. URI: 15300145419.PNG. (See position 44:-1)
Nov 07, 2013 1:34:29 PM org.apache.fop.events.LoggingEventListener processEvent
Warnung: The following feature isn't implemented by Apache FOP, yet: table-layout="auto" (on fo:table) (Siehe Position 29:-1)
Nov 07, 2013 1:34:29 PM org.apache.fop.events.LoggingEventListener processEvent
Schwerwiegend: Image not found. URI: 15627351051.PNG. (See position 44:-1)
Nov 07, 2013 1:34:29 PM org.apache.fop.events.LoggingEventListener processEvent
Schwerwiegend: Image not found. URI: 15629782795.PNG. (See position 44:-1)
Nov 07, 2013 1:34:29 PM org.apache.fop.events.LoggingEventListener processEvent
Warnung: Font "Arial,normal,400" not found. Substituting with "any,normal,400".
Nov 07, 2013 1:34:29 PM org.apache.fop.events.LoggingEventListener processEvent
Warnung: Glyph "?" (0x95) not available in font "Times-Roman".
Nov 07, 2013 1:34:29 PM org.apache.fop.events.LoggingEventListener processEvent
Warnung: Font "Arial,italic,400" not found. Substituting with "any,italic,400".
Nov 07, 2013 1:34:29 PM org.apache.fop.events.LoggingEventListener processEvent
Warnung: Content overflows the viewport of the fo:region-before on page 1 in block-progression direction by 2989 millipoints. (See position 50:-1)
Nov 07, 2013 1:34:29 PM org.apache.fop.events.LoggingEventListener processEvent
Information: Rendered page
Nov 07, 2013 1:34:29 PM org.apache.fop.events.LoggingEventListener processEvent
Warnung: Content overflows the viewport of the fo:region-before on page 2 in block-progression direction by 2989 millipoints. (See position 59:-1)
Nov 07, 2013 1:34:29 PM org.apache.fop.events.LoggingEventListener processEvent
Information: Rendered page
URL-.