*/
public static FontInfo createFontInfo(Configuration cfg, boolean useComplexScriptFeatures)
throws FOPException {
FontInfo fontInfo = new FontInfo();
final boolean strict = false;
FontResolver fontResolver = FontManager.createMinimalFontResolver(useComplexScriptFeatures);
//TODO The following could be optimized by retaining the FontManager somewhere
FontManager fontManager = new FontManager();
if (cfg != null) {
FontManagerConfigurator fmConfigurator = new FontManagerConfigurator(cfg);
fmConfigurator.configure(fontManager, strict);
}
List fontCollections = new java.util.ArrayList();
fontCollections.add(new Base14FontCollection(fontManager.isBase14KerningEnabled()));
if (cfg != null) {
//TODO Wire in the FontEventListener
FontEventListener listener = null; //new FontEventAdapter(eventBroadcaster);
FontInfoConfigurator fontInfoConfigurator
= new FontInfoConfigurator(cfg, fontManager, fontResolver, listener, strict);
List/*<EmbedFontInfo>*/ fontInfoList = new java.util.ArrayList/*<EmbedFontInfo>*/();
fontInfoConfigurator.configure(fontInfoList);
fontCollections.add(new CustomFontCollection(fontResolver, fontInfoList,
fontResolver.isComplexScriptFeaturesEnabled()));
}
fontManager.setup(fontInfo,
(FontCollection[])fontCollections.toArray(
new FontCollection[fontCollections.size()]));
return fontInfo;