Hi Martijn,

My first thought it that it looks like you may be trying to use a 0.20 configuration with a 0.93/trunk version of FOP.

If you are using 0.93 or later version of FOP (which is highly recommended) then you should change each font definition in your configuration file to use a metrics-url attribute (not metrics-file), the same goes for embed-file, this should be embed-url (see http://xmlgraphics.apache.org/fop/trunk/configuration.html#renderers).

So..

<font metrics-file="E:\FOPCONF\trebuc.xml" kerning="yes" embed-file="E:\FOPCONF\trebuc.ttf">
        <font-triplet name="Trebuchet MS" style="normal" weight="normal"/>
</font>

Should be something like..

<font metrics-url="file:///E:/FOPCONF/trebuc.xml" kerning="yes" embed-url="file:///E:/FOPCONF/trebuc.ttf">
        <font-triplet name="Trebuchet MS" style="normal" weight="normal"/>
</font>

If you are working with a trunk version of FOP then the metrics-url is not necessary as the font metrics parsing is done for you at runtime.

Hope this helps.

Adrian.

Martijn Laarman wrote:
Hi,

We are having a particularly hard time trying to get FOP to embedd "Trebuchet MS" in to the result PDF.

We successfully use FOP as a tomcat servlet however it seems that something goes wrong when i try to add a configuration file for the servlet:

        public void init() throws ServletException {
            this.log = new SimpleLog("FOP/Servlet");
            log.setLevel(SimpleLog.LOG_LEVEL_WARN);
            this.uriResolver = new
    ServletContextURIResolver(getServletContext());
            this.transFactory = TransformerFactory.newInstance();
            this.transFactory.setURIResolver(this.uriResolver);
            //Configure FopFactory as desired
            this.fopFactory = FopFactory.newInstance ();
            File temp = new File("E:/FOPCONF/testconfig.xml");
            this.fopFactory.setUserConfig(temp);
            this.fopFactory.setFontBaseURL("file:///E:/FOPCONF/");
             this.fopFactory.setURIResolver (this.uriResolver);
            configureFopFactory();
        }


In particular its this line:

       this.fopFactory.setUserConfig(temp);


That throws an "Unhandled exception type SAXException", compiling seems to work do so errorless and placing the new war file as tomcat servlet goes ok as well and the servlet still works without errors however Trebuchet MS is still not recognized.

Heres the E:/FOPCONF/testconfig.xml:

    <?xml version="1.0"?>
    <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-file="E:\FOPCONF\trebuc.xml" kerning="yes"
    embed-file="E:\FOPCONF\trebuc.ttf">
        <font-triplet name="Trebuchet MS" style="normal" weight="normal"/>
      </font>
      <font metrics-file="E:\FOPCONF\trebucbd.xml" kerning="yes"
    embed-file="E:\FOPCONF\trebucbd.ttf">
        <font-triplet name="Trebuchet MS" style="normal" weight="bold"/>
      </font>
      <font metrics-file="E:\FOPCONF\trebucbi.xml" kerning="yes"
    embed-file="E:\FOPCONF\trebucbi.ttf">
        <font-triplet name="Trebuchet MS" style="italic" weight="bold"/>
      </font>
      <font metrics-file="E:\FOPCONF\trebucit.xml" kerning="yes"
    embed-file="E:\FOPCONF\trebucit.ttf">
        <font-triplet name="Trebuchet MS" style="italic" weight="normal"/>
      </font>
           </fonts>
        </renderer>
        <renderer mime="application/postscript">
        </renderer>
        <renderer mime="application/vnd.hp-PCL">
        </renderer>
        <renderer mime="image/svg+xml">
          <format type="paginated"/>
          <link value="true"/>
          <strokeText value="false"/>
        </renderer>
        <renderer mime="application/awt">
        </renderer>
        <renderer mime="image/png">
        </renderer>
        <renderer mime="image/tiff">
        </renderer>
        <renderer mime="text/xml">
        </renderer>
        <renderer mime="text/plain">
          <pageSize columns="80"/>
        </renderer>
      </renderers>
    </fop>

Could someone please guide me trough how to add "Trebuchet MS" to my PDF output ?

It would be much appreciated !


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

Reply via email to