diff options
author | Adrian Cumiskey <acumiskey@apache.org> | 2008-04-18 16:37:33 +0000 |
---|---|---|
committer | Adrian Cumiskey <acumiskey@apache.org> | 2008-04-18 16:37:33 +0000 |
commit | 61fe816e71ee48e847a7a2555ff1c0d973877def (patch) | |
tree | 309fbf74db09dcf07f09266b56ae2a85f92642da /src | |
parent | 6ef7ba4acbc6813dc15670630a47b9e5ad9d87ce (diff) | |
download | xmlgraphics-fop-61fe816e71ee48e847a7a2555ff1c0d973877def.tar.gz xmlgraphics-fop-61fe816e71ee48e847a7a2555ff1c0d973877def.zip |
Merged revisions 649477,649552 via svnmerge from
https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk
........
r649477 | jeremias | 2008-04-18 13:03:24 +0100 (Fri, 18 Apr 2008) | 1 line
Bugfix: If the first event is not issued over an event producer, the fallback logging event listener was not installed.
........
r649552 | jeremias | 2008-04-18 15:40:56 +0100 (Fri, 18 Apr 2008) | 1 line
Remember the missing glyphs also if an event listener is registered so they don't get warned about twice.
........
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@649600 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/fop/apps/FOUserAgent.java | 34 | ||||
-rw-r--r-- | src/java/org/apache/fop/fonts/SingleByteFont.java | 18 |
2 files changed, 27 insertions, 25 deletions
diff --git a/src/java/org/apache/fop/apps/FOUserAgent.java b/src/java/org/apache/fop/apps/FOUserAgent.java index 307087f74..eea7f3926 100644 --- a/src/java/org/apache/fop/apps/FOUserAgent.java +++ b/src/java/org/apache/fop/apps/FOUserAgent.java @@ -39,7 +39,7 @@ import org.apache.fop.Version; import org.apache.fop.events.DefaultEventBroadcaster; import org.apache.fop.events.Event; import org.apache.fop.events.EventBroadcaster; -import org.apache.fop.events.EventProducer; +import org.apache.fop.events.EventListener; import org.apache.fop.events.FOPEventListenerProxy; import org.apache.fop.events.LoggingEventListener; import org.apache.fop.fo.FOEventHandler; @@ -549,11 +549,25 @@ public class FOUserAgent { private class FOPEventBroadcaster extends DefaultEventBroadcaster { - private FOPEventListenerProxy rootListener; + private EventListener rootListener; public FOPEventBroadcaster() { - this.rootListener = new FOPEventListenerProxy( - this.listeners, FOUserAgent.this); + //Install a temporary event listener that catches the first event to + //do some initialization. + this.rootListener = new EventListener() { + public void processEvent(Event event) { + if (!listeners.hasEventListeners()) { + //Backwards-compatibility: Make sure at least the LoggingEventListener is + //plugged in so no events are just silently swallowed. + addEventListener( + new LoggingEventListener(LogFactory.getLog(FOUserAgent.class))); + } + //Replace with final event listener + rootListener = new FOPEventListenerProxy( + listeners, FOUserAgent.this); + rootListener.processEvent(event); + } + }; } /** {@inheritDoc} */ @@ -561,18 +575,6 @@ public class FOUserAgent { rootListener.processEvent(event); } - /** {@inheritDoc} */ - protected EventProducer createProxyFor(Class clazz) { - if (!this.listeners.hasEventListeners()) { - //Backwards-compatibility: Make sure at least the LoggingEventListener is plugged - //in so no events are just silently swallowed. - addEventListener( - new LoggingEventListener(LogFactory.getLog(FOUserAgent.class))); - - } - return super.createProxyFor(clazz); - } - } } diff --git a/src/java/org/apache/fop/fonts/SingleByteFont.java b/src/java/org/apache/fop/fonts/SingleByteFont.java index 0a47d52ab..feb1b440c 100644 --- a/src/java/org/apache/fop/fonts/SingleByteFont.java +++ b/src/java/org/apache/fop/fonts/SingleByteFont.java @@ -117,15 +117,15 @@ public class SingleByteFont extends CustomFont { } //Give up, character is not available - if (this.eventListener != null) { - this.eventListener.glyphNotAvailable(this, c, getFontName()); - } else { - Character ch = new Character(c); - if (warnedChars == null) { - warnedChars = new java.util.HashSet(); - } - if (warnedChars.size() < 8 && !warnedChars.contains(ch)) { - warnedChars.add(ch); + Character ch = new Character(c); + if (warnedChars == null) { + warnedChars = new java.util.HashSet(); + } + if (warnedChars.size() < 8 && !warnedChars.contains(ch)) { + warnedChars.add(ch); + if (this.eventListener != null) { + this.eventListener.glyphNotAvailable(this, c, getFontName()); + } else { if (warnedChars.size() == 8) { log.warn("Many requested glyphs are not available in font " + getFontName()); } else { |