aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorManuel Mall <manuel@apache.org>2005-12-17 05:26:36 +0000
committerManuel Mall <manuel@apache.org>2005-12-17 05:26:36 +0000
commitf3872545227afbab91aac6b68e50686d07255216 (patch)
treef9c9e3337fa1090ea243ada3a246efdab31570f3 /src
parentcd600b952b6326195b1670e6a17af75d51f46b57 (diff)
downloadxmlgraphics-fop-f3872545227afbab91aac6b68e50686d07255216.tar.gz
xmlgraphics-fop-f3872545227afbab91aac6b68e50686d07255216.zip
Another workaround/hack to deal with non breaking spaces. Also some minor adjustments to support the planned AFP renderer
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@357298 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/apps/MimeConstants.java7
-rw-r--r--src/java/org/apache/fop/cli/CommandLineOptions.java13
-rw-r--r--src/java/org/apache/fop/image/AbstractFopImage.java4
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java2
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java2
-rw-r--r--src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java10
-rw-r--r--src/java/org/apache/fop/render/pdf/FopPDFImage.java6
7 files changed, 33 insertions, 11 deletions
diff --git a/src/java/org/apache/fop/apps/MimeConstants.java b/src/java/org/apache/fop/apps/MimeConstants.java
index f33ddf70f..3b5805dce 100644
--- a/src/java/org/apache/fop/apps/MimeConstants.java
+++ b/src/java/org/apache/fop/apps/MimeConstants.java
@@ -33,6 +33,11 @@ public interface MimeConstants {
/** HP's PCL (alternative MIME type) */
String MIME_PCL_ALT = "application/vnd.hp-PCL";
+ /** IBM's AFP */
+ String MIME_AFP = "application/x-afp";
+ /** IBM's AFP (alternative MIME type) */
+ String MIME_AFP_ALT = "application/vnd.ibm.modcap";
+
/** Plain text */
String MIME_PLAIN_TEXT = "text/plain";
@@ -49,6 +54,8 @@ public interface MimeConstants {
/** Structured Vector Graphics */
String MIME_SVG = "image/svg+xml";
+ /** GIF images */
+ String MIME_GIF = "image/gif";
/** PNG images */
String MIME_PNG = "image/png";
/** JPEG images */
diff --git a/src/java/org/apache/fop/cli/CommandLineOptions.java b/src/java/org/apache/fop/cli/CommandLineOptions.java
index b7553a6ad..c1c069b39 100644
--- a/src/java/org/apache/fop/cli/CommandLineOptions.java
+++ b/src/java/org/apache/fop/cli/CommandLineOptions.java
@@ -226,6 +226,8 @@ public class CommandLineOptions implements Constants {
i = i + parseTextOutputOption(args, i);
} else if (args[i].equals("-svg")) {
i = i + parseSVGOutputOption(args, i);
+ } else if (args[i].equals("-afp")) {
+ i = i + parseAFPOutputOption(args, i);
} else if (args[i].equals("-foout")) {
i = i + parseFOOutputOption(args, i);
} else if (args[i].equals("-out")) {
@@ -440,6 +442,17 @@ public class CommandLineOptions implements Constants {
}
}
+ private int parseAFPOutputOption(String[] args, int i) throws FOPException {
+ setOutputMode(MimeConstants.MIME_AFP);
+ if ((i + 1 == args.length)
+ || (args[i + 1].charAt(0) == '-')) {
+ throw new FOPException("you must specify the AFP output file");
+ } else {
+ outfile = new File(args[i + 1]);
+ return 1;
+ }
+ }
+
private int parseFOOutputOption(String[] args, int i) throws FOPException {
setOutputMode(MimeConstants.MIME_XSL_FO);
if ((i + 1 == args.length)
diff --git a/src/java/org/apache/fop/image/AbstractFopImage.java b/src/java/org/apache/fop/image/AbstractFopImage.java
index e8189c95c..f64fdfb72 100644
--- a/src/java/org/apache/fop/image/AbstractFopImage.java
+++ b/src/java/org/apache/fop/image/AbstractFopImage.java
@@ -20,6 +20,7 @@ package org.apache.fop.image;
// Java
import java.awt.color.ColorSpace;
+import java.awt.color.ICC_ColorSpace;
import java.awt.color.ICC_Profile;
import java.io.InputStream;
import java.awt.Color;
@@ -271,6 +272,9 @@ public abstract class AbstractFopImage implements FopImage {
* @return the icc profile or null if not applicable
*/
public ICC_Profile getICCProfile() {
+ if (this.colorSpace != null && this.colorSpace instanceof ICC_ColorSpace) {
+ return ((ICC_ColorSpace)this.colorSpace).getProfile();
+ }
return null;
}
diff --git a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
index 4eaf30088..fa266b6ba 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
@@ -780,7 +780,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
"Sequence was empty! lastElement is null");
}
}
- bPrevWasKnuthBox = lastElement.isBox();
+ bPrevWasKnuthBox = lastElement.isBox() && lastElement.getW() != 0;
// if last paragraph is open, add the new elements to the paragraph
// else this is the last paragraph
diff --git a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
index 3e40dc31f..fedb3d10e 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
@@ -950,7 +950,7 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
if (textArray[ai.iStartIndex] == NBSPACE) {
spaceElements.add
(new KnuthInlineBox(0, null,
- notifyPos(new LeafPosition(this, -1)), false));
+ notifyPos(new LeafPosition(this, -1)), true));
}
return spaceElements;
}
diff --git a/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java b/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java
index ae87009c8..5821c96a6 100644
--- a/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java
+++ b/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java
@@ -36,7 +36,7 @@ import org.apache.fop.area.inline.Space;
import org.apache.fop.area.inline.Viewport;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.Constants;
-import org.apache.fop.fonts.Typeface;
+import org.apache.fop.fonts.FontMetrics;
import org.apache.fop.image.FopImage;
import org.apache.fop.traits.BorderProps;
@@ -581,21 +581,21 @@ public abstract class AbstractPathOrientedRenderer extends PrintRenderer {
/**
* Paints the text decoration marks.
- * @param tf Current typeface
+ * @param fm Current typeface
* @param fontsize Current font size
* @param inline inline area to paint the marks for
* @param baseline position of the baseline
* @param startx start IPD
*/
- protected void renderTextDecoration(Typeface tf, int fontsize, InlineArea inline,
+ protected void renderTextDecoration(FontMetrics fm, int fontsize, InlineArea inline,
int baseline, int startx) {
boolean hasTextDeco = inline.hasUnderline()
|| inline.hasOverline()
|| inline.hasLineThrough();
if (hasTextDeco) {
endTextObject();
- float descender = tf.getDescender(fontsize) / 1000f;
- float capHeight = tf.getCapHeight(fontsize) / 1000f;
+ float descender = fm.getDescender(fontsize) / 1000f;
+ float capHeight = fm.getCapHeight(fontsize) / 1000f;
float halfLineWidth = (descender / -8f) / 2f;
float endx = (startx + inline.getIPD()) / 1000f;
if (inline.hasUnderline()) {
diff --git a/src/java/org/apache/fop/render/pdf/FopPDFImage.java b/src/java/org/apache/fop/render/pdf/FopPDFImage.java
index 97fee08f9..e709b26ad 100644
--- a/src/java/org/apache/fop/render/pdf/FopPDFImage.java
+++ b/src/java/org/apache/fop/render/pdf/FopPDFImage.java
@@ -29,7 +29,6 @@ import org.apache.fop.pdf.PDFXObject;
import org.apache.fop.pdf.BitmapImage;
import org.apache.fop.image.FopImage;
-import org.apache.fop.image.JpegImage;
import org.apache.fop.image.EPSImage;
import org.apache.fop.image.TIFFImage;
@@ -82,9 +81,8 @@ public class FopPDFImage implements PDFImage {
pdfFilter.setApplied(true);
isDCT = true;
- JpegImage jpegimage = (JpegImage) fopImage;
- ICC_Profile prof = jpegimage.getICCProfile();
- PDFColorSpace pdfCS = toPDFColorSpace(jpegimage.getColorSpace());
+ ICC_Profile prof = fopImage.getICCProfile();
+ PDFColorSpace pdfCS = toPDFColorSpace(fopImage.getColorSpace());
if (prof != null) {
pdfICCStream = doc.getFactory().makePDFICCStream();
pdfICCStream.setColorSpace(prof, pdfCS);