PrintRenderer printRenderer = (PrintRenderer)renderer;
FontResolver fontResolver = printRenderer.getFontResolver();
- List embedFontInfoList = buildFontList(cfg, fontResolver);
+ FontEventListener listener = new FontEventAdapter(
+ renderer.getUserAgent().getEventBroadcaster());
+ List embedFontInfoList = buildFontList(cfg, fontResolver, listener);
printRenderer.addFontList(embedFontInfoList);
}
* Builds the font list from configuration.
* @param cfg the configuration object
* @param fontResolver a font resolver
+ * @param listener the font event listener
* @return the list of {@code EmbedFontInfo} objects
* @throws FOPException if an error occurs while processing the configuration
*/
- protected List buildFontList(Configuration cfg, FontResolver fontResolver) throws FOPException {
+ protected List buildFontList(Configuration cfg, FontResolver fontResolver,
+ FontEventListener listener) throws FOPException {
FopFactory factory = userAgent.getFactory();
FontManager fontManager = factory.getFontManager();
if (fontResolver == null) {
boolean strict = factory.validateUserConfigStrictly();
FontCache fontCache = fontManager.getFontCache();
- FontEventListener listener = new FontEventAdapter(
- renderer.getUserAgent().getEventBroadcaster());
List/*<EmbedFontInfo>*/ embedFontInfoList = buildFontListFromConfiguration(cfg,
fontResolver, strict, fontManager, listener);
import org.apache.fop.fonts.CustomFontCollection;
import org.apache.fop.fonts.FontCollection;
import org.apache.fop.fonts.FontEventAdapter;
+import org.apache.fop.fonts.FontEventListener;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontManager;
import org.apache.fop.fonts.FontResolver;
List fontCollections = new java.util.ArrayList();
fontCollections.add(new Base14FontCollection(fontManager.isBase14KerningEnabled()));
+ FontEventListener listener = new FontEventAdapter(userAgent.getEventBroadcaster());
Configuration cfg = super.getRendererConfig(painter.getMimeType());
if (cfg != null) {
FontResolver fontResolver = new DefaultFontResolver(userAgent);
- List fontList = buildFontList(cfg, fontResolver);
+ List fontList = buildFontList(cfg, fontResolver, listener);
fontCollections.add(new CustomFontCollection(fontResolver, fontList));
}
FontInfo fontInfo = new FontInfo();
- fontInfo.setEventListener(new FontEventAdapter(userAgent.getEventBroadcaster()));
+ fontInfo.setEventListener(listener);
fontManager.setup(fontInfo,
(FontCollection[])fontCollections.toArray(
new FontCollection[fontCollections.size()]));