You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by sp...@apache.org on 2007/09/25 11:00:31 UTC
svn commit: r579136 [3/4] - in
/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking: ./
examples/fo/basic/ lib/ src/documentation/content/xdocs/
src/documentation/content/xdocs/0.20.5/
src/documentation/content/xdocs/0.93/ src/documentation/co...
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/LazyFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/LazyFont.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/LazyFont.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/LazyFont.java Tue Sep 25 02:00:20 2007
@@ -54,14 +54,21 @@
* @param useKerning True, if kerning should be enabled
* @param resolver the font resolver to handle font URIs
*/
- public LazyFont(String fontEmbedPath, String metricsFileName
- , boolean useKerning, FontResolver resolver) {
- this.metricsFileName = metricsFileName;
- this.fontEmbedPath = fontEmbedPath;
- this.useKerning = useKerning;
+ public LazyFont(EmbedFontInfo fontInfo, FontResolver resolver) {
+
+ this.metricsFileName = fontInfo.getMetricsFile();
+ this.fontEmbedPath = fontInfo.getEmbedFile();
+ this.useKerning = fontInfo.getKerning();
this.resolver = resolver;
}
+ /**
+ * String representation of LazyFont
+ */
+ public String toString() {
+ return ( "metrics-url=" + metricsFileName + ", embed-url=" + fontEmbedPath + ", kerning=" + useKerning );
+ }
+
private void load(boolean fail) {
if (!isMetricsLoaded) {
try {
@@ -327,6 +334,5 @@
load(true);
return realFontDescriptor.isEmbeddable();
}
-
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/MultiByteFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/MultiByteFont.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/MultiByteFont.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/MultiByteFont.java Tue Sep 25 02:00:20 2007
@@ -108,28 +108,9 @@
public void setCIDType(CIDFontType cidType) {
this.cidType = cidType;
}
-
- /**
- * Removes all white space from a string (used primarily for font names)
- * @param s the string
- * @return the processed result
- */
- public static String stripWhiteSpace(String s) {
- StringBuffer sb = new StringBuffer(s.length());
- for (int i = 0, c = s.length(); i < c; i++) {
- final char ch = s.charAt(i);
- if (ch != ' '
- && ch != '\r'
- && ch != '\n'
- && ch != '\t') {
- sb.append(ch);
- }
- }
- return sb.toString();
- }
private String getPrefixedFontName() {
- return namePrefix + stripWhiteSpace(super.getFontName());
+ return namePrefix + FontUtil.stripWhiteSpace(super.getFontName());
}
/**
@@ -147,7 +128,7 @@
* @see org.apache.fop.fonts.FontDescriptor#isEmbeddable()
*/
public boolean isEmbeddable() {
- return !(getEmbedFileName() == null && embedResourceName == null);
+ return !(getEmbedFileName() == null && getEmbedResourceName() == null);
}
/**
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/apps/TTFReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/apps/TTFReader.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/apps/TTFReader.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/apps/TTFReader.java Tue Sep 25 02:00:20 2007
@@ -27,6 +27,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.fop.Version;
+import org.apache.fop.fonts.FontUtil;
import org.apache.fop.fonts.truetype.FontFileReader;
import org.apache.fop.fonts.truetype.TTFCmapEntry;
import org.apache.fop.fonts.truetype.TTFFile;
@@ -44,6 +45,7 @@
/** Used to detect incompatible versions of the generated XML files */
public static final String METRICS_VERSION_ATTR = "metrics-version";
+ /** Current version number for the metrics file */
public static final int METRICS_VERSION = 2;
/**
@@ -243,7 +245,7 @@
}
Element root = doc.createElement("font-metrics");
doc.appendChild(root);
- root.setAttribute(METRICS_VERSION_ATTR,String.valueOf(METRICS_VERSION));
+ root.setAttribute(METRICS_VERSION_ATTR, String.valueOf(METRICS_VERSION));
if (isCid) {
root.setAttribute("type", "TYPE0");
} else {
@@ -257,10 +259,10 @@
// "Perpetua-Bold", but the TrueType spec says that in the ttf file
// it should be "Perpetua,Bold".
- String s = stripWhiteSpace(ttf.getPostScriptName());
+ String s = FontUtil.stripWhiteSpace(ttf.getPostScriptName());
if (fontName != null) {
- el.appendChild(doc.createTextNode(stripWhiteSpace(fontName)));
+ el.appendChild(doc.createTextNode(FontUtil.stripWhiteSpace(fontName)));
} else {
el.appendChild(doc.createTextNode(s));
}
@@ -449,49 +451,34 @@
}
- private String stripWhiteSpace(String s) {
- char[] ch = new char[s.length()];
- s.getChars(0, s.length(), ch, 0);
- StringBuffer stb = new StringBuffer();
- for (int i = 0; i < ch.length; i++) {
- if (ch[i] != ' '
- && ch[i] != '\r'
- && ch[i] != '\n'
- && ch[i] != '\t') {
- stb.append(ch[i]);
- }
- }
-
- return stb.toString();
- }
-
- /** Bugzilla 40739, check that attr has a metrics-version attribute
- * compatible with ours.
+ /**
+ * Bugzilla 40739, check that attr has a metrics-version attribute
+ * compatible with ours.
* @param attr attributes read from the root element of a metrics XML file
* @throws SAXException if incompatible
*/
public static void checkMetricsVersion(Attributes attr) throws SAXException {
String err = null;
final String str = attr.getValue(METRICS_VERSION_ATTR);
- if(str==null) {
+ if (str == null) {
err = "Missing " + METRICS_VERSION_ATTR + " attribute";
} else {
int version = 0;
try {
version = Integer.parseInt(str);
- if(version < METRICS_VERSION) {
+ if (version < METRICS_VERSION) {
err = "Incompatible " + METRICS_VERSION_ATTR
+ " value (" + version + ", should be " + METRICS_VERSION
+ ")"
;
}
- } catch(NumberFormatException e) {
+ } catch (NumberFormatException e) {
err = "Invalid " + METRICS_VERSION_ATTR
+ " attribute value (" + str + ")";
}
}
- if(err!=null) {
+ if (err != null) {
throw new SAXException(
err
+ " - please regenerate the font metrics file with "
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/truetype/TTFFile.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/truetype/TTFFile.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/truetype/TTFFile.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/truetype/TTFFile.java Tue Sep 25 02:00:20 2007
@@ -567,6 +567,14 @@
}
/**
+ * Returns the font sub family name of the font.
+ * @return String The sub family name
+ */
+ public String getSubFamilyName() {
+ return subFamilyName;
+ }
+
+ /**
* Returns the name of the character set used.
* @return String The caracter set
*/
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java Tue Sep 25 02:00:20 2007
@@ -27,7 +27,6 @@
import org.apache.fop.fonts.BFEntry;
import org.apache.fop.fonts.CIDFontType;
-import org.apache.fop.fonts.CustomFont;
import org.apache.fop.fonts.FontLoader;
import org.apache.fop.fonts.FontResolver;
import org.apache.fop.fonts.MultiByteFont;
@@ -37,18 +36,23 @@
*/
public class TTFFontLoader extends FontLoader {
- private String fontFileURI;
- private TTFFile ttf;
private MultiByteFont multiFont;
- private CustomFont returnFont;
- private FontResolver resolver;
- public TTFFontLoader(String fontFileURI, InputStream in, FontResolver resolver)
- throws IOException {
- this.fontFileURI = fontFileURI;
- this.resolver = resolver;
-
- this.ttf = new TTFFile();
+ /**
+ * Default constructor
+ * @param fontFileURI the URI representing the font file
+ * @param in the InputStream to load the font from
+ * @param resolver the FontResolver for font URI resolution
+ */
+ public TTFFontLoader(String fontFileURI, InputStream in, FontResolver resolver) {
+ super(fontFileURI, in, resolver);
+ }
+
+ /**
+ * @see FontLoader#read()
+ */
+ protected void read() throws IOException {
+ TTFFile ttf = new TTFFile();
FontFileReader reader = new FontFileReader(in);
boolean supported = ttf.readFont(reader, null);
if (!supported) {
@@ -61,11 +65,9 @@
multiFont = new MultiByteFont();
multiFont.setResolver(this.resolver);
returnFont = multiFont;
- read();
- }
-
- private void read() throws IOException {
+
returnFont.setFontName(ttf.getFamilyName());
+ returnFont.setFontSubFamilyName(ttf.getSubFamilyName());
//multiFont.setTTCName(ttcName)
returnFont.setCapHeight(ttf.getCapHeight());
returnFont.setXHeight(ttf.getXHeight());
@@ -77,6 +79,7 @@
returnFont.setStemV(Integer.parseInt(ttf.getStemV())); //not used for TTF
returnFont.setItalicAngle(Integer.parseInt(ttf.getItalicAngle()));
returnFont.setMissingWidth(0);
+
multiFont.setCIDType(CIDFontType.CIDTYPE2);
int[] wx = ttf.getWidths();
multiFont.setWidthArray(wx);
@@ -93,9 +96,12 @@
multiFont.setBFEntries(bfentries);
copyKerning(ttf, true);
multiFont.setEmbedFileName(this.fontFileURI);
-
+ loaded = true;
}
+ /**
+ * Copy kerning information.
+ */
private void copyKerning(TTFFile ttf, boolean isCid) {
// Get kerning
@@ -115,15 +121,7 @@
} else {
h2 = (Map)ttf.getAnsiKerning().get(kpx1);
}
-
returnFont.putKerningEntry(kpx1, h2);
}
- }
-
-
- /** @see org.apache.fop.fonts.FontLoader#getFont() */
- public CustomFont getFont() {
- return this.returnFont;
- }
-
+ }
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/type1/PFMFile.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/type1/PFMFile.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/type1/PFMFile.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/type1/PFMFile.java Tue Sep 25 02:00:20 2007
@@ -190,8 +190,8 @@
int i = inStream.readShort();
- if (log.isInfoEnabled()) {
- log.info(i + " kerning pairs");
+ if (log.isDebugEnabled()) {
+ log.debug(i + " kerning pairs");
}
while (i > 0) {
int g1 = (int)inStream.readByte();
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java Tue Sep 25 02:00:20 2007
@@ -22,7 +22,6 @@
import java.io.IOException;
import java.io.InputStream;
-import org.apache.fop.fonts.CustomFont;
import org.apache.fop.fonts.FontLoader;
import org.apache.fop.fonts.FontResolver;
import org.apache.fop.fonts.FontType;
@@ -33,11 +32,8 @@
*/
public class Type1FontLoader extends FontLoader {
- private String fontFileURI;
private PFMFile pfm;
private SingleByteFont singleFont;
- private CustomFont returnFont;
- private FontResolver resolver;
/**
* Constructs a new Type 1 font loader.
@@ -48,19 +44,19 @@
*/
public Type1FontLoader(String fontFileURI, InputStream in, FontResolver resolver)
throws IOException {
- this.fontFileURI = fontFileURI;
- this.resolver = resolver;
+ super(fontFileURI, in, resolver);
+ }
+ /**
+ * @see FontLoader#read()
+ */
+ protected void read() throws IOException {
pfm = new PFMFile();
pfm.load(in);
singleFont = new SingleByteFont();
singleFont.setFontType(FontType.TYPE1);
singleFont.setResolver(this.resolver);
returnFont = singleFont;
- read();
- }
-
- private void read() throws IOException {
returnFont.setFontName(pfm.getPostscriptName());
returnFont.setCapHeight(pfm.getCapHeight());
returnFont.setXHeight(pfm.getXHeight());
@@ -77,12 +73,5 @@
singleFont.setWidth(i, pfm.getCharWidth(i));
}
singleFont.setEmbedFileName(this.fontFileURI);
-
- }
-
- /** @see org.apache.fop.fonts.FontLoader#getFont() */
- public CustomFont getFont() {
- return this.returnFont;
}
-
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/BMPReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/BMPReader.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/BMPReader.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/BMPReader.java Tue Sep 25 02:00:20 2007
@@ -54,7 +54,11 @@
boolean supported = ((header[0] == (byte) 0x42)
&& (header[1] == (byte) 0x4d));
if (supported) {
- FopImage.ImageInfo info = getDimension(header);
+ FopImage.ImageInfo info = new FopImage.ImageInfo();
+ info.dpiHorizontal = ua.getFactory().getSourceResolution();
+ info.dpiVertical = info.dpiHorizontal;
+
+ getDimension(header, info);
info.originalURI = uri;
info.mimeType = getMimeType();
info.inputStream = bis;
@@ -73,9 +77,7 @@
return "image/bmp";
}
- private FopImage.ImageInfo getDimension(byte[] header) {
- FopImage.ImageInfo info = new FopImage.ImageInfo();
-
+ private void getDimension(byte[] header, FopImage.ImageInfo info) {
// little endian notation
int byte1 = header[WIDTH_OFFSET] & 0xff;
int byte2 = header[WIDTH_OFFSET + 1] & 0xff;
@@ -109,8 +111,6 @@
if (l > 0) {
info.dpiVertical = l / 39.37d;
}
-
- return info;
}
private byte[] getDefaultHeader(InputStream imageStream)
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/GIFReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/GIFReader.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/GIFReader.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/GIFReader.java Tue Sep 25 02:00:20 2007
@@ -48,7 +48,11 @@
&& (header[4] == '7' || header[4] == '9')
&& (header[5] == 'a'));
if (supported) {
- FopImage.ImageInfo info = getDimension(header);
+ FopImage.ImageInfo info = new FopImage.ImageInfo();
+ info.dpiHorizontal = ua.getFactory().getSourceResolution();
+ info.dpiVertical = info.dpiHorizontal;
+
+ getDimension(header, info);
info.originalURI = uri;
info.mimeType = getMimeType();
info.inputStream = bis;
@@ -67,8 +71,7 @@
return "image/gif";
}
- private FopImage.ImageInfo getDimension(byte[] header) {
- FopImage.ImageInfo info = new FopImage.ImageInfo();
+ private void getDimension(byte[] header, FopImage.ImageInfo info) {
// little endian notation
int byte1 = header[6] & 0xff;
int byte2 = header[7] & 0xff;
@@ -77,7 +80,6 @@
byte1 = header[8] & 0xff;
byte2 = header[9] & 0xff;
info.height = ((byte2 << 8) | byte1) & 0xffff;
- return info;
}
private byte[] getDefaultHeader(InputStream imageStream)
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/ImageReaderFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/ImageReaderFactory.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/ImageReaderFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/ImageReaderFactory.java Tue Sep 25 02:00:20 2007
@@ -87,6 +87,8 @@
return info;
}
}
+ log.warn("No ImageReader found for " + uri);
+ in.close();
} catch (IOException ex) {
log.error("Error while recovering Image Informations ("
+ uri + ")", ex);
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/JPEGReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/JPEGReader.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/JPEGReader.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/JPEGReader.java Tue Sep 25 02:00:20 2007
@@ -61,7 +61,11 @@
boolean supported = ((header[0] == (byte) 0xff)
&& (header[1] == (byte) 0xd8));
if (supported) {
- FopImage.ImageInfo info = getDimension(fis);
+ FopImage.ImageInfo info = new FopImage.ImageInfo();
+ info.dpiHorizontal = ua.getFactory().getSourceResolution();
+ info.dpiVertical = info.dpiHorizontal;
+
+ getDimension(fis, info);
info.originalURI = uri;
info.mimeType = getMimeType();
info.inputStream = fis;
@@ -97,8 +101,9 @@
return header;
}
- private FopImage.ImageInfo getDimension(InputStream imageStream) throws IOException {
- FopImage.ImageInfo info = new FopImage.ImageInfo();
+ private void getDimension(InputStream imageStream,
+ FopImage.ImageInfo info)
+ throws IOException {
try {
int pos=0, avail = imageStream.available();
imageStream.mark(avail);
@@ -163,7 +168,8 @@
info.dpiHorizontal = xdensity;
info.dpiVertical = ydensity;
} else {
- //nop, nyi --> 72dpi
+ // Use resolution specified in
+ // FOUserAgent.getFactory() (default 72dpi).
}
int restlen = reclen - 12;
@@ -237,7 +243,6 @@
}
throw ioe;
}
- return info;
}
private int read2bytes(InputStream imageStream) throws IOException {
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/PNGReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/PNGReader.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/PNGReader.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/PNGReader.java Tue Sep 25 02:00:20 2007
@@ -51,7 +51,11 @@
&& (header[7] == (byte) 0x0a));
if (supported) {
- FopImage.ImageInfo info = getDimension(header);
+ FopImage.ImageInfo info = new FopImage.ImageInfo();
+ info.dpiHorizontal = ua.getFactory().getSourceResolution();
+ info.dpiVertical = info.dpiHorizontal;
+
+ getDimension(header, info);
info.originalURI = uri;
info.mimeType = getMimeType();
info.inputStream = bis;
@@ -70,9 +74,7 @@
return "image/png";
}
- private FopImage.ImageInfo getDimension(byte[] header) {
- FopImage.ImageInfo info = new FopImage.ImageInfo();
-
+ private void getDimension(byte[] header, FopImage.ImageInfo info) {
// png is always big endian
int byte1 = header[16] & 0xff;
int byte2 = header[17] & 0xff;
@@ -90,7 +92,6 @@
byte4 = header[23] & 0xff;
l = (long) ((byte1 << 24) | (byte2 << 16) | (byte3 << 8) | byte4);
info.height = (int) l;
- return info;
}
private byte[] getDefaultHeader(InputStream imageStream)
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/SVGReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/SVGReader.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/SVGReader.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/SVGReader.java Tue Sep 25 02:00:20 2007
@@ -43,6 +43,7 @@
import org.apache.fop.image.FopImage;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.svg.SVGUserAgent;
+import org.apache.fop.util.UnclosableInputStream;
/**
* ImageReader object for SVG document image type.
@@ -112,58 +113,7 @@
// parse document and get the size attributes of the svg element
try {
- int length = 5;
- fis.mark(length);
- byte[] b = new byte[length];
- fis.read(b);
- String start = new String(b);
- fis.reset();
-
- //TODO "true ||" here is a hack to improve SVG detection rate. Please improve.
- if (true || start.equals("<?xml")) {
- // we have xml, might be another doc
- // so stop batik from closing the stream
- final InputStream input = fis;
- fis =
- new InputStream() {
- public int read() throws IOException {
- return input.read();
- }
-
- public int read(byte[] b) throws IOException {
- return input.read(b);
- }
-
- public int read(byte[] b, int off, int len)
- throws IOException {
- return input.read(b, off, len);
- }
-
- public long skip(long n) throws IOException {
- return input.skip(n);
- }
-
- public int available() throws IOException {
- return input.available();
- }
-
- public void mark(int rl) {
- input.mark(rl);
- }
-
- public boolean markSupported() {
- return input.markSupported();
- }
-
- public void reset() throws IOException {
- input.reset();
- }
-
- public void close() throws IOException {
- //ignore
- }
- };
- }
+ fis = new UnclosableInputStream(fis);
FopImage.ImageInfo info = new FopImage.ImageInfo();
@@ -175,7 +125,7 @@
info.mimeType = getMimeType();
info.str = SVGDOMImplementation.SVG_NAMESPACE_URI;
- length = fis.available();
+ int length = fis.available();
fis.mark(length + 1);
SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(
XMLImage.getParserName());
@@ -217,7 +167,7 @@
batik = false;
log.warn("Batik not in class path", ncdfe);
return null;
- } catch (Exception e) {
+ } catch (IOException e) {
// If the svg is invalid then it throws an IOException
// so there is no way of knowing if it is an svg document
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/TIFFReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/TIFFReader.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/TIFFReader.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/TIFFReader.java Tue Sep 25 02:00:20 2007
@@ -62,7 +62,11 @@
}
if (supported) {
- FopImage.ImageInfo info = getDimension(header);
+ FopImage.ImageInfo info = new FopImage.ImageInfo();
+ info.dpiHorizontal = ua.getFactory().getSourceResolution();
+ info.dpiVertical = info.dpiHorizontal;
+
+ getDimension(header, info);
info.originalURI = uri;
info.mimeType = getMimeType();
info.inputStream = bis;
@@ -81,33 +85,14 @@
return "image/tiff";
}
- private FopImage.ImageInfo getDimension(byte[] header) {
+ private void getDimension(byte[] header, FopImage.ImageInfo info) {
// currently not setting the width and height
// these are set again by the Jimi image reader.
// I suppose I'll do it one day to be complete. Or
// someone else will.
// Note: bytes 4,5,6,7 contain the byte offset in the stream of the first IFD block
- /*
- * //png is always big endian
- * int byte1 = header[ 16 ] & 0xff;
- * int byte2 = header[ 17 ] & 0xff;
- * int byte3 = header[ 18 ] & 0xff;
- * int byte4 = header[ 19 ] & 0xff;
- * long l = ( long ) ( ( byte1 << 24 ) | ( byte2 << 16 ) |
- * ( byte3 << 8 ) | byte4 );
- * this.width = ( int ) ( l );
- * byte1 = header[ 20 ] & 0xff;
- * byte2 = header[ 21 ] & 0xff;
- * byte3 = header[ 22 ] & 0xff;
- * byte4 = header[ 23 ] & 0xff;
- * l = ( long ) ( ( byte1 << 24 ) | ( byte2 << 16 ) | ( byte3 << 8 ) |
- * byte4 );
- * this.height = ( int ) ( l );
- */
- FopImage.ImageInfo info = new FopImage.ImageInfo();
info.width = -1;
info.height = -1;
- return info;
}
private byte[] getDefaultHeader(InputStream imageStream)
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/XMLReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/XMLReader.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/XMLReader.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/XMLReader.java Tue Sep 25 02:00:20 2007
@@ -31,6 +31,7 @@
// FOP
import org.apache.fop.image.FopImage;
+import org.apache.fop.util.UnclosableInputStream;
import org.apache.fop.apps.FOUserAgent;
// Commons-Logging
@@ -63,8 +64,8 @@
FOUserAgent ua)
throws IOException {
FopImage.ImageInfo info = loadImage(uri, fis, ua);
- info.originalURI = uri;
if (info != null) {
+ info.originalURI = uri;
IOUtils.closeQuietly(fis);
}
return info;
@@ -98,16 +99,17 @@
/**
* Creates an ImageInfo object from an XML image read from a stream.
*
- * @param is The InputStream
+ * @param input The InputStream
* @param ua The user agent
* @return An ImageInfo object describing the image
*/
- public FopImage.ImageInfo createDocument(InputStream is, FOUserAgent ua) {
+ public FopImage.ImageInfo createDocument(final InputStream input, final FOUserAgent ua) {
Document doc = null;
FopImage.ImageInfo info = new FopImage.ImageInfo();
info.mimeType = getMimeType();
try {
+ final InputStream is = new UnclosableInputStream(input);
int length = is.available();
is.mark(length);
@@ -128,13 +130,20 @@
}
}
} catch (Exception e) {
- log.warn("Error while constructing image from XML", e);
+ log.debug("Error while constructing image from XML", e);
try {
- is.reset();
+ input.reset();
} catch (IOException ioe) {
// throw the original exception, not this one
}
return null;
+ }
+ if (info != null) {
+ try {
+ input.close();
+ } catch (IOException io) {
+ // ignore
+ }
}
return info;
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java Tue Sep 25 02:00:20 2007
@@ -40,6 +40,7 @@
import org.apache.fop.fo.pagination.Flow;
import org.apache.fop.fo.pagination.PageSequence;
+import org.apache.fop.fo.pagination.PageSequenceMaster;
import org.apache.fop.fo.pagination.Region;
import org.apache.fop.fo.pagination.RegionBody;
import org.apache.fop.fo.pagination.SideRegion;
@@ -143,10 +144,11 @@
}
areaTreeHandler.getAreaTreeModel().startPageSequence(title);
- log.debug("Starting layout");
+ if (log.isDebugEnabled()) {
+ log.debug("Starting layout");
+ }
curPage = makeNewPage(false, false);
-
Flow mainFlow = pageSeq.getMainFlow();
childFLM = getLayoutManagerMaker().
@@ -172,7 +174,19 @@
areaTreeHandler.notifyPageSequenceFinished(pageSeq,
(currentPageNum - startPageNum) + 1);
pageSeq.releasePageSequence();
- log.debug("Ending layout");
+
+ // If this sequence has a page sequence master so we must reset
+ // it in preparation for the next sequence
+ String masterReference = pageSeq.getMasterReference();
+ PageSequenceMaster pageSeqMaster
+ = pageSeq.getRoot().getLayoutMasterSet().getPageSequenceMaster(masterReference);
+ if (pageSeqMaster != null) {
+ pageSeqMaster.reset();
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("Ending layout");
+ }
}
@@ -778,7 +792,9 @@
}
private void finishPage() {
- curPage.getPageViewport().dumpMarkers();
+ if (log.isTraceEnabled()) {
+ curPage.getPageViewport().dumpMarkers();
+ }
// Layout side regions
layoutSideRegion(FO_REGION_BEFORE);
layoutSideRegion(FO_REGION_AFTER);
@@ -1129,7 +1145,6 @@
// If there is no next page-sequence
// or if the value of its initial-page-number is "auto" do not force any page.
-
// if force-page-count is auto then set the value of forcePageCount
// depending on the initial-page-number of the next page-sequence
if (nextPageSeqInitialPageNumber != null && forcePageCount == Constants.EN_AUTO) {
@@ -1156,19 +1171,19 @@
}
if (forcePageCount == Constants.EN_EVEN) {
- if ((currentPageNum - startPageNum + 1) % 2 != 0) { // we have a odd number of pages
+ if ((currentPageNum - startPageNum + 1) % 2 != 0) { // we have an odd number of pages
curPage = makeNewPage(true, false);
}
} else if (forcePageCount == Constants.EN_ODD) {
- if ((currentPageNum - startPageNum + 1) % 2 == 0) { // we have a even number of pages
+ if ((currentPageNum - startPageNum + 1) % 2 == 0) { // we have an even number of pages
curPage = makeNewPage(true, false);
}
} else if (forcePageCount == Constants.EN_END_ON_EVEN) {
- if (currentPageNum % 2 != 0) { // we are now on a odd page
+ if (currentPageNum % 2 != 0) { // we are now on an odd page
curPage = makeNewPage(true, false);
}
} else if (forcePageCount == Constants.EN_END_ON_ODD) {
- if (currentPageNum % 2 == 0) { // we are now on a even page
+ if (currentPageNum % 2 == 0) { // we are now on an even page
curPage = makeNewPage(true, false);
}
} else if (forcePageCount == Constants.EN_NO_FORCE) {
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java Tue Sep 25 02:00:20 2007
@@ -75,11 +75,14 @@
}
private org.apache.fop.area.inline.TextArea getCharacterInlineArea(Character node) {
- org.apache.fop.area.inline.TextArea text
+ org.apache.fop.area.inline.TextArea text
= new org.apache.fop.area.inline.TextArea();
char ch = node.getCharacter();
if (CharUtilities.isAnySpace(ch)) {
- text.addSpace(ch, 0, CharUtilities.isAdjustableSpace(ch));
+ // add space unless it's zero-width:
+ if (!CharUtilities.isZeroWidthSpace(ch)) {
+ text.addSpace(ch, 0, CharUtilities.isAdjustableSpace(ch));
+ }
} else {
text.addWord(String.valueOf(ch), 0);
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java Tue Sep 25 02:00:20 2007
@@ -23,7 +23,6 @@
import java.util.List;
import java.util.LinkedList;
import java.util.ListIterator;
-import java.util.NoSuchElementException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -378,7 +377,7 @@
iTotalAdjust += (iWordSpaceDim - wordSpaceIPD.opt) * iWScount;
if (iTotalAdjust != iDifference) {
// the applied adjustment is greater or smaller than the needed one
- log.trace("TextLM.addAreas: error in word / letter space adjustment = "
+ log.trace("TextLM.addAreas: error in word / letter space adjustment = "
+ (iTotalAdjust - iDifference));
// set iTotalAdjust = iDifference, so that the width of the TextArea
// will counterbalance the error and the other inline areas will be
@@ -458,11 +457,13 @@
areaInfo = (AreaInfo) vecAreaInfo.get(i);
if (areaInfo.isSpace) {
// areaInfo stores information about spaces
- // add the spaces to the TextArea
+ // add the spaces - except zero-width spaces - to the TextArea
for (int j = areaInfo.iStartIndex; j < areaInfo.iBreakIndex; j++) {
char spaceChar = textArray[j];
- textArea.addSpace(spaceChar, 0,
- CharUtilities.isAdjustableSpace(spaceChar));
+ if (!CharUtilities.isZeroWidthSpace(spaceChar)) {
+ textArea.addSpace(spaceChar, 0,
+ CharUtilities.isAdjustableSpace(spaceChar));
+ }
}
} else {
// areaInfo stores information about a word fragment
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFFilterList.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFFilterList.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFFilterList.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFFilterList.java Tue Sep 25 02:00:20 2007
@@ -24,14 +24,6 @@
import java.util.List;
import java.util.Map;
-// commons logging
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-// Avalon
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-
/**
* This class represents a list of PDF filters to be applied when serializing
* the output of a PDF object.
@@ -56,12 +48,7 @@
private List filters = new java.util.ArrayList();
private boolean ignoreASCIIFilters = false;
-
- /**
- * logging instance
- */
- protected static Log logger = LogFactory.getLog("org.apache.fop.render");
-
+
/**
* Default constructor.
* <p>
@@ -290,53 +277,4 @@
}
return out;
}
-
- /**
- * Builds a filter map from an Avalon Configuration object.
- * @param cfg the Configuration object
- * @return Map the newly built filter map
- * @throws ConfigurationException if a filter list is defined twice
- */
- public static Map buildFilterMapFromConfiguration(Configuration cfg)
- throws ConfigurationException {
- Map filterMap = new java.util.HashMap();
- Configuration[] filterLists = cfg.getChildren("filterList");
- for (int i = 0; i < filterLists.length; i++) {
- Configuration filters = filterLists[i];
- String type = filters.getAttribute("type", null);
- Configuration[] filt = filters.getChildren("value");
- List filterList = new java.util.ArrayList();
- for (int j = 0; j < filt.length; j++) {
- String name = filt[j].getValue();
- filterList.add(name);
- }
-
- if (type == null) {
- type = PDFFilterList.DEFAULT_FILTER;
- }
-
- if (!filterList.isEmpty() && logger.isDebugEnabled()) {
- StringBuffer debug = new StringBuffer("Adding PDF filter");
- if (filterList.size() != 1) {
- debug.append("s");
- }
- debug.append(" for type ").append(type).append(": ");
- for (int j = 0; j < filterList.size(); j++) {
- if (j != 0) {
- debug.append(", ");
- }
- debug.append(filterList.get(j));
- }
- logger.debug(debug.toString());
- }
-
- if (filterMap.get(type) != null) {
- throw new ConfigurationException("A filterList of type '"
- + type + "' has already been defined");
- }
- filterMap.put(type, filterList);
- }
- return filterMap;
- }
-
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFMetadata.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFMetadata.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFMetadata.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFMetadata.java Tue Sep 25 02:00:20 2007
@@ -34,7 +34,6 @@
import org.apache.xmlgraphics.xmp.schemas.pdf.AdobePDFAdapter;
import org.apache.xmlgraphics.xmp.schemas.pdf.AdobePDFSchema;
import org.apache.xmlgraphics.xmp.schemas.pdf.PDFAAdapter;
-import org.apache.xmlgraphics.xmp.schemas.pdf.PDFAOldXMPSchema;
import org.apache.xmlgraphics.xmp.schemas.pdf.PDFAXMPSchema;
import org.xml.sax.SAXException;
@@ -136,7 +135,7 @@
info.setCreationDate(d);
}
- //Important: Acrobat's preflight check for PDF/A-1b wants the creation date in the Info
+ //Important: Acrobat 7's preflight check for PDF/A-1b wants the creation date in the Info
//object and in the XMP metadata to have the same timezone or else it shows a validation
//error even if the times are essentially equal.
@@ -149,7 +148,8 @@
dc.setTitle(info.getTitle());
}
if (info.getSubject() != null) {
- dc.addSubject(info.getSubject());
+ //Subject maps to dc:description["x-default"] as per ISO-19005-1:2005/Cor.1:2007
+ dc.setDescription(null, info.getSubject());
}
dc.addDate(info.getCreationDate());
@@ -157,25 +157,22 @@
PDFAMode pdfaMode = pdfDoc.getProfile().getPDFAMode();
if (pdfaMode.isPDFA1LevelB()) {
PDFAAdapter pdfa = PDFAXMPSchema.getAdapter(meta);
- //Create the identification a second time with the old namespace to keep
- //Adobe Acrobat happy
- PDFAAdapter pdfaOld = PDFAOldXMPSchema.getAdapter(meta);
pdfa.setPart(1);
- pdfaOld.setPart(1);
if (pdfaMode == PDFAMode.PDFA_1A) {
pdfa.setConformance("A"); //PDF/A-1a
- pdfaOld.setConformance("A"); //PDF/A-1a
} else {
pdfa.setConformance("B"); //PDF/A-1b
- pdfaOld.setConformance("B"); //PDF/A-1b
}
}
//XMP Basic Schema
XMPBasicAdapter xmpBasic = XMPBasicSchema.getAdapter(meta);
xmpBasic.setCreateDate(info.getCreationDate());
- PDFProfile profile = pdfDoc.getProfile();
- if (profile.isModDateRequired()) {
+ PDFProfile profile = pdfDoc.getProfile();
+ if (info.getModDate() != null) {
+ xmpBasic.setModifyDate(info.getModDate());
+ } else if (profile.isModDateRequired()) {
+ //if modify date is needed but none is in the Info object, use creation date
xmpBasic.setModifyDate(info.getCreationDate());
}
if (info.getCreator() != null) {
@@ -210,14 +207,9 @@
} else {
info.setAuthor(null);
}
- String[] subjects = dc.getSubjects();
- //PDF/A-1 defines dc:subject as "Text" but XMP defines it as "bag Text".
- //We're simply doing the inverse from createXMPFromUserAgent() above.
- if (subjects != null && subjects.length > 0) {
- info.setSubject(subjects[0]);
- } else {
- info.setSubject(null);
- }
+
+ //dc:description["x-default"] maps to Subject as per ISO-19005-1:2005/Cor.1:2007
+ info.setSubject(dc.getDescription());
AdobePDFAdapter pdf = AdobePDFSchema.getAdapter(meta);
info.setKeywords(pdf.getKeywords());
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/AbstractRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/AbstractRenderer.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/AbstractRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/AbstractRenderer.java Tue Sep 25 02:00:20 2007
@@ -69,18 +69,13 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-// Avalon
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-
/**
* Abstract base class for all renderers. The Abstract renderer does all the
* top level processing of the area tree and adds some abstract methods to
* handle viewports. This keeps track of the current block and inline position.
*/
public abstract class AbstractRenderer
- implements Renderer, Configurable, Constants {
+ implements Renderer, Constants {
/** logging instance */
protected static Log log = LogFactory.getLog("org.apache.fop.render");
@@ -118,12 +113,6 @@
private Set warnedXMLHandlers;
/**
- * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
- */
- public void configure(Configuration conf) throws ConfigurationException {
- }
-
- /**
* @see org.apache.fop.render.Renderer#setupFontInfo(FontInfo)
*/
public abstract void setupFontInfo(FontInfo fontInfo);
@@ -805,39 +794,6 @@
}
/**
- * Returns the configuration subtree for a specific renderer.
- * @param cfg the renderer configuration
- * @param namespace the namespace (i.e. the XMLHandler) for which the configuration should
- * be returned
- * @return the requested configuration subtree, null if there's no configuration
- */
- public static Configuration getHandlerConfig(Configuration cfg, String namespace) {
-
- if (cfg == null || namespace == null) {
- return null;
- }
-
- Configuration handlerConfig = null;
-
- Configuration[] children = cfg.getChildren("xml-handler");
- for (int i = 0; i < children.length; ++i) {
- try {
- if (children[i].getAttribute("namespace").equals(namespace)) {
- handlerConfig = children[i];
- break;
- }
- } catch (ConfigurationException e) {
- // silently pass over configurations without namespace
- }
- }
- if (log.isDebugEnabled()) {
- log.debug((handlerConfig == null ? "No" : "")
- + "XML handler configuration found for namespace " + namespace);
- }
- return handlerConfig;
- }
-
- /**
* Render the xml document with the given xml namespace.
* The Render Context is by the handle to render into the current
* rendering target.
@@ -851,15 +807,9 @@
this, namespace);
if (handler != null) {
try {
- //Optional XML handler configuration
- Configuration cfg = userAgent.getFactory().getUserRendererConfig(getMimeType());
- if (cfg != null) {
- cfg = getHandlerConfig(cfg, namespace);
- if (cfg != null) {
- ctx.setProperty(RendererContextConstants.HANDLER_CONFIGURATION, cfg);
- }
- }
-
+ XMLHandlerConfigurator configurator
+ = new XMLHandlerConfigurator(userAgent);
+ configurator.configure(ctx, namespace);
handler.handleXML(ctx, doc, namespace);
} catch (Throwable t) {
// could not handle document
@@ -887,6 +837,4 @@
public String getMimeType() {
return null;
}
-
}
-
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/AbstractRendererMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/AbstractRendererMaker.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/AbstractRendererMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/AbstractRendererMaker.java Tue Sep 25 02:00:20 2007
@@ -29,10 +29,10 @@
/**
* Instantiates a new renderer.
- * @param ua the user agent
+ * @param userAgent the user agent
* @return the newly instantiated renderer
*/
- public abstract Renderer makeRenderer(FOUserAgent ua);
+ public abstract Renderer makeRenderer(FOUserAgent userAgent);
/**
* @return Indicates whether this renderer requires an OutputStream to work with.
@@ -45,6 +45,16 @@
public abstract String[] getSupportedMimeTypes();
/**
+ * Returns a renderer config object that can be used to
+ * configure the renderer.
+ * @param userAgent user agent
+ * @return a config object that can be used to configure the renderer
+ */
+ public RendererConfigurator getConfigurator(FOUserAgent userAgent) {
+ return null;
+ }
+
+ /**
* Indicates whether a specific MIME type is supported by this renderer.
* @param mimeType the MIME type (ex. "application/pdf")
* @return true if the MIME type is supported
@@ -58,5 +68,4 @@
}
return false;
}
-
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/PrintRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/PrintRenderer.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/PrintRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/PrintRenderer.java Tue Sep 25 02:00:20 2007
@@ -46,7 +46,26 @@
/** list of fonts */
protected List fontList = null;
+
+ /**
+ * adds a font list to current list of fonts
+ * @param fontInfoList font list
+ */
+ public void addFontList(List fontInfoList) {
+ if (this.fontList == null) {
+ setFontList(fontInfoList);
+ } else {
+ this.fontList.addAll(fontInfoList);
+ }
+ }
+ /**
+ * @param fontList list of available fonts
+ */
+ public void setFontList(List fontList) {
+ this.fontList = fontList;
+ }
+
/**
* Set up the font info
*
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/RendererContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/RendererContext.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/RendererContext.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/RendererContext.java Tue Sep 25 02:00:20 2007
@@ -23,7 +23,6 @@
import java.util.Map;
//FOP
-import org.apache.avalon.framework.configuration.Configuration;
import org.apache.fop.apps.FOUserAgent;
/**
@@ -156,17 +155,10 @@
return ((Integer)context.getProperty(RendererContextConstants.HEIGHT)).intValue();
}
- /** @return the handler configuration */
- public Configuration getHandlerConfiguration() {
- return (Configuration)context.getProperty(
- RendererContextConstants.HANDLER_CONFIGURATION);
- }
-
/** @return the foreign attributes */
public Map getForeignAttributes() {
return (Map)context.getProperty(RendererContextConstants.FOREIGN_ATTRIBUTES);
- }
-
+ }
}
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/RendererFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/RendererFactory.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/RendererFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/RendererFactory.java Tue Sep 25 02:00:20 2007
@@ -25,9 +25,6 @@
import java.util.List;
import java.util.Map;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.container.ContainerUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -185,18 +182,9 @@
}
Renderer rend = maker.makeRenderer(userAgent);
rend.setUserAgent(userAgent);
- String mimeType = rend.getMimeType(); //Always use main MIME type for this
- Configuration userRendererConfig = null;
- if (mimeType != null) {
- userRendererConfig
- = userAgent.getFactory().getUserRendererConfig(mimeType);
- }
- if (userRendererConfig != null) {
- try {
- ContainerUtil.configure(rend, userRendererConfig);
- } catch (ConfigurationException e) {
- throw new FOPException(e);
- }
+ RendererConfigurator configurator = maker.getConfigurator(userAgent);
+ if (configurator != null) {
+ configurator.configure(rend);
}
return rend;
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/AFPRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/AFPRenderer.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/AFPRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/AFPRenderer.java Tue Sep 25 02:00:20 2007
@@ -33,8 +33,6 @@
import java.util.List;
import java.util.Map;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.MimeConstants;
@@ -57,8 +55,6 @@
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontMetrics;
import org.apache.fop.fonts.FontTriplet;
-import org.apache.fop.fonts.FontUtil;
-import org.apache.fop.fonts.Typeface;
import org.apache.fop.fonts.base14.Courier;
import org.apache.fop.fonts.base14.Helvetica;
import org.apache.fop.fonts.base14.TimesRoman;
@@ -76,7 +72,6 @@
import org.apache.fop.render.afp.fonts.CharacterSet;
import org.apache.fop.render.afp.fonts.FopCharacterSet;
import org.apache.fop.render.afp.fonts.OutlineFont;
-import org.apache.fop.render.afp.fonts.RasterFont;
import org.apache.fop.render.afp.modca.AFPConstants;
import org.apache.fop.render.afp.modca.AFPDataStream;
import org.apache.fop.render.afp.modca.ImageObject;
@@ -303,195 +298,6 @@
}
/**
- */
- private AFPFontInfo buildFont(Configuration fontCfg, String _path)
- throws ConfigurationException {
-
- Configuration[] triple = fontCfg.getChildren("font-triplet");
- List tripleList = new java.util.ArrayList();
- if (triple.length == 0) {
- log.error("Mandatory font configuration element '<font-triplet...' is missing");
- return null;
- }
- for (int j = 0; j < triple.length; j++) {
- int weight = FontUtil.parseCSS2FontWeight(triple[j].getAttribute("weight"));
- tripleList.add(new FontTriplet(triple[j].getAttribute("name"),
- triple[j].getAttribute("style"),
- weight));
- }
-
- //build the fonts
- Configuration afpFontCfg = fontCfg.getChild("afp-font");
- if (afpFontCfg == null) {
- log.error("Mandatory font configuration element '<afp-font...' is missing");
- return null;
- }
- String path = afpFontCfg.getAttribute("path", _path);
- String type = afpFontCfg.getAttribute("type");
- if (type == null) {
- log.error("Mandatory afp-font configuration attribute 'type=' is missing");
- return null;
- }
- String codepage = afpFontCfg.getAttribute("codepage");
- if (codepage == null) {
- log.error("Mandatory afp-font configuration attribute 'code=' is missing");
- return null;
- }
- String encoding = afpFontCfg.getAttribute("encoding");
- if (encoding == null) {
- log.error("Mandatory afp-font configuration attribute 'encoding=' is missing");
- return null;
- }
-
- if ("raster".equalsIgnoreCase(type)) {
-
- String name = afpFontCfg.getAttribute("name", "Unknown");
-
- // Create a new font object
- RasterFont font = new RasterFont(name);
-
- Configuration[] rasters = afpFontCfg.getChildren("afp-raster-font");
- if (rasters.length == 0) {
- log.error("Mandatory font configuration elements '<afp-raster-font...' are missing");
- return null;
- }
- for (int j = 0; j < rasters.length; j++) {
- Configuration rasterCfg = rasters[j];
-
- String characterset = rasterCfg.getAttribute("characterset");
- if (characterset == null) {
- log.error("Mandatory afp-raster-font configuration attribute 'characterset=' is missing");
- return null;
- }
- int size = rasterCfg.getAttributeAsInteger("size");
- String base14 = rasterCfg.getAttribute("base14-font", null);
-
- if (base14 != null) {
- try {
- Class clazz = Class.forName("org.apache.fop.fonts.base14."
- + base14);
- try {
- Typeface tf = (Typeface)clazz.newInstance();
- font.addCharacterSet(size, new FopCharacterSet(
- codepage, encoding, characterset, size, tf));
- } catch (Exception ie) {
- String msg = "The base 14 font class " + clazz.getName()
- + " could not be instantiated";
- log.error(msg);
- }
- } catch (ClassNotFoundException cnfe) {
- String msg = "The base 14 font class for " + characterset
- + " could not be found";
- log.error(msg);
- }
- } else {
- font.addCharacterSet(size, new CharacterSet(
- codepage, encoding, characterset, path));
- }
- }
- return new AFPFontInfo(font, tripleList);
-
- } else if ("outline".equalsIgnoreCase(type)) {
-
- String characterset = afpFontCfg.getAttribute("characterset");
- if (characterset == null) {
- log.error("Mandatory afp-font configuration attribute 'characterset=' is missing");
- return null;
- }
- String name = afpFontCfg.getAttribute("name", characterset);
-
- CharacterSet characterSet = null;
-
- String base14 = afpFontCfg.getAttribute("base14-font", null);
-
- if (base14 != null) {
- try {
- Class clazz = Class.forName("org.apache.fop.fonts.base14."
- + base14);
- try {
- Typeface tf = (Typeface)clazz.newInstance();
- characterSet = new FopCharacterSet(
- codepage, encoding, characterset, 1, tf);
- } catch (Exception ie) {
- String msg = "The base 14 font class " + clazz.getName()
- + " could not be instantiated";
- log.error(msg);
- }
- } catch (ClassNotFoundException cnfe) {
- String msg = "The base 14 font class for " + characterset
- + " could not be found";
- log.error(msg);
- }
- } else {
- characterSet = new CharacterSet(codepage, encoding, characterset, path);
- }
- // Create a new font object
- OutlineFont font = new OutlineFont(name, characterSet);
- return new AFPFontInfo(font, tripleList);
- } else {
- log.error("No or incorrect type attribute");
- }
- return null;
- }
-
- /**
- * Builds a list of AFPFontInfo objects for use with the setup() method.
- * @param cfg Configuration object
- * @return List the newly created list of fonts
- * @throws ConfigurationException if something's wrong with the config data
- */
- public List buildFontListFromConfiguration(Configuration cfg)
- throws ConfigurationException {
- List fontList = new java.util.ArrayList();
- Configuration[] font = cfg.getChild("fonts").getChildren("font");
- for (int i = 0; i < font.length; i++) {
- AFPFontInfo afi = buildFont(font[i], null);
- if (afi != null) {
- if (log.isDebugEnabled()) {
- log.debug("Adding font " + afi.getAFPFont().getFontName());
- for (int j = 0; j < afi.getFontTriplets().size(); ++j) {
- FontTriplet triplet = (FontTriplet) afi.getFontTriplets().get(j);
- log.debug("Font triplet "
- + triplet.getName() + ", "
- + triplet.getStyle() + ", "
- + triplet.getWeight());
- }
- }
-
- fontList.add(afi);
- }
- }
- return fontList;
- }
-
- /**
- * Configure the AFP renderer.
- * Get the configuration to be used for fonts etc.
- * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
- */
- public void configure(Configuration cfg) throws ConfigurationException {
- //Font configuration
- this.fontList = buildFontListFromConfiguration(cfg);
- Configuration images = cfg.getChild("images");
- if (!"color".equalsIgnoreCase(images.getAttribute("mode", "b+w"))) {
- bitsPerPixel = images.getAttributeAsInteger("bits-per-pixel", 8);
- switch (bitsPerPixel) {
- case 1:
- case 4:
- case 8:
- break;
- default:
- log.warn("Invalid bits_per_pixel value, must be 1, 4 or 8.");
- bitsPerPixel = 8;
- break;
- }
- } else {
- colorImages = true;
- }
-
- }
-
- /**
* @see org.apache.fop.render.Renderer#setUserAgent(FOUserAgent)
*/
public void setUserAgent(FOUserAgent agent) {
@@ -1765,5 +1571,22 @@
}
}
+ public void setBitsPerPixel(int bitsPerPixel) {
+ this.bitsPerPixel = bitsPerPixel;
+ switch (bitsPerPixel) {
+ case 1:
+ case 4:
+ case 8:
+ break;
+ default:
+ log.warn("Invalid bits_per_pixel value, must be 1, 4 or 8.");
+ bitsPerPixel = 8;
+ break;
+ }
+ }
+
+ public void setColorImages(boolean colorImages) {
+ this.colorImages = colorImages;
+ }
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/AFPRendererMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/AFPRendererMaker.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/AFPRendererMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/AFPRendererMaker.java Tue Sep 25 02:00:20 2007
@@ -23,6 +23,7 @@
import org.apache.fop.apps.MimeConstants;
import org.apache.fop.render.AbstractRendererMaker;
import org.apache.fop.render.Renderer;
+import org.apache.fop.render.RendererConfigurator;
/**
* RendererMaker for the AFP Renderer.
@@ -35,8 +36,13 @@
/**@see org.apache.fop.render.AbstractRendererMaker */
- public Renderer makeRenderer(FOUserAgent ua) {
+ public Renderer makeRenderer(FOUserAgent userAgent) {
return new AFPRenderer();
+ }
+
+ /** @see org.apache.fop.render.AbstractRendererMaker#getConfigurator(FOUserAgent) */
+ public RendererConfigurator getConfigurator(FOUserAgent userAgent) {
+ return new AFPRendererConfigurator(userAgent);
}
/** @see org.apache.fop.render.AbstractRendererMaker#needsOutputStream() */
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/awt/AWTRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/awt/AWTRenderer.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/awt/AWTRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/awt/AWTRenderer.java Tue Sep 25 02:00:20 2007
@@ -38,6 +38,7 @@
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.FopFactoryConfigurator;
import org.apache.fop.apps.MimeConstants;
import org.apache.fop.area.Area;
import org.apache.fop.area.PageViewport;
@@ -149,10 +150,10 @@
pageWidth = (int) Math.round(bounds.getWidth() / 1000f);
pageHeight = (int) Math.round(bounds.getHeight() / 1000f);
double scaleX = scaleFactor
- * (25.4 / FOUserAgent.DEFAULT_TARGET_RESOLUTION)
+ * (25.4 / FopFactoryConfigurator.DEFAULT_TARGET_RESOLUTION)
/ userAgent.getTargetPixelUnitToMillimeter();
double scaleY = scaleFactor
- * (25.4 / FOUserAgent.DEFAULT_TARGET_RESOLUTION)
+ * (25.4 / FopFactoryConfigurator.DEFAULT_TARGET_RESOLUTION)
/ userAgent.getTargetPixelUnitToMillimeter();
int bitmapWidth = (int) ((pageWidth * scaleX) + 0.5);
int bitmapHeight = (int) ((pageHeight * scaleY) + 0.5);
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/bitmap/TIFFRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/bitmap/TIFFRenderer.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/bitmap/TIFFRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/bitmap/TIFFRenderer.java Tue Sep 25 02:00:20 2007
@@ -32,9 +32,6 @@
import java.io.OutputStream;
import java.util.Iterator;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-
import org.apache.commons.logging.Log;
import org.apache.xmlgraphics.image.GraphicsUtil;
@@ -77,12 +74,12 @@
//private static final String COMPRESSION_NONE = "NONE";
//private static final String COMPRESSION_JPEG = "JPEG";
- private static final String COMPRESSION_PACKBITS = "PackBits";
+ public static final String COMPRESSION_PACKBITS = "PackBits";
//private static final String COMPRESSION_DEFLATE = "Deflate";
//private static final String COMPRESSION_LZW = "LZW";
//private static final String COMPRESSION_ZLIB = "ZLib";
- private static final String COMPRESSION_CCITT_T6 = "CCITT T.6"; //CCITT Group 4
- private static final String COMPRESSION_CCITT_T4 = "CCITT T.4"; //CCITT Group 3
+ public static final String COMPRESSION_CCITT_T6 = "CCITT T.6"; //CCITT Group 4
+ public static final String COMPRESSION_CCITT_T4 = "CCITT T.4"; //CCITT Group 3
/** ImageWriter parameters */
private ImageWriterParams writerParams;
@@ -115,30 +112,6 @@
writerParams.setResolution(dpi);
}
- /**
- * Configure the TIFF renderer. Get the configuration to be used for
- * compression
- * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
- */
- public void configure(Configuration cfg) throws ConfigurationException {
- super.configure(cfg);
-
- //set compression
- String name = cfg.getChild("compression").getValue(COMPRESSION_PACKBITS);
- //Some compression formats need a special image format:
- if (name.equalsIgnoreCase(COMPRESSION_CCITT_T6)) {
- bufferedImageType = BufferedImage.TYPE_BYTE_BINARY;
- } else if (name.equalsIgnoreCase(COMPRESSION_CCITT_T4)) {
- bufferedImageType = BufferedImage.TYPE_BYTE_BINARY;
- } else {
- bufferedImageType = BufferedImage.TYPE_INT_ARGB;
- }
- if (!"NONE".equalsIgnoreCase(name)) {
- writerParams.setCompressionMethod(name);
- }
- log.info("TIFF compression set to " + name);
- }
-
/** @see org.apache.fop.render.Renderer#startRenderer(java.io.OutputStream) */
public void startRenderer(OutputStream outputStream) throws IOException {
this.outputStream = outputStream;
@@ -252,5 +225,13 @@
throw new UnsupportedOperationException(
"Method 'remove' is not supported.");
}
+ }
+
+ public void setBufferedImageType(int bufferedImageType) {
+ this.bufferedImageType = bufferedImageType;
+ }
+
+ public ImageWriterParams getWriterParams() {
+ return writerParams;
}
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/bitmap/TIFFRendererMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/bitmap/TIFFRendererMaker.java?rev=579136&r1=579135&r2=579136&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/bitmap/TIFFRendererMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/bitmap/TIFFRendererMaker.java Tue Sep 25 02:00:20 2007
@@ -23,6 +23,7 @@
import org.apache.fop.apps.MimeConstants;
import org.apache.fop.render.AbstractRendererMaker;
import org.apache.fop.render.Renderer;
+import org.apache.fop.render.RendererConfigurator;
/**
* RendererMaker for the TIFF Renderer.
@@ -31,10 +32,14 @@
private static final String[] MIMES = new String[] {MimeConstants.MIME_TIFF};
-
- /** @see org.apache.fop.render.AbstractRendererMaker */
- public Renderer makeRenderer(FOUserAgent ua) {
+ /** @see org.apache.fop.render.AbstractRendererMaker#makeRenderer(FOUserAgent) */
+ public Renderer makeRenderer(FOUserAgent userAgent) {
return new TIFFRenderer();
+ }
+
+ /** @see org.apache.fop.render.AbstractRendererMaker#getConfigurator(FOUserAgent) */
+ public RendererConfigurator getConfigurator(FOUserAgent userAgent) {
+ return new TIFFRendererConfigurator(userAgent);
}
/** @see org.apache.fop.render.AbstractRendererMaker#needsOutputStream() */
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org