//Fonts
try {
FontResolver fontResolver = FontSetup.createMinimalFontResolver();
//TODO The following could be optimized by retaining the FontCache somewhere
FontCache fontCache = FontCache.load();
if (fontCache == null) {
fontCache = new FontCache();
}
List fontList = PrintRendererConfigurator.buildFontListFromConfiguration(
cfg, null, fontResolver, false, fontCache);
fontCache.save();
FontInfo fontInfo = new FontInfo();
FontSetup.setup(fontInfo, fontList, fontResolver);
graphics.setFontInfo(fontInfo);
} catch (FOPException e) {
throw new ConfigurationException("Error while setting up fonts", e);