xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Pepping <spepp...@leverkruid.nl>
Subject Re: adding fonts to fop applet
Date Wed, 07 Jul 2004 19:09:09 GMT
On Wed, Jul 07, 2004 at 11:03:10AM +0200, tango ray wrote:

> I ve tried to add the code in apps.fop  that Simon gave me, but it seems that your Configuration.java
is different, because you create a Configuration userConfig object, and then call methods
getChild and getChildren that are not in my Configuration.java ( fop-0.20.5 version).
>  If you can submit it to me....

The cvs trunk code uses a different configuration system,

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

The configuration file may look as:

<renderer mime="application/pdf">
 <font metrics-url="arial.xml" kerning="yes" embed-url="arial.ttf">
    <font-triplet name="Arial" style="normal" weight="normal"/>
    <font-triplet name="ArialMT" style="normal" weight="normal"/>
 <font metrics-url="arialb.xml" kerning="yes" embed-url="arialb.ttf">
    <font-triplet name="Arial" style="normal" weight="bold"/>
    <font-triplet name="ArialMT" style="normal" weight="bold"/>

See conf/fop.xconf.

You will need to build a Configuration object by parsing the
configuration file:

     * Create the user configuration.
     * @throws FOPException if creating the user configuration fails
     * @throws IOException
    private void createUserConfig() throws FOPException, IOException {
        if (userConfigFile == null) {
        XMLReader parser = FOFileHandler.createParser();
        DefaultConfigurationBuilder configBuilder
            = new DefaultConfigurationBuilder(parser);
        try {
            userConfig = configBuilder.buildFromFile(userConfigFile);
        } catch (SAXException e) {
            throw new FOPException(e);
        } catch (ConfigurationException e) {
            throw new FOPException(e);

Then use that Configuration object as I described. 

I will commit this code as soon as I have time to see how it fits in
the modified FOP code.

I also wrote a bit about fonts and configuration in FOP at

Regards, Simon

Simon Pepping
home page: http://www.leverkruid.nl

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

View raw message