public static FontInfo createFontInfo(Configuration cfg) throws FOPException {
FontInfo fontInfo = new FontInfo();
if (cfg != null) {
FontResolver fontResolver = FontManager.createMinimalFontResolver();
//TODO The following could be optimized by retaining the FontManager somewhere
FontManager fontManager = new FontManager();
//TODO Make use of fontBaseURL, font substitution and referencing configuration
//Requires a change to the expected configuration layout
//TODO Wire in the FontEventListener
final FontEventListener listener = null;
final boolean strict = false;
FontInfoConfigurator fontInfoConfigurator
= new FontInfoConfigurator(cfg, fontManager, fontResolver, listener, strict);
List/*<EmbedFontInfo>*/ fontInfoList = new java.util.ArrayList/*<EmbedFontInfo>*/();
fontInfoConfigurator.configure(fontInfoList);
if (fontManager.useCache()) {
fontManager.getFontCache().save();
}
FontSetup.setup(fontInfo, fontInfoList, fontResolver);
} else {
FontSetup.setup(fontInfo);
}