You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by John Mok <jm...@attglobal.net> on 2004/09/30 16:27:40 UTC

How to embed CID-fonts in FOP 1.0dev

I have downloaded the CVS snap-shot xml-fop_20040929223423.tar.gz and 
tried to build a servlet generating PDF with Chinese characters. In FOP 
0.20.5, I succeeded to build such servlet. However, I found the Java 
classes and API have changed a lot in the snap-shot and some the former 
classes, e.g. Option and Driver, do not exist anoymore. Moreover, the 
documentation in the snap-shot is very limited without mentioning how to 
embed CID-font in the configuration.

I hope someone could help me how to configure FOP to embed CID-font, 
e.g. MingLiU, in the new snap-shot FOP 1.0dev

Thanks a lot.

John Mok


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: How to embed CID-fonts in FOP 1.0dev

Posted by Jeremias Maerki <de...@greenmail.ch>.
John,

are you sure you want to live on the bleading edge? The CVS snapshot
contains code from the redesign which in many aspects is still inferior
to FOP 0.20.5 and not ready for production use.

Anyway, as a coincidence I had to figure out the same thing myself today,
and I'm one of the FOP developers!! Here's how I did it:

import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;

[...]

        DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
        Configuration cfg = cfgBuilder.buildFromFile(
            "src/xml/userconfig.xml");

        FOUserAgent ua = new FOUserAgent();
        ua.setUserConfig(cfg.getChild("userconfig"));

        //Construct driver
        Fop fop = new Fop(Constants.RENDER_PDF, ua);
        [...]

In my case the userconfig.xml file looks approximately like this:

<cfg>
  <logkit>
    <factories>
[...unimportant cut out]
  </logkit>
  <userconfig>
    <renderers>
      <renderer mime="application/pdf">
        <filterList>
          <value>null</value>
        </filterList>
        <filterList type="image">
          <value>flate</value>
          <value>ascii-85</value>
        </filterList>
        <fonts>
          <font metrics-url="file:C:/Dev/FOP/temp/fonts/FUTURAL.ttf.xml" kerning="no" embed-url="file:C:/Dev/FOP/Temp/fonts/FUTURAL.ttf">
            <font-triplet name="Futura" style="normal" weight="200"/>
            <font-triplet name="Futura" style="normal" weight="normal"/>
          </font>
        </fonts>
      </renderer>
      <renderer mime="application/postscript">
        <fonts>
          <font metrics-url="file:C:/Dev/FOP/temp/fonts/FUTURAL.ttf.xml" kerning="no" embed-url="file:C:/Dev/FOP/Temp/fonts/FUTURAL.ttf">
            <font-triplet name="Futura" style="normal" weight="200"/>
            <font-triplet name="Futura" style="normal" weight="normal"/>
          </font>
        </fonts>
      </renderer>
    </renderers>
  </userconfig>
</cfg>


On 30.09.2004 16:27:40 John Mok wrote:
> 
> I have downloaded the CVS snap-shot xml-fop_20040929223423.tar.gz and 
> tried to build a servlet generating PDF with Chinese characters. In FOP 
> 0.20.5, I succeeded to build such servlet. However, I found the Java 
> classes and API have changed a lot in the snap-shot and some the former 
> classes, e.g. Option and Driver, do not exist anoymore. Moreover, the 
> documentation in the snap-shot is very limited without mentioning how to 
> embed CID-font in the configuration.
> 
> I hope someone could help me how to configure FOP to embed CID-font, 
> e.g. MingLiU, in the new snap-shot FOP 1.0dev



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org