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:
<fop>
<renderers>
<renderer mime="application/pdf">
<fonts>
<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>
<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"/>
</font>
</fonts>
</renderer>
</renderers>
</fop>
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) {
return;
}
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
http://www.leverkruid.nl/FOP/documentation-html/index.htm.
Regards, Simon
--
Simon Pepping
home page: http://www.leverkruid.nl
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]