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 ac...@apache.org on 2008/04/01 17:09:51 UTC
svn commit: r643433 [8/9] - in
/xmlgraphics/fop/branches/Temp_AFPGOCAResources: ./ lib/ src/codegen/fonts/
src/documentation/ src/documentation/content/
src/documentation/content/xdocs/ src/documentation/content/xdocs/0.93/
src/documentation/content/xd...
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/TagLogicalElementBean.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/TagLogicalElementBean.java?rev=643433&r1=643432&r2=643433&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/TagLogicalElementBean.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/TagLogicalElementBean.java Tue Apr 1 08:08:24 2008
@@ -47,7 +47,7 @@
* @return the key
*/
public String getKey() {
- return this.key;
+ return key;
}
/**
@@ -55,7 +55,7 @@
* @return the value
*/
public String getValue() {
- return this.value;
+ return value;
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/CustomFontMetricsMapper.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/CustomFontMetricsMapper.java?rev=643433&r1=643432&r2=643433&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/CustomFontMetricsMapper.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/CustomFontMetricsMapper.java Tue Apr 1 08:08:24 2008
@@ -112,7 +112,7 @@
}
/** {@inheritDoc} */
- public final String getEncoding() {
+ public final String getEncodingName() {
return null; //Not applicable to Java2D rendering
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DRenderer.java?rev=643433&r1=643432&r2=643433&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DRenderer.java Tue Apr 1 08:08:24 2008
@@ -312,6 +312,8 @@
graphics.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
}
+ graphics.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
+ RenderingHints.VALUE_STROKE_PURE);
// transform page based on scale factor supplied
AffineTransform at = graphics.getTransform();
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/SystemFontMetricsMapper.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/SystemFontMetricsMapper.java?rev=643433&r1=643432&r2=643433&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/SystemFontMetricsMapper.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/SystemFontMetricsMapper.java Tue Apr 1 08:08:24 2008
@@ -172,7 +172,7 @@
}
/** {@inheritDoc} */
- public String getEncoding() {
+ public String getEncodingName() {
return null; //Not applicable to Java2D rendering
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java?rev=643433&r1=643432&r2=643433&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java Tue Apr 1 08:08:24 2008
@@ -81,7 +81,7 @@
/** {@inheritDoc} */
public void setup(PDFDocument doc) {
- ICC_Profile prof = image.getICCProfile();
+ ICC_Profile prof = getEffectiveICCProfile();
PDFDeviceColorSpace pdfCS = toPDFColorSpace(getImageColorSpace());
if (prof != null) {
pdfICCStream = setupColorProfile(doc, prof, pdfCS);
@@ -100,6 +100,14 @@
}
}
+ /**
+ * Returns the effective ICC profile for the image.
+ * @return an ICC profile or null
+ */
+ protected ICC_Profile getEffectiveICCProfile() {
+ return image.getICCProfile();
+ }
+
private static PDFICCStream setupColorProfile(PDFDocument doc,
ICC_Profile prof, PDFDeviceColorSpace pdfCS) {
boolean defaultsRGB = ColorProfileUtil.isDefaultsRGB(prof);
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/ImageRawJPEGAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/ImageRawJPEGAdapter.java?rev=643433&r1=643432&r2=643433&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/ImageRawJPEGAdapter.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/ImageRawJPEGAdapter.java Tue Apr 1 08:08:24 2008
@@ -18,19 +18,33 @@
/* $Id$ */
package org.apache.fop.render.pdf;
+import java.awt.color.ICC_Profile;
+import java.io.DataInput;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
+import org.apache.commons.io.IOUtils;
+
import org.apache.xmlgraphics.image.loader.impl.ImageRawJPEG;
+import org.apache.xmlgraphics.image.loader.impl.JPEGConstants;
+import org.apache.xmlgraphics.image.loader.impl.JPEGFile;
+import org.apache.xmlgraphics.image.loader.util.ImageUtil;
import org.apache.fop.pdf.DCTFilter;
import org.apache.fop.pdf.PDFDeviceColorSpace;
import org.apache.fop.pdf.PDFDocument;
import org.apache.fop.pdf.PDFFilter;
import org.apache.fop.pdf.PDFFilterList;
+import org.apache.fop.util.ColorProfileUtil;
/**
* PDFImage implementation for the PDF renderer which handles raw JPEG images.
+ * <p>
+ * The JPEG is copied to the XObject's stream as-is but some elements (marker segments) are
+ * filtered. For example, an embedded color profile is filtered since it is already added as
+ * a PDF object and associated with the XObject. This way, the PDF file size is kept as small
+ * as possible.
*/
public class ImageRawJPEGAdapter extends AbstractImageAdapter {
@@ -68,6 +82,21 @@
}
/** {@inheritDoc} */
+ protected ICC_Profile getEffectiveICCProfile() {
+ ICC_Profile profile = super.getEffectiveICCProfile();
+ if (profile != null
+ && profile.getNumComponents() == 3
+ && !ColorProfileUtil.isDefaultsRGB(profile)) {
+ //RGB profiles which are not sRGB don't seem to work.
+ //Without this override, the image drifts into yellow for an unknown reason.
+ //TODO Find out why this happens.
+ //Test using a JPEG images with, for example, "Adobe RGB 1998" color profile.
+ profile = null;
+ }
+ return profile;
+ }
+
+ /** {@inheritDoc} */
public int getBitsPerComponent() {
return 8;
}
@@ -84,7 +113,77 @@
/** {@inheritDoc} */
public void outputContents(OutputStream out) throws IOException {
- getImage().writeTo(out);
+ InputStream in = getImage().createInputStream();
+ in = ImageUtil.decorateMarkSupported(in);
+ try {
+ JPEGFile jpeg = new JPEGFile(in);
+ DataInput din = jpeg.getDataInput();
+
+ //Copy the whole JPEG file except:
+ // - the ICC profile
+ //TODO Thumbnails could safely be skipped, too.
+ //TODO Metadata (XMP, IPTC, EXIF) could safely be skipped, too.
+ while (true) {
+ int reclen;
+ int segID = jpeg.readMarkerSegment();
+ switch (segID) {
+ case JPEGConstants.SOI:
+ out.write(0xFF);
+ out.write(segID);
+ break;
+ case JPEGConstants.EOI:
+ case JPEGConstants.SOS:
+ out.write(0xFF);
+ out.write(segID);
+ IOUtils.copy(in, out); //Just copy the rest!
+ return;
+ /*
+ case JPEGConstants.APP1: //Metadata
+ case JPEGConstants.APPD:
+ jpeg.skipCurrentMarkerSegment();
+ break;*/
+ case JPEGConstants.APP2: //ICC (see ICC1V42.pdf)
+ boolean skipICCProfile = false;
+ in.mark(16);
+ try {
+ reclen = jpeg.readSegmentLength();
+ // Check for ICC profile
+ byte[] iccString = new byte[11];
+ din.readFully(iccString);
+ din.skipBytes(1); //string terminator (null byte)
+
+ if ("ICC_PROFILE".equals(new String(iccString, "US-ASCII"))) {
+ skipICCProfile = (this.image.getICCProfile() != null);
+ }
+ } finally {
+ in.reset();
+ }
+ if (skipICCProfile) {
+ //ICC profile is skipped as it is already embedded as a PDF object
+ jpeg.skipCurrentMarkerSegment();
+ break;
+ }
+ default:
+ out.write(0xFF);
+ out.write(segID);
+
+ reclen = jpeg.readSegmentLength();
+ //write short
+ out.write((reclen >>> 8) & 0xFF);
+ out.write((reclen >>> 0) & 0xFF);
+ int left = reclen - 2;
+ byte[] buf = new byte[2048];
+ while (left > 0) {
+ int part = Math.min(buf.length, left);
+ din.readFully(buf, 0, part);
+ out.write(buf, 0, part);
+ left -= part;
+ }
+ }
+ }
+ } finally {
+ IOUtils.closeQuietly(in);
+ }
}
/** {@inheritDoc} */
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFGraphics2DAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFGraphics2DAdapter.java?rev=643433&r1=643432&r2=643433&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFGraphics2DAdapter.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFGraphics2DAdapter.java Tue Apr 1 08:08:24 2008
@@ -89,8 +89,8 @@
PDFGraphics2D graphics = new PDFGraphics2D(textAsShapes,
pdfInfo.fi, pdfInfo.pdfDoc,
pdfInfo.pdfContext, pdfInfo.pdfPage.referencePDF(),
- renderer.currentFontName,
- renderer.currentFontSize);
+ pdfInfo.currentFontName,
+ pdfInfo.currentFontSize);
graphics.setGraphicContext(new org.apache.xmlgraphics.java2d.GraphicContext());
AffineTransform transform = new AffineTransform();
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFRenderer.java?rev=643433&r1=643432&r2=643433&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFRenderer.java Tue Apr 1 08:08:24 2008
@@ -63,7 +63,6 @@
import org.apache.fop.area.OffDocumentItem;
import org.apache.fop.area.PageSequence;
import org.apache.fop.area.PageViewport;
-import org.apache.fop.area.RegionViewport;
import org.apache.fop.area.Trait;
import org.apache.fop.area.inline.AbstractTextArea;
import org.apache.fop.area.inline.Image;
@@ -78,6 +77,8 @@
import org.apache.fop.fo.extensions.ExtensionAttachment;
import org.apache.fop.fo.extensions.xmp.XMPMetadata;
import org.apache.fop.fonts.Font;
+import org.apache.fop.fonts.LazyFont;
+import org.apache.fop.fonts.SingleByteFont;
import org.apache.fop.fonts.Typeface;
import org.apache.fop.pdf.PDFAMode;
import org.apache.fop.pdf.PDFAction;
@@ -106,7 +107,7 @@
import org.apache.fop.pdf.PDFResources;
import org.apache.fop.pdf.PDFState;
import org.apache.fop.pdf.PDFStream;
-import org.apache.fop.pdf.PDFText;
+import org.apache.fop.pdf.PDFTextUtil;
import org.apache.fop.pdf.PDFXMode;
import org.apache.fop.pdf.PDFXObject;
import org.apache.fop.render.AbstractPathOrientedRenderer;
@@ -250,21 +251,14 @@
/** drawing state */
protected PDFState currentState = null;
- /** Name of currently selected font */
- protected String currentFontName = "";
- /** Size of currently selected font */
- protected int currentFontSize = 0;
+ /** Text generation utility holding the current font status */
+ protected PDFTextUtil textutil;
/** page height */
protected int pageHeight;
/** Registry of PDF filters */
protected Map filterMap;
- /**
- * true if a BT command has been written.
- */
- protected boolean inTextMode = false;
-
/** Image handler registry */
private PDFImageHandlerRegistry imageHandlerRegistry = new PDFImageHandlerRegistry();
@@ -527,7 +521,7 @@
currentContext = null;
currentPage = null;
currentState = null;
- currentFontName = "";
+ this.textutil = null;
idPositions.clear();
idGoTos.clear();
@@ -665,19 +659,15 @@
/** Indicates the beginning of a text object. */
protected void beginTextObject() {
- if (!inTextMode) {
- currentStream.add("BT\n");
- currentFontName = "";
- inTextMode = true;
+ if (!textutil.isInTextObject()) {
+ textutil.beginTextObject();
}
}
/** Indicates the end of a text object. */
protected void endTextObject() {
- closeText();
- if (inTextMode) {
- currentStream.add("ET\n");
- inTextMode = false;
+ if (textutil.isInTextObject()) {
+ textutil.endTextObject();
}
}
@@ -787,6 +777,11 @@
currentStream = this.pdfDoc.getFactory()
.makeStream(PDFFilterList.CONTENT_FILTER, false);
+ this.textutil = new PDFTextUtil() {
+ protected void write(String code) {
+ currentStream.add(code);
+ }
+ };
currentState = new PDFState();
// Transform the PDF's default coordinate system (0,0 at lower left) to the PDFRenderer's
@@ -795,9 +790,6 @@
currentState.concatenate(basicPageTransform);
currentStream.add(CTMHelper.toPDFString(basicPageTransform, false) + " cm\n");
-
- currentFontName = "";
-
super.renderPage(page);
this.pdfDoc.registerObject(currentStream);
@@ -808,6 +800,7 @@
}
this.pdfDoc.addObject(currentPage);
this.pdfDoc.output(ostream);
+ this.textutil = null;
}
/** {@inheritDoc} */
@@ -841,17 +834,6 @@
}
/**
- * Handle the traits for a region
- * This is used to draw the traits for the given page region.
- * (See Sect. 6.4.1.2 of XSL-FO spec.)
- * @param region the RegionViewport whose region is to be drawn
- */
- protected void handleRegionTraits(RegionViewport region) {
- currentFontName = "";
- super.handleRegionTraits(region);
- }
-
- /**
* Formats a float value (normally coordinates) as Strings.
* @param value the value
* @return the formatted value
@@ -866,7 +848,8 @@
float w = x2 - x1;
float h = y2 - y1;
if ((w < 0) || (h < 0)) {
- log.error("Negative extent received (w=" + w + ", h=" + h + "). Border won't be painted.");
+ log.error("Negative extent received (w=" + w + ", h=" + h
+ + "). Border won't be painted.");
return;
}
switch (style) {
@@ -1329,12 +1312,9 @@
super.renderBlock(block);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected void renderLineArea(LineArea line) {
super.renderLineArea(line);
- closeText();
}
/**
@@ -1423,11 +1403,20 @@
}
}
- /**
- * {@inheritDoc}
- */
+ private Typeface getTypeface(String fontName) {
+ Typeface tf = (Typeface) fontInfo.getFonts().get(fontName);
+ if (tf instanceof LazyFont) {
+ tf = ((LazyFont)tf).getRealFont();
+ }
+ return tf;
+ }
+
+ /** {@inheritDoc} */
public void renderText(TextArea text) {
renderInlineAreaBackAndBorders(text);
+ Color ct = (Color) text.getTrait(Trait.COLOR);
+ updateColor(ct, true);
+
beginTextObject();
StringBuffer pdf = new StringBuffer();
@@ -1435,12 +1424,10 @@
int size = ((Integer) text.getTrait(Trait.FONT_SIZE)).intValue();
// This assumes that *all* CIDFonts use a /ToUnicode mapping
- Typeface tf = (Typeface) fontInfo.getFonts().get(fontName);
- boolean useMultiByte = tf.isMultiByte();
+ Typeface tf = getTypeface(fontName);
+
+ textutil.updateTf(fontName, size / 1000f, tf.isMultiByte());
- updateFont(fontName, size, pdf);
- Color ct = (Color) text.getTrait(Trait.COLOR);
- updateColor(ct, true, pdf);
// word.getOffset() = only height of text itself
// currentBlockIPPosition: 0 for beginning of line; nonzero
@@ -1448,66 +1435,46 @@
int rx = currentIPPosition + text.getBorderAndPaddingWidthStart();
int bl = currentBPPosition + text.getOffset() + text.getBaselineOffset();
- pdf.append("1 0 0 -1 " + format(rx / 1000f) + " " + format(bl / 1000f) + " Tm "
- /*+ format(text.getTextLetterSpaceAdjust() / 1000f) + " Tc\n"*/
- /*+ format(text.getTextWordSpaceAdjust() / 1000f) + " Tw ["*/);
+ textutil.writeTextMatrix(new AffineTransform(1, 0, 0, -1, rx / 1000f, bl / 1000f));
- pdf.append("[");
currentStream.add(pdf.toString());
super.renderText(text);
- currentStream.add("] TJ\n");
+ textutil.writeTJ();
renderTextDecoration(tf, size, text, bl, rx);
}
-
- /**
- * {@inheritDoc}
- */
+
+ /** {@inheritDoc} */
public void renderWord(WordArea word) {
Font font = getFontFromArea(word.getParentArea());
- Typeface tf = (Typeface) fontInfo.getFonts().get(font.getFontName());
- boolean useMultiByte = tf.isMultiByte();
-
- StringBuffer pdf = new StringBuffer();
-
String s = word.getWord();
- escapeText(s, word.getLetterAdjustArray(),
- font, (AbstractTextArea)word.getParentArea(), useMultiByte, pdf);
- currentStream.add(pdf.toString());
+ escapeText(s, word.getLetterAdjustArray(),
+ font, (AbstractTextArea)word.getParentArea());
super.renderWord(word);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void renderSpace(SpaceArea space) {
Font font = getFontFromArea(space.getParentArea());
- Typeface tf = (Typeface) fontInfo.getFonts().get(font.getFontName());
- boolean useMultiByte = tf.isMultiByte();
-
String s = space.getSpace();
- StringBuffer pdf = new StringBuffer();
-
AbstractTextArea textArea = (AbstractTextArea)space.getParentArea();
- escapeText(s, null, font, textArea, useMultiByte, pdf);
+ escapeText(s, null, font, textArea);
if (space.isAdjustable()) {
int tws = -((TextArea) space.getParentArea()).getTextWordSpaceAdjust()
- 2 * textArea.getTextLetterSpaceAdjust();
if (tws != 0) {
- pdf.append(format(tws / (font.getFontSize() / 1000f)));
- pdf.append(" ");
+ float adjust = tws / (font.getFontSize() / 1000f);
+ textutil.adjustGlyphTJ(adjust);
}
}
- currentStream.add(pdf.toString());
-
super.renderSpace(space);
}
@@ -1515,101 +1482,77 @@
* Escapes text according to PDF rules.
* @param s Text to escape
* @param letterAdjust an array of widths for letter adjustment (may be null)
- * @param fs Font state
+ * @param font to font in use
* @param parentArea the parent text area to retrieve certain traits from
- * @param useMultiByte Indicates the use of multi byte convention
- * @param pdf target buffer for the escaped text
*/
- public void escapeText(String s, int[] letterAdjust,
- Font fs, AbstractTextArea parentArea,
- boolean useMultiByte, StringBuffer pdf) {
- String startText = useMultiByte ? "<" : "(";
- String endText = useMultiByte ? "> " : ") ";
-
- /*
- boolean kerningAvailable = false;
- Map kerning = fs.getKerning();
- if (kerning != null && !kerning.isEmpty()) {
- //kerningAvailable = true;
- //TODO Reenable me when the layout engine supports kerning, too
- log.warn("Kerning support is disabled until it is supported by the layout engine!");
+ protected void escapeText(String s,
+ int[] letterAdjust,
+ Font font, AbstractTextArea parentArea) {
+ escapeText(s, 0, s.length(), letterAdjust, font, parentArea);
+ }
+
+ /**
+ * Escapes text according to PDF rules.
+ * @param s Text to escape
+ * @param start the start position in the text
+ * @param end the end position in the text
+ * @param letterAdjust an array of widths for letter adjustment (may be null)
+ * @param font to font in use
+ * @param parentArea the parent text area to retrieve certain traits from
+ */
+ protected void escapeText(String s, int start, int end,
+ int[] letterAdjust,
+ Font font, AbstractTextArea parentArea) {
+ String fontName = font.getFontName();
+ float fontSize = font.getFontSize() / 1000f;
+ Typeface tf = getTypeface(fontName);
+ SingleByteFont singleByteFont = null;
+ if (tf instanceof SingleByteFont) {
+ singleByteFont = (SingleByteFont)tf;
}
- */
int l = s.length();
-
- float fontSize = fs.getFontSize() / 1000f;
- boolean startPending = true;
- for (int i = 0; i < l; i++) {
+
+ for (int i = start; i < end; i++) {
char orgChar = s.charAt(i);
char ch;
float glyphAdjust = 0;
- if (fs.hasChar(orgChar)) {
- ch = fs.mapChar(orgChar);
+ if (font.hasChar(orgChar)) {
+ ch = font.mapChar(orgChar);
+ if (singleByteFont != null && singleByteFont.hasAdditionalEncodings()) {
+ int encoding = ch / 256;
+ if (encoding == 0) {
+ textutil.updateTf(fontName, fontSize, tf.isMultiByte());
+ } else {
+ textutil.updateTf(fontName + "_" + Integer.toString(encoding),
+ fontSize, tf.isMultiByte());
+ ch = (char)(ch % 256);
+ }
+ }
int tls = (i < l - 1 ? parentArea.getTextLetterSpaceAdjust() : 0);
glyphAdjust -= tls;
} else {
if (CharUtilities.isFixedWidthSpace(orgChar)) {
//Fixed width space are rendered as spaces so copy/paste works in a reader
- ch = fs.mapChar(CharUtilities.SPACE);
- glyphAdjust = fs.getCharWidth(ch) - fs.getCharWidth(orgChar);
+ ch = font.mapChar(CharUtilities.SPACE);
+ glyphAdjust = font.getCharWidth(ch) - font.getCharWidth(orgChar);
} else {
- ch = fs.mapChar(orgChar);
+ ch = font.mapChar(orgChar);
}
}
if (letterAdjust != null && i < l - 1) {
glyphAdjust -= letterAdjust[i + 1];
}
- if (startPending) {
- pdf.append(startText);
- startPending = false;
- }
- if (!useMultiByte) {
- if (ch < 32 || ch > 127) {
- pdf.append("\\");
- pdf.append(Integer.toOctalString((int) ch));
- } else {
- switch (ch) {
- case '(':
- case ')':
- case '\\':
- pdf.append("\\");
- break;
- default:
- }
- pdf.append(ch);
- }
- } else {
- pdf.append(PDFText.toUnicodeHex(ch));
- }
+ textutil.writeTJMappedChar(ch);
float adjust = glyphAdjust / fontSize;
if (adjust != 0) {
- pdf.append(endText).append(format(adjust)).append(' ');
- startPending = true;
+ textutil.adjustGlyphTJ(adjust);
}
}
- if (!startPending) {
- pdf.append(endText);
- }
- }
-
- /**
- * Checks to see if we have some text rendering commands open
- * still and writes out the TJ command to the stream if we do
- */
- protected void closeText() {
- /*
- if (textOpen) {
- currentStream.add("] TJ\n");
- textOpen = false;
- prevWordX = 0;
- prevWordY = 0;
- currentFontName = "";
- }*/
}
/**
@@ -1623,8 +1566,6 @@
protected void setColor(Color col, boolean fill, StringBuffer pdf) {
PDFColor color = new PDFColor(this.pdfDoc, col);
- closeText();
-
if (pdf != null) {
pdf.append(color.getColorSpaceOut(fill));
} else {
@@ -1656,22 +1597,10 @@
}
/** {@inheritDoc} */
- protected void updateColor(Color col, boolean fill) {
+ protected void updateColor(Color col, boolean fill) {
updateColor(col, fill, null);
}
- private void updateFont(String name, int size, StringBuffer pdf) {
- if ((!name.equals(this.currentFontName))
- || (size != this.currentFontSize)) {
- closeText();
-
- this.currentFontName = name;
- this.currentFontSize = size;
- pdf = pdf.append("/" + name + " " + format((float) size / 1000f)
- + " Tf\n");
- }
- }
-
/** {@inheritDoc} */
public void renderImage(Image image, Rectangle2D pos) {
endTextObject();
@@ -1727,8 +1656,6 @@
ImageSessionContext sessionContext = getUserAgent().getImageSessionContext();
info = manager.getImageInfo(uri, sessionContext);
-
-
Map hints = ImageUtil.getDefaultHints(sessionContext);
org.apache.xmlgraphics.image.loader.Image img = manager.getImage(
info, imageHandlerRegistry.getSupportedFlavors(), hints, sessionContext);
@@ -1803,9 +1730,8 @@
context.setProperty(PDFRendererContextConstants.PDF_CONTEXT, currentContext);
context.setProperty(PDFRendererContextConstants.PDF_STREAM, currentStream);
context.setProperty(PDFRendererContextConstants.PDF_FONT_INFO, fontInfo);
- context.setProperty(PDFRendererContextConstants.PDF_FONT_NAME, currentFontName);
- context.setProperty(PDFRendererContextConstants.PDF_FONT_SIZE,
- new Integer(currentFontSize));
+ context.setProperty(PDFRendererContextConstants.PDF_FONT_NAME, "");
+ context.setProperty(PDFRendererContextConstants.PDF_FONT_SIZE, new Integer(0));
return context;
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSFontUtils.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSFontUtils.java?rev=643433&r1=643432&r2=643433&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSFontUtils.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSFontUtils.java Tue Apr 1 08:08:24 2008
@@ -32,16 +32,20 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.xmlgraphics.fonts.Glyphs;
import org.apache.xmlgraphics.ps.DSCConstants;
import org.apache.xmlgraphics.ps.PSGenerator;
import org.apache.xmlgraphics.ps.PSResource;
import org.apache.xmlgraphics.ps.dsc.ResourceTracker;
+import org.apache.fop.fonts.Base14Font;
import org.apache.fop.fonts.CustomFont;
import org.apache.fop.fonts.Font;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontType;
import org.apache.fop.fonts.LazyFont;
+import org.apache.fop.fonts.SingleByteEncoding;
+import org.apache.fop.fonts.SingleByteFont;
import org.apache.fop.fonts.Typeface;
/**
@@ -81,9 +85,21 @@
while (iter.hasNext()) {
String key = (String)iter.next();
Typeface tf = getTypeFace(fontInfo, fonts, key);
- PSResource fontRes = new PSResource("font", tf.getFontName());
+ PSResource fontRes = new PSResource(PSResource.TYPE_FONT, tf.getFontName());
fontResources.put(key, fontRes);
embedFont(gen, tf, fontRes);
+
+ if (tf instanceof SingleByteFont) {
+ SingleByteFont sbf = (SingleByteFont)tf;
+ for (int i = 0, c = sbf.getAdditionalEncodingCount(); i < c; i++) {
+ SingleByteEncoding encoding = sbf.getAdditionalEncoding(i);
+ defineEncoding(gen, encoding);
+ String postFix = "_" + (i + 1);
+ PSResource derivedFontRes = defineDerivedFont(gen, tf.getFontName(),
+ tf.getFontName() + postFix, encoding.getName());
+ fontResources.put(key + postFix, derivedFontRes);
+ }
+ }
}
gen.commentln("%FOPEndFontDict");
reencodeFonts(gen, fonts);
@@ -91,29 +107,35 @@
}
private static void reencodeFonts(PSGenerator gen, Map fonts) throws IOException {
+ ResourceTracker tracker = gen.getResourceTracker();
+
+ if (!tracker.isResourceSupplied(WINANSI_ENCODING_RESOURCE)) {
+ defineWinAnsiEncoding(gen);
+ }
gen.commentln("%FOPBeginFontReencode");
- defineWinAnsiEncoding(gen);
//Rewrite font encodings
Iterator iter = fonts.keySet().iterator();
while (iter.hasNext()) {
String key = (String)iter.next();
- Typeface fm = (Typeface)fonts.get(key);
- if (fm instanceof LazyFont && ((LazyFont)fm).getRealFont() == null) {
- continue;
- } else if (null == fm.getEncoding()) {
+ Typeface tf = (Typeface)fonts.get(key);
+ if (tf instanceof LazyFont) {
+ tf = ((LazyFont)tf).getRealFont();
+ if (tf == null) {
+ continue;
+ }
+ }
+ if (null == tf.getEncodingName()) {
//ignore (ZapfDingbats and Symbol used to run through here, kept for safety reasons)
- } else if ("SymbolEncoding".equals(fm.getEncoding())) {
+ } else if ("SymbolEncoding".equals(tf.getEncodingName())) {
//ignore (no encoding redefinition)
- } else if ("ZapfDingbatsEncoding".equals(fm.getEncoding())) {
+ } else if ("ZapfDingbatsEncoding".equals(tf.getEncodingName())) {
//ignore (no encoding redefinition)
- } else if ("WinAnsiEncoding".equals(fm.getEncoding())) {
- redefineFontEncoding(gen, fm.getFontName(), fm.getEncoding());
} else {
- /* Don't complain anymore, just use the font's default encoding.
- gen.commentln("%WARNING: Only WinAnsiEncoding is supported. Font '"
- + fm.getFontName() + "' asks for: " + fm.getEncoding());
- */
+ if (tf instanceof Base14Font) {
+ //Our Base 14 fonts don't use the default encoding
+ redefineFontEncoding(gen, tf.getFontName(), tf.getEncodingName());
+ }
}
}
gen.commentln("%FOPEndFontReencode");
@@ -233,10 +255,88 @@
if (isEmbeddable(cf)) {
resTracker.registerSuppliedResource(fontRes);
}
+ if (tf instanceof SingleByteFont) {
+ SingleByteFont sbf = (SingleByteFont)tf;
+ for (int i = 0, c = sbf.getAdditionalEncodingCount(); i < c; i++) {
+ SingleByteEncoding encoding = sbf.getAdditionalEncoding(i);
+ PSResource encodingRes = new PSResource(
+ PSResource.TYPE_ENCODING, encoding.getName());
+ resTracker.registerSuppliedResource(encodingRes);
+ PSResource derivedFontRes = new PSResource(
+ PSResource.TYPE_FONT, tf.getFontName() + "_" + (i + 1));
+ resTracker.registerSuppliedResource(derivedFontRes);
+ }
+ }
}
}
}
return fontResources;
}
+ /**
+ * Defines the single-byte encoding for use in PostScript files.
+ * @param gen the PostScript generator
+ * @param encoding the single-byte encoding
+ * @return the PSResource instance that represents the encoding
+ * @throws IOException In case of an I/O problem
+ */
+ public static PSResource defineEncoding(PSGenerator gen, SingleByteEncoding encoding)
+ throws IOException {
+ PSResource res = new PSResource(PSResource.TYPE_ENCODING, encoding.getName());
+ gen.writeDSCComment(DSCConstants.BEGIN_RESOURCE, res);
+ gen.writeln("/" + encoding.getName() + " [");
+ String[] charNames = encoding.getCharNameMap();
+ for (int i = 0; i < 256; i++) {
+ if (i > 0) {
+ if ((i % 5) == 0) {
+ gen.newLine();
+ } else {
+ gen.write(" ");
+ }
+ }
+ String glyphname = null;
+ if (i < charNames.length) {
+ glyphname = charNames[i];
+ }
+ if (glyphname == null || "".equals(glyphname)) {
+ glyphname = Glyphs.NOTDEF;
+ }
+ gen.write("/");
+ gen.write(glyphname);
+ }
+ gen.newLine();
+ gen.writeln("] def");
+ gen.writeDSCComment(DSCConstants.END_RESOURCE);
+ gen.getResourceTracker().registerSuppliedResource(res);
+ return res;
+ }
+
+ /**
+ * Derives a new font based on an existing font with a given encoding. The encoding must
+ * have been registered before.
+ * @param gen the PostScript generator
+ * @param baseFontName the font name of the font to derive from
+ * @param fontName the font name of the new font to be define
+ * @param encoding the new encoding (must be predefined in the PS file)
+ * @return the PSResource representing the derived font
+ * @throws IOException In case of an I/O problem
+ */
+ public static PSResource defineDerivedFont(PSGenerator gen, String baseFontName, String fontName,
+ String encoding) throws IOException {
+ PSResource res = new PSResource(PSResource.TYPE_FONT, fontName);
+ gen.writeDSCComment(DSCConstants.BEGIN_RESOURCE, res);
+ gen.commentln("%XGCDependencies: font " + baseFontName);
+ gen.commentln("%XGC+ encoding " + encoding);
+ gen.writeln("/" + baseFontName + " findfont");
+ gen.writeln("dup length dict begin");
+ gen.writeln(" {1 index /FID ne {def} {pop pop} ifelse} forall");
+ gen.writeln(" /Encoding " + encoding + " def");
+ gen.writeln(" currentdict");
+ gen.writeln("end");
+ gen.writeln("/" + fontName + " exch definefont pop");
+ gen.writeDSCComment(DSCConstants.END_RESOURCE);
+ gen.getResourceTracker().registerSuppliedResource(res);
+ return res;
+ }
+
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSRenderer.java?rev=643433&r1=643432&r2=643433&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSRenderer.java Tue Apr 1 08:08:24 2008
@@ -89,6 +89,7 @@
import org.apache.fop.fo.extensions.ExtensionAttachment;
import org.apache.fop.fonts.Font;
import org.apache.fop.fonts.LazyFont;
+import org.apache.fop.fonts.SingleByteFont;
import org.apache.fop.fonts.Typeface;
import org.apache.fop.render.AbstractPathOrientedRenderer;
import org.apache.fop.render.Graphics2DAdapter;
@@ -660,6 +661,12 @@
}
private String getPostScriptNameForFontKey(String key) {
+ int pos = key.indexOf('_');
+ String postFix = null;
+ if (pos > 0) {
+ postFix = key.substring(pos);
+ key = key.substring(0, pos);
+ }
Map fonts = fontInfo.getFonts();
Typeface tf = (Typeface)fonts.get(key);
if (tf instanceof LazyFont) {
@@ -668,7 +675,11 @@
if (tf == null) {
throw new IllegalStateException("Font not available: " + key);
}
- return tf.getFontName();
+ if (postFix == null) {
+ return tf.getFontName();
+ } else {
+ return tf.getFontName() + postFix;
+ }
}
/**
@@ -698,7 +709,6 @@
protected void useFont(String key, int size) {
try {
PSResource res = getPSResourceForFontKey(key);
- //gen.useFont(key, size / 1000f);
gen.useFont("/" + res.getName(), size / 1000f);
gen.getResourceTracker().notifyResourceUsageOnPage(res);
} catch (IOException ioe) {
@@ -951,7 +961,7 @@
if (!isOptimizeResources()) {
this.fontResources = PSFontUtils.writeFontDict(gen, fontInfo);
} else {
- gen.commentln("%FOPFontSetup");
+ gen.commentln("%FOPFontSetup"); //Place-holder, will be replaced in the second pass
}
gen.writeDSCComment(DSCConstants.END_SETUP);
}
@@ -1292,17 +1302,16 @@
*/
public void renderText(TextArea area) {
renderInlineAreaBackAndBorders(area);
- String fontname = getInternalFontNameForArea(area);
+ String fontkey = getInternalFontNameForArea(area);
int fontsize = area.getTraitAsInteger(Trait.FONT_SIZE);
// This assumes that *all* CIDFonts use a /ToUnicode mapping
- Typeface tf = (Typeface) fontInfo.getFonts().get(fontname);
+ Typeface tf = (Typeface) fontInfo.getFonts().get(fontkey);
//Determine position
int rx = currentIPPosition + area.getBorderAndPaddingWidthStart();
int bl = currentBPPosition + area.getOffset() + area.getBaselineOffset();
- useFont(fontname, fontsize);
Color ct = (Color)area.getTrait(Trait.COLOR);
if (ct != null) {
try {
@@ -1347,30 +1356,75 @@
super.renderSpace(space);
}
+ private Typeface getTypeface(String fontName) {
+ Typeface tf = (Typeface)fontInfo.getFonts().get(fontName);
+ if (tf instanceof LazyFont) {
+ tf = ((LazyFont)tf).getRealFont();
+ }
+ return tf;
+ }
+
private void renderText(AbstractTextArea area, String text, int[] letterAdjust) {
+ String fontkey = getInternalFontNameForArea(area);
+ int fontSize = area.getTraitAsInteger(Trait.FONT_SIZE);
Font font = getFontFromArea(area);
- Typeface tf = (Typeface) fontInfo.getFonts().get(font.getFontName());
+ Typeface tf = getTypeface(font.getFontName());
+ SingleByteFont singleByteFont = null;
+ if (tf instanceof SingleByteFont) {
+ singleByteFont = (SingleByteFont)tf;
+ }
+ int textLen = text.length();
+ if (singleByteFont != null && singleByteFont.hasAdditionalEncodings()) {
+ int start = 0;
+ int currentEncoding = -1;
+ for (int i = 0; i < textLen; i++) {
+ char c = text.charAt(i);
+ char mapped = tf.mapChar(c);
+ int encoding = mapped / 256;
+ if (currentEncoding != encoding) {
+ if (i > 0) {
+ writeText(area, text, start, i - start, letterAdjust, fontSize, tf);
+ }
+ if (encoding == 0) {
+ useFont(fontkey, fontSize);
+ } else {
+ useFont(fontkey + "_" + Integer.toString(encoding), fontSize);
+ }
+ currentEncoding = encoding;
+ start = i;
+ }
+ }
+ writeText(area, text, start, textLen - start, letterAdjust, fontSize, tf);
+ } else {
+ useFont(fontkey, fontSize);
+ writeText(area, text, 0, textLen, letterAdjust, fontSize, tf);
+ }
+ }
+
+ private void writeText(AbstractTextArea area, String text, int start, int len,
+ int[] letterAdjust, int fontsize, Typeface tf) {
+ int end = start + len;
int initialSize = text.length();
initialSize += initialSize / 2;
StringBuffer sb = new StringBuffer(initialSize);
- int textLen = text.length();
if (letterAdjust == null
&& area.getTextLetterSpaceAdjust() == 0
&& area.getTextWordSpaceAdjust() == 0) {
sb.append("(");
- for (int i = 0; i < textLen; i++) {
+ for (int i = start; i < end; i++) {
final char c = text.charAt(i);
- final char mapped = tf.mapChar(c);
+ final char mapped = (char)(tf.mapChar(c) % 256);
PSGenerator.escapeChar(mapped, sb);
}
sb.append(") t");
} else {
sb.append("(");
- int[] offsets = new int[textLen];
- for (int i = 0; i < textLen; i++) {
+ int[] offsets = new int[len];
+ for (int i = start; i < end; i++) {
final char c = text.charAt(i);
final char mapped = tf.mapChar(c);
+ char codepoint = (char)(mapped % 256);
int wordSpace;
if (CharUtilities.isAdjustableSpace(mapped)) {
@@ -1378,14 +1432,14 @@
} else {
wordSpace = 0;
}
- int cw = tf.getWidth(mapped, font.getFontSize()) / 1000;
- int ladj = (letterAdjust != null && i < textLen - 1 ? letterAdjust[i + 1] : 0);
- int tls = (i < textLen - 1 ? area.getTextLetterSpaceAdjust() : 0);
- offsets[i] = cw + ladj + tls + wordSpace;
- PSGenerator.escapeChar(mapped, sb);
+ int cw = tf.getWidth(mapped, fontsize) / 1000;
+ int ladj = (letterAdjust != null && i < end - 1 ? letterAdjust[i + 1] : 0);
+ int tls = (i < end - 1 ? area.getTextLetterSpaceAdjust() : 0);
+ offsets[i - start] = cw + ladj + tls + wordSpace;
+ PSGenerator.escapeChar(codepoint, sb);
}
sb.append(")" + PSGenerator.LF + "[");
- for (int i = 0; i < textLen; i++) {
+ for (int i = 0; i < len; i++) {
if (i > 0) {
if (i % 8 == 0) {
sb.append(PSGenerator.LF);
@@ -1398,7 +1452,6 @@
sb.append("]" + PSGenerator.LF + "xshow");
}
writeln(sb.toString());
-
}
/** {@inheritDoc} */
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFGraphics2D.java?rev=643433&r1=643432&r2=643433&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFGraphics2D.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFGraphics2D.java Tue Apr 1 08:08:24 2008
@@ -70,12 +70,10 @@
import org.apache.xmlgraphics.java2d.AbstractGraphics2D;
import org.apache.xmlgraphics.java2d.GraphicContext;
-import org.apache.fop.fonts.CIDFont;
import org.apache.fop.fonts.Font;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontSetup;
import org.apache.fop.fonts.FontTriplet;
-import org.apache.fop.fonts.LazyFont;
import org.apache.fop.pdf.BitmapImage;
import org.apache.fop.pdf.PDFAnnotList;
import org.apache.fop.pdf.PDFColor;
@@ -1473,14 +1471,7 @@
// This assumes that *all* CIDFonts use a /ToUnicode mapping
org.apache.fop.fonts.Typeface f
= (org.apache.fop.fonts.Typeface)fontInfo.getFonts().get(name);
- if (f instanceof LazyFont) {
- if (((LazyFont) f).getRealFont() instanceof CIDFont) {
- return true;
- }
- } else if (f instanceof CIDFont) {
- return true;
- }
- return false;
+ return f.isMultiByte();
}
private void addKerning(StringWriter buf, Integer ch1, Integer ch2,
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFTextPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFTextPainter.java?rev=643433&r1=643432&r2=643433&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFTextPainter.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFTextPainter.java Tue Apr 1 08:08:24 2008
@@ -43,6 +43,7 @@
import org.apache.batik.gvt.text.GVTAttributedCharacterIterator;
import org.apache.batik.gvt.text.TextPaintInfo;
import org.apache.batik.gvt.text.TextSpanLayout;
+
import org.apache.fop.fonts.Font;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontTriplet;
@@ -83,8 +84,12 @@
super.paintTextRuns(textRuns, g2d);
return;
}
- PDFGraphics2D pdf = (PDFGraphics2D)g2d;
- PDFTextUtil textUtil = new PDFTextUtil(pdf);
+ final PDFGraphics2D pdf = (PDFGraphics2D)g2d;
+ PDFTextUtil textUtil = new PDFTextUtil(pdf.fontInfo) {
+ protected void write(String code) {
+ pdf.currentStream.write(code);
+ }
+ };
for (int i = 0; i < textRuns.size(); i++) {
TextRun textRun = (TextRun)textRuns.get(i);
AttributedCharacterIterator runaci = textRun.getACI();
@@ -134,7 +139,7 @@
}
textUtil.saveGraphicsState();
- textUtil.concatMatrixCurrentTransform();
+ textUtil.concatMatrix(g2d.getTransform());
Shape imclip = g2d.getClip();
pdf.writeClip(imclip);
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFTextUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFTextUtil.java?rev=643433&r1=643432&r2=643433&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFTextUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFTextUtil.java Tue Apr 1 08:08:24 2008
@@ -19,145 +19,33 @@
package org.apache.fop.svg;
-import java.awt.geom.AffineTransform;
-
import org.apache.fop.fonts.Font;
-import org.apache.fop.pdf.PDFNumber;
-import org.apache.fop.pdf.PDFText;
+import org.apache.fop.fonts.FontInfo;
+import org.apache.fop.fonts.Typeface;
/**
- * Utility class for generating PDF text objects.
+ * Utility class for generating PDF text objects. It needs to be subclassed to add writing
+ * functionality (see {@link #write(String)}).
*/
-public class PDFTextUtil {
+public abstract class PDFTextUtil extends org.apache.fop.pdf.PDFTextUtil {
- /** The number of decimal places. */
- private static final int DEC = 8;
-
- /** PDF text rendering mode: Fill text */
- public static final int TR_FILL = 0;
- /** PDF text rendering mode: Stroke text */
- public static final int TR_STROKE = 1;
- /** PDF text rendering mode: Fill, then stroke text */
- public static final int TR_FILL_STROKE = 2;
- /** PDF text rendering mode: Neither fill nor stroke text (invisible) */
- public static final int TR_INVISIBLE = 3;
- /** PDF text rendering mode: Fill text and add to path for clipping */
- public static final int TR_FILL_CLIP = 4;
- /** PDF text rendering mode: Stroke text and add to path for clipping */
- public static final int TR_STROKE_CLIP = 5;
- /** PDF text rendering mode: Fill, then stroke text and add to path for clipping */
- public static final int TR_FILL_STROKE_CLIP = 6;
- /** PDF text rendering mode: Add text to path for clipping */
- public static final int TR_CLIP = 7;
-
-
- private PDFGraphics2D g2d;
- private boolean inTextObject = false;
+ private FontInfo fontInfo;
private Font[] fonts;
private Font font;
- private String startText;
- private String endText;
- private boolean useMultiByte;
- private StringBuffer bufTJ;
- private int textRenderingMode = 0;
/**
* Main constructor.
- * @param g2d the PDFGraphics2D instance to work with
+ * @param fontInfo the font catalog
*/
- public PDFTextUtil(PDFGraphics2D g2d) {
- this.g2d = g2d;
+ public PDFTextUtil(FontInfo fontInfo) {
+ super();
+ this.fontInfo = fontInfo;
}
- private void writeAffineTransform(AffineTransform at, StringBuffer sb) {
- double[] lt = new double[6];
- at.getMatrix(lt);
- sb.append(PDFNumber.doubleOut(lt[0], DEC)).append(" ");
- sb.append(PDFNumber.doubleOut(lt[1], DEC)).append(" ");
- sb.append(PDFNumber.doubleOut(lt[2], DEC)).append(" ");
- sb.append(PDFNumber.doubleOut(lt[3], DEC)).append(" ");
- sb.append(PDFNumber.doubleOut(lt[4], DEC)).append(" ");
- sb.append(PDFNumber.doubleOut(lt[5], DEC));
- }
-
- private void writeChar(char ch, StringBuffer sb) {
- if (!useMultiByte) {
- if (ch > 127) {
- sb.append("\\").append(Integer.toOctalString((int)ch));
- } else {
- switch (ch) {
- case '(':
- case ')':
- case '\\':
- sb.append("\\");
- break;
- default:
- }
- sb.append(ch);
- }
- } else {
- sb.append(PDFText.toUnicodeHex(ch));
- }
- }
-
- private void checkInTextObject() {
- if (!inTextObject) {
- throw new IllegalStateException("Not in text object");
- }
- }
-
- /**
- * Called when a new text object should be started. Be sure to call setFont() before
- * issuing any text painting commands.
- */
- public void beginTextObject() {
- if (inTextObject) {
- throw new IllegalStateException("Already in text object");
- }
- g2d.currentStream.write("BT\n");
- this.inTextObject = true;
- }
-
- /**
- * Called when a text object should be ended.
- */
- public void endTextObject() {
- checkInTextObject();
- g2d.currentStream.write("ET\n");
- this.inTextObject = false;
- initValues();
- }
-
- private void initValues() {
+ /** {@inheritDoc} */
+ protected void initValues() {
+ super.initValues();
this.font = null;
- this.textRenderingMode = TR_FILL;
- }
-
- /**
- * Creates a "q" command, pushing a copy of the entire graphics state onto the stack.
- */
- public void saveGraphicsState() {
- g2d.currentStream.write("q\n");
- }
-
- /**
- * Creates a "Q" command, restoring the entire graphics state to its former value by popping
- * it from the stack.
- */
- public void restoreGraphicsState() {
- g2d.currentStream.write("Q\n");
- }
-
- /**
- * Creates a "cm" command using the current transformation as the matrix.
- */
- public void concatMatrixCurrentTransform() {
- StringBuffer sb = new StringBuffer();
- if (!g2d.getTransform().isIdentity()) {
- writeAffineTransform(g2d.getTransform(), sb);
- sb.append(" cm\n");
- }
- g2d.currentStream.write(sb.toString());
}
/**
@@ -194,63 +82,23 @@
}
/**
+ * Determines whether the font with the given name is a multi-byte font.
+ * @param name the name of the font
+ * @return true if it's a multi-byte font
+ */
+ protected boolean isMultiByteFont(String name) {
+ Typeface f = (Typeface)fontInfo.getFonts().get(name);
+ return f.isMultiByte();
+ }
+
+ /**
* Writes a "Tf" command, setting a new current font.
* @param f the font to select
*/
public void writeTf(Font f) {
- checkInTextObject();
String fontName = f.getFontName();
float fontSize = (float)f.getFontSize() / 1000f;
- g2d.currentStream.write("/" + fontName + " " + PDFNumber.doubleOut(fontSize) + " Tf\n");
-
- this.useMultiByte = g2d.isMultiByteFont(fontName);
- this.startText = useMultiByte ? "<" : "(";
- this.endText = useMultiByte ? ">" : ")";
- }
-
- /**
- * Sets the text rendering mode.
- * @param mode the rendering mode (value 0 to 7, see PDF Spec, constants: TR_*)
- */
- public void setTextRenderingMode(int mode) {
- if (mode < 0 || mode > 7) {
- throw new IllegalArgumentException(
- "Illegal value for text rendering mode. Expected: 0-7");
- }
- if (mode != this.textRenderingMode) {
- this.textRenderingMode = mode;
- g2d.currentStream.write(this.textRenderingMode + " Tr\n");
- }
- }
-
- /**
- * Sets the text rendering mode.
- * @param fill true if the text should be filled
- * @param stroke true if the text should be stroked
- * @param addToClip true if the path should be added for clipping
- */
- public void setTextRenderingMode(boolean fill, boolean stroke, boolean addToClip) {
- int mode;
- if (fill) {
- mode = (stroke ? 2 : 0);
- } else {
- mode = (stroke ? 1 : 3);
- }
- if (addToClip) {
- mode += 4;
- }
- setTextRenderingMode(mode);
- }
-
- /**
- * Writes a "Tm" command, setting a new text transformation matrix.
- * @param localTransform the new text transformation matrix
- */
- public void writeTextMatrix(AffineTransform localTransform) {
- StringBuffer sb = new StringBuffer();
- writeAffineTransform(localTransform, sb);
- sb.append(" Tm\n");
- g2d.currentStream.write(sb.toString());
+ updateTf(fontName, fontSize, isMultiByteFont(fontName));
}
/**
@@ -272,37 +120,8 @@
* @param ch the unmapped character
*/
public void writeTJChar(char ch) {
- if (bufTJ == null) {
- bufTJ = new StringBuffer();
- }
- if (bufTJ.length() == 0) {
- bufTJ.append("[").append(startText);
- }
char mappedChar = font.mapChar(ch);
- writeChar(mappedChar, bufTJ);
- }
-
- /**
- * Writes a glyph adjust value to the "TJ-Buffer".
- * @param adjust the glyph adjust value in thousands of text unit space.
- */
- public void adjustGlyphTJ(double adjust) {
- bufTJ.append(endText).append(" ");
- bufTJ.append(PDFNumber.doubleOut(adjust, DEC - 4));
- bufTJ.append(" ");
- bufTJ.append(startText);
- }
-
- /**
- * Writes a "TJ" command, writing out the accumulated buffer with the characters and glyph
- * positioning values. The buffer is reset afterwards.
- */
- public void writeTJ() {
- if (bufTJ != null && bufTJ.length() > 0) {
- bufTJ.append(endText).append("] TJ\n");
- g2d.currentStream.write(bufTJ.toString());
- bufTJ.setLength(0);
- }
+ writeTJMappedChar(mappedChar);
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/status.xml?rev=643433&r1=643432&r2=643433&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/status.xml (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/status.xml Tue Apr 1 08:08:24 2008
@@ -16,25 +16,159 @@
limitations under the License.
-->
<!-- $Id$ -->
+<!DOCTYPE status PUBLIC "-//APACHE//DTD Status V1.3//EN"
+ "http://forrest.apache.org/dtd/status-v13.dtd">
<status>
<developers>
- <!-- Maintained in src/documentation/content/xdocs/team.xml -->
+ <!-- In alphabetical order (last name) -->
+ <person name="Max Berger" email="mayberger@apache.org" id="MB"/>
+ <person name="Chris Bowditch" email="cbowditch@apache.org" id="CB"/>
+ <person name="Jay Bryant" email="jbryant@apache.org" id="JB"/>
+ <person name="Adrian Cumiskey" email="acumiskey@apache.org" id="AC"/>
+ <person name="Bertrand Delacrétaz" email="bdelacretaz@apache.org" id="BD"/>
+ <person name="Andreas Delmelle" email="adelmelle@apache.org" id="AD"/>
+ <person name="Luca Furini" email="lfurini@apache.org" id="LF"/>
+ <person name="Christian Geisert" email="chrisg@apache.org" id="CG"/>
+ <person name="Vincent Hennebert" email="vhennebert@apache.org" id="VH"/>
+ <person name="Clay Leeds" email="clay@apache.org" id="CL"/>
+ <person name="Manuel Mall" email="manuel@apache.org" id="MM"/>
+ <person name="Jeremias Märki" email="jeremias@apache.org" id="JM"/>
+ <person name="Simon Pepping" email="spepping@apache.org" id="SP"/>
+ <person name="the FOP committers" email="fop-dev@xmlgraphics.apache.org" id="all"/>
+ <person name="Volunteer needed" email="general@xmlgraphics.apache.org" id="open"/>
+ <!-- See also src/documentation/content/xdocs/team.xml -->
</developers>
- <todo>
- <!-- See Bugzilla and http://wiki.apache.org/xmlgraphics-fop/FOPProjectTasks -->
- </todo>
-
+ <contexts>
+ <context id="Docs" title="Changes to Documentation"/>
+ <context id="Code" title="Changes to the Code Base"/>
+ <context id="Layout" title="Changes to the Layout Engine"/>
+ <context id="Renderers" title="Changes to Renderers (Output Formats)"/>
+ <context id="Fonts" title="Changes to the Font Subsystem"/>
+ <context id="API" title="Changes to the End-User API"/>
+ <context id="Extensions" title="Changes to the Bundled Extensions"/>
+ <context id="Images" title="Changes to the Image Support"/>
+ </contexts>
+
<changes>
- <release version="FOP Trunk">
+ <release version="FOP Trunk" date="TBD">
+ <action context="Renderers" dev="AC" importance="high" type="add">
+ Added SVG support for AFP (GOCA).
+ </action>
+ <action context="Renderers" dev="AC" importance="high" type="add">
+ Added de-duplication and externalization support for IOCA and GOCA data resource objects.
+ </action>
+ <action context="Renderers" dev="JM" type="update">
+ When a JPEG image is embedded, an optionally embedded color profile is filtered out
+ as it's already embedded separately in the PDF file.
+ </action>
+ <action context="Renderers" dev="JM" type="fix">
+ Worked around a problem (PDF renderer) with JPEG image containing RGB color profiles which
+ are not sRGB. The images drifted into yellow. The color profile is simply disabled in this
+ case. Please let us know if you know what the problem could be.
+ </action>
+ <action context="Fonts" dev="JM" type="add">
+ Added support for addressing all glyphs available in a Type 1 font, not just the ones
+ in the font's primary encoding.
+ </action>
+ </release>
+ <release version="0.95beta" date="22 March 2008">
+ <notes>
+ <section>
+ <title>Notes</title>
+ <p>
+ Besides the important changes listed below, the most important areas with
+ improvements in this release are:
+ </p>
+ <ul>
+ <li>
+ Many bugfixes in tables, plus some new features (full support for keeps and
+ breaks, border conditionality, background on columns and header/footer/body)
+ </li>
+ <li>
+ Improvements and bugfixes for font handling and font
+ auto-detection/-registration.
+ </li>
+ <li>
+ Performance improvements and memory optimizations for the property handling
+ in the FO tree.
+ </li>
+ </ul>
+ <p>
+ Please note that with this release, we've dropped support for Java 1.3.
+ FOP will, from now on, <strong>require at least Java 1.4</strong>.
+ </p>
+ <p>
+ There have been a few changes in tables that make FOP both more strict and more
+ compliant to the Recommendation:
+ <ul>
+ <li>XSL-FO 1.1 explicitly states that a row-spanning fo:table-cell element is not
+ allowed to span further than its enclosing fo:table-header/footer/body element
+ (see bottom of <link href="http://www.w3.org/TR/xsl11/#fo_table">section
+ 6.7.3</link>). From now on FOP will give a validation error if a document
+ contains such an erroneous cell.
+ </li>
+ <li>
+ <p>If an fo:table element contains explicit fo:table-column children, then those
+ elements set the total number of columns in the table. This means that a
+ validation error will now occur if a row contains more cells than available
+ columns. This change allows to improve performance, since the rendering of the
+ table may start as soon as the table-column elements have been parsed.</p>
+ <p>If more flexibility is needed, then the fo:table-column elements may be just
+ omitted. The final number of columns will then be set by the row that has the
+ most cells.</p>
+ </li>
+ </ul>
+ </p>
+ <p>
+ The image libraries Jimi and JAI are no longer needed (and used) for image loading.
+ Instead we rely completely on the Image I/O API that has been introduced with
+ Java 1.4. If you still need support for bitmap image formats that do not work
+ out-of-the-box, we recommend adding
+ <link href="http://jai-imageio.dev.java.net/">JAI Image I/O Tools</link>
+ (an Image I/O compatible image codec package) to the classpath. JAI is still required
+ for building the FOP distribution but it is optional for normal builds and at run-time.
+ </p>
+ </section>
+ </notes>
+ <action context="Layout" dev="JM" type="fix" fixes-bug="44412">
+ Bugfix: The before border of a block is no longer swallowed if its first child issues
+ a break-before.
+ </action>
+ <action context="Layout" dev="JM" type="fix" fixes-bug="44412">
+ Bugfix: When there was a forced break after a block with (conditional) borders the
+ border-after wasn't painted.
+ </action>
+ <action context="Layout" dev="VH" type="fix">
+ Bugfix: a forced break inside a cell was ignored when occurring before the minimum height
+ set on the enclosing row was set.
+ </action>
+ <action context="Layout" dev="JM" type="fix">
+ Fixed exceptions when lists, tables or block-container are children of an inline-level
+ FO.
+ </action>
+ <action context="Layout" dev="VH" type="add" importance="high">
+ Added support for background on fo:table-column and fo:table-header/footer/body elements.
+ </action>
+ <action context="Layout" dev="VH" type="fix">
+ Fixed the rendering of the area of a table corresponding to border-separation, which must
+ be filled with the background of the table, and not the rows.
+ </action>
+ <action context="Layout" dev="VH" type="fix">
+ Improved conformance: even if a table-cell spans several rows its background must
+ correspond to the first row spanned.
+ </action>
+ <action context="Renderers" dev="JM" type="fix" due-to="Gordon Cooke">
+ Slight improvement for thin lines in Java2D/AWT output.
+ </action>
<action context="Layout" dev="VH" type="add">
Added full support for keep-with-previous on fo:table-row and in fo:table-cell elements.
</action>
<action context="Code" dev="MB" type="add">
Turned on XInclude processing for the main source given on the command line.
</action>
- <action context="Fonts" dev="JM" type="fix" fixed-bug="44451" due-to="Justus Piater">
+ <action context="Fonts" dev="JM" type="fix" fixes-bug="44451" due-to="Justus Piater">
Improved the font auto-detection so fonts accessed using the font-family name are
selected with higher accuracy.
</action>
@@ -64,7 +198,7 @@
Bugfix for date formatting with negative time zones in the PDF's Info object.
This affected PDF/A compliance.
</action>
- <action context="Fonts" dev="JM" type="add">
+ <action context="Renderers" dev="JM" type="add">
Added an option to disable the default sRGB profile in PDF output for those who
don't care about color fidelity, but care about PDF file size.
</action>
@@ -134,7 +268,7 @@
<action context="Renderers" dev="JM" type="add" fixes-bug="44176" due-to="Patrick Jaromin">
Added support for custom fonts in Java2DRenderer and derived renderers.
</action>
- <action context="Extensions" dev="JM" type="add">
+ <action context="Extensions" dev="JM" type="add" importance="high">
Added new extension element: fox:external-document. It allows to add whole documents
such as multi-page TIFF images to be inserted as peers to a page-sequence. Each image
will make up an entire page. See the documentation for details.
@@ -143,15 +277,12 @@
Added minimal support for the .minimum/.maximum components of block/inline-progression-dimension
on fo:external-graphic and fo:instream-foreign-object.
</action>
- <action context="Layout" dev="JM" type="add">
+ <action context="Layout" dev="JM" type="add" importance="high">
Added support for scale-down-to-fit and scale-up-to-fit (introduced in XSL 1.1).
</action>
<action context="Layout" dev="VH" type="fix" fixes-bug="43633">
Bugfix: content of a row with zero height overriding the previous row
</action>
- <action context="Renderers" dev="AC" importance="high" type="add">
- Added SVG support for AFP (GOCA).
- </action>
<action context="Renderers" dev="JM" type="fix" fixes-bug="37993">
Bugfix: allow multiple bookmarks to point at the same destination.
</action>
@@ -232,7 +363,7 @@
<action context="Layout" dev="AD" type="add">
Added support for fo:markers in fo:inline and fo:basic-link.
</action>
- <action context="Renderers" dev="JM" type="update">
+ <action context="Renderers" dev="JM" type="update" importance="high">
PDF Transcoder (SVG) text painting has been completely rewritten.
Except for some special cases (with filters for example), all text
(including flow text) is now painted using PDF text operators.
@@ -279,31 +410,21 @@
Added a configuration setting for the renderer/device resolution to the AFP renderer.
</action>
<action context="Layout" dev="AD" type="update">
- <p>
- Facilitate the implementation for font-selection-strategy:
- </p>
- <ul>
- <li>Changed FontInfo.fontLookup to always return an array of FontTriplet</li>
- <li>Changed CommonFont.getFontState to return an array of FontTriplet</li>
- <li>Initial modifications to the related LMs: initialized with
- the font corresponding to the first of the triplets</li>
- </ul>
+ Facilitate the implementation for font-selection-strategy:<br/>
+ ⢠Changed FontInfo.fontLookup to always return an array of FontTriplet.<br/>
+ ⢠Changed CommonFont.getFontState to return an array of FontTriplet.<br/>
+ ⢠Initial modifications to the related LMs: initialized with
+ the font corresponding to the first of the triplets.<br/>
</action>
<action context="Layout" dev="AD" type="update">
- <p>PropertyCache phase 2:</p>
- <ul>
- <li>
- improvement of the PropertyCache itself should now guarantee acceptable
+ PropertyCache phase 2:<br/>
+ ⢠improvement of the PropertyCache itself should now guarantee acceptable
performance of the static caches in multi-session environments, which is
- a possible problem with synchronizedMap
- </li>
- <li>
- changed CommonFont to use the cache:
+ a possible problem with synchronizedMap.<br/>
+ ⢠changed CommonFont to use the cache:
added CachedCommonFont to contain the properties that are always cacheable
- CommonFont itself is only cached if the remaining properties are absolutes
- </li>
- <li>changed CommonHyphenation, KeepProperty, ColorProperty and FontFamilyProperty to use the cache</li>
- </ul>
+ CommonFont itself is only cached if the remaining properties are absolutes.<br/>
+ ⢠changed CommonHyphenation, KeepProperty, ColorProperty and FontFamilyProperty to use the cache.<br/>
</action>
<action context="Layout" dev="AD" type="fix" fixes-bug="42705">
Fixed swallowing PCDATA in text-node children of
@@ -463,33 +584,36 @@
</release>
<release version="0.93" date="9 January 2007">
<notes>
- <p>This is the first production grade release of the new FOP
- codebase.</p>
- <ul>
- <li>It contains the new API first introduced in release 0.92
- beta. The preceding API has been removed.
- </li>
- <li>
- See the <a href="../compliance.html">compliance page</a> for an
- overview of the compliance of this release with the XSL 1.0 and
- 1.1 recommendations.
- </li>
- <li>
- This release again contains many bug fixes and new features. See
- below for details.
- </li>
- <li>
- See the <a href="../knownissues.html">known issues page</a>
- for an overview of the known issues with this release.
- </li>
- </ul>
- <p>Caveats:</p>
- <ul>
- <li>
- You may experience different behaviour compared to version 0.20.5.
- Please consult the <a href="upgrading.html">"Upgrading"</a> page for details.
- </li>
- </ul>
+ <section>
+ <title>Notes</title>
+ <p>This is the first production grade release of the new FOP
+ codebase.</p>
+ <ul>
+ <li>It contains the new API first introduced in release 0.92
+ beta. The preceding API has been removed.
+ </li>
+ <li>
+ See the <link href="../compliance.html">compliance page</link> for an
+ overview of the compliance of this release with the XSL 1.0 and
+ 1.1 recommendations.
+ </li>
+ <li>
+ This release again contains many bug fixes and new features. See
+ below for details.
+ </li>
+ <li>
+ See the <link href="../knownissues.html">known issues page</link>
+ for an overview of the known issues with this release.
+ </li>
+ </ul>
+ <p>Caveats:</p>
+ <ul>
+ <li>
+ You may experience different behaviour compared to version 0.20.5.
+ Please consult the <link href="upgrading.html">"Upgrading"</link> page for details.
+ </li>
+ </ul>
+ </section>
</notes>
<action context="Code" dev="BD" type="add" importance="high">
Added support for the use of Open Type fonts
@@ -1064,9 +1188,18 @@
<action context="Code" dev="all" type="update">
For the change log for the maintenance branch
(where FOP 0.20.5 came from), please see the "CHANGES" file in the distribution, or
- <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/branches/fop-0_20_2-maintain/CHANGES?view=markup">the CHANGES file in the SVN repository</a>.
+ <link href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/branches/fop-0_20_2-maintain/CHANGES?view=markup">the CHANGES file in the SVN repository</link>.
</action>
</release>
</changes>
+ <todo>
+ <!-- See Bugzilla and http://wiki.apache.org/xmlgraphics-fop/FOPProjectTasks -->
+ <actions>
+ <action dev="open" type="update" context="Docs">
+ Improve the documentation.
+ </action>
+ </actions>
+ </todo>
+
</status>
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/java/org/apache/fop/URIResolutionTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/java/org/apache/fop/URIResolutionTestCase.java?rev=643433&r1=643432&r2=643433&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/java/org/apache/fop/URIResolutionTestCase.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/java/org/apache/fop/URIResolutionTestCase.java Tue Apr 1 08:08:24 2008
@@ -36,17 +36,19 @@
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
+import org.w3c.dom.Document;
+
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.output.ByteArrayOutputStream;
+import org.apache.xpath.XPathAPI;
+import org.apache.xpath.objects.XObject;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.MimeConstants;
import org.apache.fop.render.xml.XMLRenderer;
-import org.apache.xpath.XPathAPI;
-import org.apache.xpath.objects.XObject;
-import org.w3c.dom.Document;
/**
* Tests URI resolution facilities.
@@ -85,9 +87,6 @@
private void innerTestFO1(boolean withStream) throws Exception {
FOUserAgent ua = fopFactory.newFOUserAgent();
- //Reset the image caches to force URI resolution!
- ua.getFactory().getImageFactory().clearCaches();
-
File foFile = new File(getBaseDir(), "test/xml/uri-resolution1.fo");
MyURIResolver resolver = new MyURIResolver(withStream);
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java?rev=643433&r1=643432&r2=643433&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java Tue Apr 1 08:08:24 2008
@@ -65,7 +65,7 @@
* The following array is used to look for these patterns
*/
final String[] testPatterns = {
- TEST_MARKER + "1", "(Standard)",
+ TEST_MARKER + "1", "Standard",
TEST_MARKER + "2", "XX_\\351_XX",
TEST_MARKER + "3", "XX_\\342\\352\\356\\364\\373_XX"
};
@@ -75,7 +75,9 @@
/**
* TODO test disabled for now, fails due (probably) do different PDF
- * encoding when custom font is used
+ * encoding when custom font is used.
+ * TODO This should be tested using PDFBox. If PDFBox can extract the text correctly,
+ * everything is fine. The tests here are too unstable.
*
* @throws Exception
* checkstyle wants a comment here, even a silly one
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/layoutengine/disabled-testcases.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/layoutengine/disabled-testcases.xml?rev=643433&r1=643432&r2=643433&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/layoutengine/disabled-testcases.xml (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/layoutengine/disabled-testcases.xml Tue Apr 1 08:08:24 2008
@@ -233,54 +233,6 @@
<description>Column balancing doesn't work as expected.</description>
</testcase>
<testcase>
- <name>No background-images on table-body</name>
- <file>table-body_background-image.xml</file>
- <description>The backgrounds of table-body, table-header,
- table-footer and table-column are not painted, yet.</description>
- </testcase>
- <testcase>
- <name>Collapsing Border Model NYI</name>
- <file>table_border-collapse_collapse_1.xml</file>
- <description>Border-collapse="collapse" is not yet
- implemented.</description>
- </testcase>
- <testcase>
- <name>Collapsing Border Model NYI</name>
- <file>table_border-collapse_collapse_2.xml</file>
- <description>Border-collapse="collapse" is not yet
- implemented.</description>
- </testcase>
- <testcase>
- <name>Problems with border and padding on tables</name>
- <file>table_border_padding.xml</file>
- <description>The element list seems to not be fully correct, yet, causing
- the layout to look odd.</description>
- </testcase>
- <testcase>
- <name>keep-with-previous doesn't work inside tables</name>
- <file>table-cell_block_keep-with-previous.xml</file>
- <description>Keep-with-previous doesn't work inside tables and
- lists, yet.</description>
- </testcase>
- <testcase>
- <name>Border and padding conditionality is NYI on table-cells</name>
- <file>table-cell_border_padding_conditionality.xml</file>
- <description>Border and padding conditionality are not supported
- on table-cells, yet.</description>
- </testcase>
- <testcase>
- <name>No background-images on table-header</name>
- <file>table-header_background-image.xml</file>
- <description>The backgrounds of table-body, table-header,
- table-footer and table-column are not painted, yet.</description>
- </testcase>
- <testcase>
- <name>keep-with-previous doesn't work on table-rows</name>
- <file>table-row_keep-with-previous.xml</file>
- <description>Keep-with-previous doesn't work inside tables and
- lists, yet.</description>
- </testcase>
- <testcase>
<name>table-cell empty area with marker.xml</name>
<file>table-cell_empty_area_with_marker.xml</file>
<description>A table-cell producing an empty area does currently not add any markers to a page.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org