aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/fonts/FontReader.java
diff options
context:
space:
mode:
authorManuel Mall <manuel@apache.org>2006-01-07 13:15:53 +0000
committerManuel Mall <manuel@apache.org>2006-01-07 13:15:53 +0000
commit8faab42c21e565d859e8caa0c56df1c2a8748dea (patch)
tree998c86d83823706d64f5af8b7cca548f22ec6da8 /src/java/org/apache/fop/fonts/FontReader.java
parent5c359c10e6131572e46745dfe46c4c556e361ea0 (diff)
downloadxmlgraphics-fop-8faab42c21e565d859e8caa0c56df1c2a8748dea.tar.gz
xmlgraphics-fop-8faab42c21e565d859e8caa0c56df1c2a8748dea.zip
Added support for relative font config URLs (metrics-url and embed-url). These URLs are now resolved through the FOP config URI resolver. A new configuration item font-base has been added which defines the base URL to be used for resolution of the font URLs. If it is not given the normal FOP base URL is used. Unrelated to this feature the patch also contains a new image class (java 1.4 specific) for JPEG images. This is for renderers (e.g. AFP) which require access to the decoded JPEG.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@366718 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fonts/FontReader.java')
-rw-r--r--src/java/org/apache/fop/fonts/FontReader.java22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/java/org/apache/fop/fonts/FontReader.java b/src/java/org/apache/fop/fonts/FontReader.java
index 5953c91fb..74ed06579 100644
--- a/src/java/org/apache/fop/fonts/FontReader.java
+++ b/src/java/org/apache/fop/fonts/FontReader.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004,2006 The Apache Software Foundation.
+ * Copyright 1999-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,6 +34,8 @@ import org.xml.sax.helpers.DefaultHandler;
//FOP
import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.FOUserAgent;
+import org.xml.sax.InputSource;
/**
* Class for reading a metric.xml file and creating a font object.
@@ -61,7 +63,7 @@ public class FontReader extends DefaultHandler {
private List bfranges = null;
- private void createFont(String path) throws FOPException {
+ private void createFont(InputSource source) throws FOPException {
XMLReader parser = null;
try {
@@ -86,7 +88,7 @@ public class FontReader extends DefaultHandler {
parser.setContentHandler(this);
try {
- parser.parse(path);
+ parser.parse(source);
} catch (SAXException e) {
throw new FOPException(e);
} catch (IOException e) {
@@ -111,6 +113,14 @@ public class FontReader extends DefaultHandler {
returnFont.setKerningEnabled(enabled);
}
+ /**
+ * Sets the user agent environment. Needed for URI resolution
+ * @param userAgent the user agent
+ */
+ public void setUserAgent(FOUserAgent userAgent) {
+ returnFont.setUserAgent(userAgent);
+ }
+
/**
* Get the generated font object
@@ -123,11 +133,11 @@ public class FontReader extends DefaultHandler {
/**
* Construct a FontReader object from a path to a metric.xml file
* and read metric data
- * @param path URI to the font metric file
+ * @param source Source of the font metric file
* @throws FOPException if loading the font fails
*/
- public FontReader(String path) throws FOPException {
- createFont(path);
+ public FontReader(InputSource source) throws FOPException {
+ createFont(source);
}
/**