aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2009-03-19 10:20:31 +0000
committerJeremias Maerki <jeremias@apache.org>2009-03-19 10:20:31 +0000
commit3c5ac0297c39c7cf7280afa95155dbea07e67d4c (patch)
tree5cba55c8324846a88d97c67fcad9b8b53d67806a /src/java
parent633d03c8966b3656e12d5e5727c09071a3fd14c4 (diff)
downloadxmlgraphics-fop-3c5ac0297c39c7cf7280afa95155dbea07e67d4c.tar.gz
xmlgraphics-fop-3c5ac0297c39c7cf7280afa95155dbea07e67d4c.zip
Bugfix: IFSerializer's mimicking feature didn't work properly. The wrong configuration got selected.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@755894 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/apps/FopFactory.java8
-rw-r--r--src/java/org/apache/fop/render/PrintRendererConfigurator.java3
-rw-r--r--src/java/org/apache/fop/render/intermediate/IFUtil.java17
3 files changed, 24 insertions, 4 deletions
diff --git a/src/java/org/apache/fop/apps/FopFactory.java b/src/java/org/apache/fop/apps/FopFactory.java
index 96c22f964..9ddc164c5 100644
--- a/src/java/org/apache/fop/apps/FopFactory.java
+++ b/src/java/org/apache/fop/apps/FopFactory.java
@@ -264,9 +264,11 @@ public class FopFactory implements ImageContext {
*/
public Fop newFop(FOUserAgent userAgent) throws FOPException {
if (userAgent.getRendererOverride() == null
- && userAgent.getFOEventHandlerOverride() == null) {
- throw new IllegalStateException("Either the overriding renderer or the overriding"
- + " FOEventHandler must be set when this factory method is used!");
+ && userAgent.getFOEventHandlerOverride() == null
+ && userAgent.getDocumentHandlerOverride() == null) {
+ throw new IllegalStateException("An overriding renderer,"
+ + " FOEventHandler or IFDocumentHandler must be set on the user agent"
+ + " when this factory method is used!");
}
return newFop(null, userAgent);
}
diff --git a/src/java/org/apache/fop/render/PrintRendererConfigurator.java b/src/java/org/apache/fop/render/PrintRendererConfigurator.java
index f1a76be1d..3f5a2eb39 100644
--- a/src/java/org/apache/fop/render/PrintRendererConfigurator.java
+++ b/src/java/org/apache/fop/render/PrintRendererConfigurator.java
@@ -58,6 +58,7 @@ import org.apache.fop.fonts.autodetect.FontInfoFinder;
import org.apache.fop.fonts.base14.Base14FontCollection;
import org.apache.fop.render.intermediate.IFDocumentHandler;
import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator;
+import org.apache.fop.render.intermediate.IFUtil;
import org.apache.fop.util.LogUtil;
/**
@@ -471,7 +472,7 @@ public class PrintRendererConfigurator extends AbstractRendererConfigurator
List fontCollections = new java.util.ArrayList();
fontCollections.add(new Base14FontCollection(fontManager.isBase14KerningEnabled()));
- Configuration cfg = super.getRendererConfig(documentHandler.getMimeType());
+ Configuration cfg = super.getRendererConfig(IFUtil.getEffectiveMIMEType(documentHandler));
if (cfg != null) {
FontResolver fontResolver = new DefaultFontResolver(userAgent);
FontEventListener listener = new FontEventAdapter(
diff --git a/src/java/org/apache/fop/render/intermediate/IFUtil.java b/src/java/org/apache/fop/render/intermediate/IFUtil.java
index 2654eb2a3..58399f3ac 100644
--- a/src/java/org/apache/fop/render/intermediate/IFUtil.java
+++ b/src/java/org/apache/fop/render/intermediate/IFUtil.java
@@ -172,4 +172,21 @@ public class IFUtil {
setupFonts(documentHandler, null);
}
+ /**
+ * Returns the MIME type of the output format that the given document handler is supposed to
+ * handle. If the document handler is an {@link IFSerializer} it returns the MIME type of the
+ * document handler it is mimicking.
+ * @param documentHandler the document handler
+ * @return the effective MIME type
+ */
+ public static String getEffectiveMIMEType(IFDocumentHandler documentHandler) {
+ if (documentHandler instanceof IFSerializer) {
+ IFDocumentHandler mimic = ((IFSerializer)documentHandler).getMimickedDocumentHandler();
+ if (mimic != null) {
+ return mimic.getMimeType();
+ }
+ }
+ return documentHandler.getMimeType();
+ }
+
}