Hi everyone,

Thank you for reading my post.
Let me tell you what my problem is.
Let's consider the following files.

==========================
XML file (projectteam.xml)
==========================
<?xml version="1.0" encoding="UTF-8"?>
<projectteam>
  <projectname>The Killer Application</projectname>
  <member>
    <name>John Doe</name>
    <function>lead</function>
    <e mail>[EMAIL PROTECTED]
  </member>
  <member>
    <name>Paul Coder</name>
    <function>dev</function>
    <e mail>[EMAIL PROTECTED]
  </member>
  <member>
    <name>Max Hacker</name>
    <function>dev</function>
    <e mail>[EMAIL PROTECTED]
  </member>
  <member>
    <name>Donna Book</name>
    <function>doc</function>
    <e mail>[EMAIL PROTECTED]
  </member>
  <member>
    <name>Henry Tester</name>
    <function>qa</function>
    <e mail>[EMAIL PROTECTED]
  </member>
</projectteam>

(Notice that I replace "email" by "e mail" because otherwise a
transformation was operated).

=============================
XSL file (projectteam2fo.xsl)
=============================
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format"; exclude-result-prefixes="fo">
  <xsl:output method="xml" version="1.0" omit-xml-declaration="no"
indent="yes"/>
  <!-- ------------------------- -->
  <!-- root element: projectteam -->
  <!-- ------------------------- -->
  <xsl:template match="projectteam">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>
      <fo:layout-master-set>
        <fo:simple-page-master master-name="simpleA4" page-height="29.7cm"
page-width="21cm" margin-top="2cm" margin-bottom="2cm" margin-left="2cm"
margin-right="2cm">
          <fo:region-body/>
        </fo:simple-page-master>
      </fo:layout-master-set>
      <fo:page-sequence master-reference="simpleA4">
        <fo:flow flow-name="xsl-region-body">
          <fo:block font-size="16pt" font-weight="bold"
space-after="5mm">Project: <xsl:value-of select="projectname"/>
          </fo:block>
          <fo:block font-size="10pt">
            <fo:table table-layout="fixed">
              <fo:table-column column-width="4cm"/>
              <fo:table-column column-width="4cm"/>
              <fo:table-column column-width="5cm"/>
              <fo:table-body>
                <xsl:apply-templates/>
              </fo:table-body>
            </fo:table>
          </fo:block>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
  </xsl:template>
  <!-- ------------------------- -->
  <!-- child element: member     -->
  <!-- ------------------------- -->
  <xsl:template match="member">
    <fo:table-row>
      <xsl:if test="function = 'lead'">
        <xsl:attribute name="font-weight">bold</xsl:attribute>
      </xsl:if>
      <fo:table-cell>
        <fo:block font-family="Courier" font-style="normal"
font-weight="normal">
          <xsl:value-of select="name"/>
        </fo:block>
      </fo:table-cell>
      <fo:table-cell>
        <fo:block>
          <xsl:value-of select="function"/>
        </fo:block>
      </fo:table-cell>
      <fo:table-cell>
        <fo:block font-family="verdana" font-style="normal"
font-weight="normal">
          <xsl:value-of select="email"/>
        </fo:block>
      </fo:table-cell>
    </fo:table-row>
  </xsl:template>
</xsl:stylesheet>

I want to create a PDF file using the following command:
> fop -xml projectteam.xml -xsl projectteam2fo.xsl -pdf projectteam.pdf

As you can see above, I want the "email"'s font to be "verdana".
As you know, "verdana" is not "recognised" by fop.
Something has to be done to do so.

So, I first created a font metrics file out of the
C:\WINDOWS\Fonts\verdana.TTF
true type file (TTF) on my system.

    - I created a directory:
      C:\Program Files\fop\fonts_lea
    - I copied the above TTF file in that directory.
    - I launched the following command to create the font metrics file:
      C:\Program Files\fop> java -cp "build\fop.jar"
org.apache.fop.fonts.apps.TTFReader \ 
                            -fn verdana fonts_lea\verdana.ttf
fonts_lea\verdana.xml

It succeeded.

I then edited the following file: C:\Program Files\fop\conf\userconfig.xml
Its contents are:

<configuration>
  <entry>
    <key>fontBaseDir</key>
    <value>file:///C:\"Program Files"\fop\fonts_lea</value>
  </entry>
  <fonts>
    <fontisque metrics-url="verdana.xml" kerning="yes"
embed-url="verdana.TTF">
      <font-triplet name="verdana" style="normal" weight="normal"/>
    </fontisque>
  </fonts>
</configuration>

(I do not understand why but I have had to replace "font" by "fontisque"
above 
because the two lines which contain the word were not printed in the
preview.
Sorry about that).

Now, if I launch the following command, I have the following output:

> fop -c "C:\Program Files\fop\conf\userconfig.xml" -xml projectteam.xml \
  -xsl projectteam2fo.xsl -pdf projectteam.pdf

[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] FOP 0.20.5
[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] building formatting object tree
[INFO] setting up fonts
[ERROR] Failed to read a font metrics file: Invalid font metrics file: null
(spec must not be null)
[INFO] [1]
[ERROR] unknown font verdana,normal,normal so defaulted font to any
[ERROR] unknown font verdana,normal,normal so defaulted font to any
[ERROR] unknown font verdana,normal,normal so defaulted font to any
[ERROR] unknown font verdana,normal,normal so defaulted font to any
[ERROR] unknown font verdana,normal,normal so defaulted font to any
[ERROR] unknown font verdana,normal,normal so defaulted font to any
[ERROR] unknown font verdana,normal,normal so defaulted font to any
[ERROR] unknown font verdana,normal,normal so defaulted font to any
[ERROR] unknown font verdana,normal,normal so defaulted font to any
[ERROR] unknown font verdana,normal,normal so defaulted font to any
[INFO] Parsing of document complete, stopping renderer

Can anyone tell me what I might have done wrong?
Thanks in advance.

--
Lmhelp
-- 
View this message in context: 
http://www.nabble.com/FOP---FONTS---expl.-verdana-tp18836748p18836748.html
Sent from the FOP - Users mailing list archive at Nabble.com.


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

Reply via email to