I use BIRT since early days and still have riddles regarding PDF emitter.
Short story:
Can I configure fontsConfig.xml to load fonts from relative path or from jars?
Long story:
We are using both FOP and BIRT for generating PDF in our web application. It would be nice to share fonts between libraries. Unfortunately, I can't find a way to do it with BIRT 2.3.1
The root of evil is fontsConfig.xml
If I configure it like shown below it works fine:
<font-paths>
<path path="fonts"/>
</font-paths>
But path doesn't allow me using neither relative paths not classpath (or I can't find an appropriate way how to configure it).
Neither config1 nor config2 works.
Config1:
<font-paths>
<path path="../fonts"/>
</font-paths>
Config2:
<font-paths>
<path path="classpath:fonts"/>
</font-paths>
Any thoughts will be appreciated.
With some BIRT versions, you can use a SystemProperty "birt.font.dirs". This overrides the fontsConfig.xml.
Well, this once worked, but obviously it was removed from the BIRT source code later.
Now you can call something like
EngineConfig engineConfig = new EngineConfig();
URL fontsConfigurationURL = new URL("file:///path/to/my/fontsConfig.xml");
engineConfig.setFontConfig(fontsConfigurationURL);
Platform.startup(engineConfig);
This allows you to supply BIRT with a customized version of fontsConfig.xml without poking around in the JARs.
Tested with BIRT 4.3.0.
There is a way to have fonts on a relative path to be used in Birt.
What you need to do is copy the fonts to a location in your Web Application. Mine was in :
C:\\src\main\webapp\Reports
Now in the application, use the following command to register the fonts from the above mentioned location.
FontFactory.registerDirectory( scContext.getRealPath("/Reports") );
This will register the font.
Tested on Birt 4.3 through Spring MVC