aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdrian Cumiskey <acumiskey@apache.org>2008-10-22 11:28:48 +0000
committerAdrian Cumiskey <acumiskey@apache.org>2008-10-22 11:28:48 +0000
commit9183272fcdb6169b23a7cbeb8092f9c0319f5154 (patch)
treead1ab78119d7b4b86129921ab6204f5c0ca5c6bc /src
parenta466ab3fb601e4736a289be01b70b9dfea3b3542 (diff)
downloadxmlgraphics-fop-9183272fcdb6169b23a7cbeb8092f9c0319f5154.tar.gz
xmlgraphics-fop-9183272fcdb6169b23a7cbeb8092f9c0319f5154.zip
Ensures > 0 coordinate values.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@707036 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/render/afp/modca/PresentationTextData.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java b/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java
index 05ea1ebf2..dc0512b6d 100644
--- a/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java
+++ b/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java
@@ -357,6 +357,13 @@ public class PresentationTextData extends AbstractAFPObject {
baos.write(outputdata, 0, outputdata.length);
}
+ private int ensurePositive(int value) {
+ if (value < 0) {
+ return 0;
+ }
+ return value;
+ }
+
/**
* Drawing of lines using the starting and ending coordinates, thickness and
* colour arguments.
@@ -376,25 +383,25 @@ public class PresentationTextData extends AbstractAFPObject {
}
// Avoid unnecessary specification of the Y coordinate
- int y1 = lineDataInfo.getY1();
+ int y1 = ensurePositive(lineDataInfo.getY1());
if (y1 != currentY) {
absoluteMoveBaseline(y1, afpdata);
}
// Avoid unnecessary specification of the X coordinate
- int x1 = lineDataInfo.getX1();
+ int x1 = ensurePositive(lineDataInfo.getX1());
if (x1 != currentX) {
absoluteMoveInline(x1, afpdata);
}
- Color col = lineDataInfo.getColor();
- if (!col.equals(currentColor)) {
- setExtendedTextColor(col, afpdata);
- currentColor = col;
+ Color color = lineDataInfo.getColor();
+ if (!color.equals(currentColor)) {
+ setExtendedTextColor(color, afpdata);
+ currentColor = color;
}
- int x2 = lineDataInfo.getX2();
- int y2 = lineDataInfo.getY2();
+ int x2 = ensurePositive(lineDataInfo.getX2());
+ int y2 = ensurePositive(lineDataInfo.getY2());
int thickness = lineDataInfo.getThickness();
if (y1 == y2) {
drawIaxisRule(x2 - x1, thickness, afpdata);