protected Configuration loadFOPConfig() throws MojoExecutionException {
System.out.println ("At load config");
String fontPath = (null != localFontPath && localFontPath != "")? localFontPath: (new File(getTargetDirectory().getParentFile(), "fonts")).getAbsolutePath();
StringTemplateGroup templateGroup = new StringTemplateGroup("fonts", fontPath);
StringTemplate template = templateGroup.getInstanceOf("fontconfig");
DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
template.setAttribute ("fontPath",fontPath);
final String config = template.toString();
if (getLog().isDebugEnabled()) {
getLog().debug(config);
}
try {
return builder.build(IOUtils.toInputStream(config));
} catch (IOException ioe) {
throw new MojoExecutionException("Failed to load FOP config.", ioe);
} catch (SAXException saxe) {
throw new MojoExecutionException("Failed to parse FOP config.",
saxe);