aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render/intermediate
diff options
context:
space:
mode:
authorMehdi Houshmand <mehdi@apache.org>2012-07-02 13:23:46 +0000
committerMehdi Houshmand <mehdi@apache.org>2012-07-02 13:23:46 +0000
commitab426a49d46ec69b80e6accccd537522477df5b3 (patch)
treea4a4550b9d329c7a7eae6a8d00861f373911c081 /src/java/org/apache/fop/render/intermediate
parentc9f6e74ddf229f879ea7df1b389d6018286ca1aa (diff)
parentf5a033d38f700d70bbf679d87d535b37438c9ebb (diff)
downloadxmlgraphics-fop-ab426a49d46ec69b80e6accccd537522477df5b3.tar.gz
xmlgraphics-fop-ab426a49d46ec69b80e6accccd537522477df5b3.zip
Merged in trunk@1356161
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_URI_Unification@1356212 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/intermediate')
-rw-r--r--src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java29
-rw-r--r--src/java/org/apache/fop/render/intermediate/IFException.java25
2 files changed, 42 insertions, 12 deletions
diff --git a/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java b/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java
index e86cc435f..147b6d54b 100644
--- a/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java
+++ b/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java
@@ -46,6 +46,8 @@ import org.apache.xmlgraphics.image.loader.util.ImageUtil;
import org.apache.fop.ResourceEventProducer;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.fo.Constants;
+import org.apache.fop.fonts.FontInfo;
+import org.apache.fop.fonts.FontTriplet;
import org.apache.fop.render.ImageHandler;
import org.apache.fop.render.ImageHandlerRegistry;
import org.apache.fop.render.ImageHandlerUtil;
@@ -56,7 +58,7 @@ import org.apache.fop.traits.RuleStyle;
/**
* Abstract base class for IFPainter implementations.
*/
-public abstract class AbstractIFPainter implements IFPainter {
+public abstract class AbstractIFPainter<T extends IFDocumentHandler> implements IFPainter {
/** logging instance */
private static Log log = LogFactory.getLog(AbstractIFPainter.class);
@@ -67,18 +69,39 @@ public abstract class AbstractIFPainter implements IFPainter {
/** Holds the intermediate format state */
protected IFState state;
+ private final T documentHandler;
/**
* Default constructor.
*/
- public AbstractIFPainter() {
+ public AbstractIFPainter(T documentHandler) {
+ this.documentHandler = documentHandler;
+ }
+
+ protected String getFontKey(FontTriplet triplet) throws IFException {
+ String key = getFontInfo().getInternalFontKey(triplet);
+ if (key == null) {
+ throw new IFException("The font triplet is not available: \"" + triplet + "\" "
+ + "for the MIME type: \"" + documentHandler.getMimeType() + "\"");
+ }
+ return key;
}
/**
* Returns the intermediate format context object.
* @return the context object
*/
- protected abstract IFContext getContext();
+ protected IFContext getContext() {
+ return documentHandler.getContext();
+ }
+
+ protected FontInfo getFontInfo() {
+ return documentHandler.getFontInfo();
+ }
+
+ protected T getDocumentHandler() {
+ return documentHandler;
+ }
/**
* Returns the user agent.
diff --git a/src/java/org/apache/fop/render/intermediate/IFException.java b/src/java/org/apache/fop/render/intermediate/IFException.java
index 52c650765..5f35c3e3a 100644
--- a/src/java/org/apache/fop/render/intermediate/IFException.java
+++ b/src/java/org/apache/fop/render/intermediate/IFException.java
@@ -27,20 +27,27 @@ public class IFException extends Exception {
private static final long serialVersionUID = 0L;
/**
- * Constructs a new exception with the specified detail message and
- * cause. <p>Note that the detail message associated with
- * <code>cause</code> is <i>not</i> automatically incorporated in
+ * Constructs a new exception with the specified detail message and cause. <p>Note that the
+ * detail message associated with <code>cause</code> is <i>not</i> automatically incorporated in
* this exception's detail message.
*
- * @param message the detail message (which is saved for later retrieval
- * by the {@link #getMessage()} method).
- * @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <code>null</code> value is
- * permitted, and indicates that the cause is nonexistent or
- * unknown.)
+ * @param message the detail message (which is saved for later retrieval by the
+ * {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the {@link #getCause()}
+ * method). (A <code>null</code> value is permitted, and indicates that the cause is
+ * nonexistent or unknown.)
*/
public IFException(String message, Exception cause) {
super(message, cause);
}
+ /**
+ * Constructs a new exception with the specified detail message.
+ *
+ * @param message the detail message (which is saved for later retrieval by the
+ * {@link #getMessage()} method).
+ */
+ public IFException(String message) {
+ super(message);
+ }
}