aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org
diff options
context:
space:
mode:
authorAdrian Cumiskey <acumiskey@apache.org>2008-07-22 17:25:27 +0000
committerAdrian Cumiskey <acumiskey@apache.org>2008-07-22 17:25:27 +0000
commit94e331eebc93ac99f100576f82af034c394741c2 (patch)
tree106514941e1745670a14a9a44e57fd3ecfd16abf /src/java/org
parent6b7d549d6915c9a1028928afa55c45e73123472f (diff)
downloadxmlgraphics-fop-94e331eebc93ac99f100576f82af034c394741c2.tar.gz
xmlgraphics-fop-94e331eebc93ac99f100576f82af034c394741c2.zip
* Removed unused goca accessor methods from AFPState.
* Created LineDataInfo class, this simplifies all the parameter passing on line creation. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@678812 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org')
-rw-r--r--src/java/org/apache/fop/render/AbstractState.java24
-rw-r--r--src/java/org/apache/fop/render/afp/AFPRenderer.java259
-rw-r--r--src/java/org/apache/fop/render/afp/AFPState.java31
-rw-r--r--src/java/org/apache/fop/render/afp/AFPTextPainter.java1
-rw-r--r--src/java/org/apache/fop/render/afp/TextDataInfo.java (renamed from src/java/org/apache/fop/render/afp/AFPTextDataInfo.java)38
-rw-r--r--src/java/org/apache/fop/render/afp/fonts/CharacterSet.java1
-rw-r--r--src/java/org/apache/fop/render/afp/modca/AFPDataStream.java24
-rw-r--r--src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java27
-rw-r--r--src/java/org/apache/fop/render/afp/modca/PresentationTextData.java39
-rw-r--r--src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java49
10 files changed, 236 insertions, 257 deletions
diff --git a/src/java/org/apache/fop/render/AbstractState.java b/src/java/org/apache/fop/render/AbstractState.java
index 07595be7f..ee3ebd3a7 100644
--- a/src/java/org/apache/fop/render/AbstractState.java
+++ b/src/java/org/apache/fop/render/AbstractState.java
@@ -30,16 +30,23 @@ import java.util.Stack;
* A base class which holds information about the current rendering state.
*/
public abstract class AbstractState {
+
+ /** current state data */
private AbstractData currentData = null;
+
+ /** the state stack */
private Stack/*<AbstractData>*/ stateStack = null;
/**
* Instantiates a new state data object
+ *
* @return a new state data object
*/
protected abstract AbstractData instantiateData();
/**
+ * Returns the currently valid state
+ *
* @return the currently valid state
*/
public AbstractData getData() {
@@ -66,6 +73,7 @@ public abstract class AbstractState {
/**
* Get the color.
+ *
* @return the color
*/
public Color getColor() {
@@ -77,6 +85,7 @@ public abstract class AbstractState {
/**
* Get the background color.
+ *
* @return the background color
*/
public Color getBackColor() {
@@ -103,6 +112,7 @@ public abstract class AbstractState {
/**
* Set the current font name
+ *
* @param internalFontName the internal font name
* @return true if the font name has changed
*/
@@ -116,6 +126,7 @@ public abstract class AbstractState {
/**
* Gets the current font name
+ *
* @return the current font name
*/
public String getFontName() {
@@ -124,6 +135,7 @@ public abstract class AbstractState {
/**
* Gets the current font size
+ *
* @return the current font size
*/
public int getFontSize() {
@@ -147,6 +159,7 @@ public abstract class AbstractState {
/**
* Set the current line width.
+ *
* @param width the line width in points
* @return true if the line width has changed
*/
@@ -159,7 +172,8 @@ public abstract class AbstractState {
}
/**
- * Gets the current line width
+ * Returns the current line width
+ *
* @return the current line width
*/
public float getLineWidth() {
@@ -168,6 +182,7 @@ public abstract class AbstractState {
/**
* Sets the dash array (line type) for the current basic stroke
+ *
* @param dash the line dash array
* @return true if the dash array has changed
*/
@@ -228,6 +243,7 @@ public abstract class AbstractState {
/**
* Concatenates the given AffineTransform to the current one.
+ *
* @param tf the transform to concatenate to the current level transform
*/
public void concatenate(AffineTransform tf) {
@@ -260,6 +276,7 @@ public abstract class AbstractState {
* Pop the state from the stack and set current values to popped state.
* This should be called when a Q operator is used so
* the state is restored to the correct values.
+ *
* @return the restored state, null if the stack is empty
*/
public AbstractData pop() {
@@ -280,6 +297,8 @@ public abstract class AbstractState {
}
/**
+ * Return the state stack
+ *
* @return the state stack
*/
protected Stack/*<AbstractData>*/ getStateStack() {
@@ -299,6 +318,7 @@ public abstract class AbstractState {
* A base state data holding object
*/
public abstract class AbstractData implements Cloneable, Serializable {
+
/** The current color */
private Color color = null;
@@ -325,6 +345,7 @@ public abstract class AbstractState {
* a new viewport. Note that all concatenation operations are logged
* so they can be replayed if necessary (ex. for block-containers with
* "fixed" positioning.
+ *
* @param at Transformation to perform
*/
public void concatenate(AffineTransform at) {
@@ -333,6 +354,7 @@ public abstract class AbstractState {
/**
* Get the current AffineTransform.
+ *
* @return the current transform
*/
public AffineTransform getTransform() {
diff --git a/src/java/org/apache/fop/render/afp/AFPRenderer.java b/src/java/org/apache/fop/render/afp/AFPRenderer.java
index 944303d7b..e311e2726 100644
--- a/src/java/org/apache/fop/render/afp/AFPRenderer.java
+++ b/src/java/org/apache/fop/render/afp/AFPRenderer.java
@@ -373,14 +373,14 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
float[] dstPts = new float[srcPts.length];
int[] coords = mpts2units(srcPts, dstPts);
int x2 = coords[X] + Math.round(mpt2units(width * 1000));
- int thickness = Math.round(mpt2units(height * 1000));
- getAFPDataStream().createLine(
- coords[X],
- coords[Y],
- x2,
- coords[Y],
- thickness,
- currentState.getColor());
+ LineDataInfo lineDataInfo = new LineDataInfo();
+ lineDataInfo.x1 = coords[X];
+ lineDataInfo.y1 = coords[Y];
+ lineDataInfo.x2 = x2;
+ lineDataInfo.y2 = coords[Y];
+ lineDataInfo.thickness = Math.round(mpt2units(height * 1000));
+ lineDataInfo.color = currentState.getColor();
+ getAFPDataStream().createLine(lineDataInfo);
}
/** {@inheritDoc} */
@@ -397,166 +397,168 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
return;
}
+ LineDataInfo lineDataInfo = new LineDataInfo();
+ lineDataInfo.color = col;
+
switch (style) {
+
case Constants.EN_DOUBLE:
+
+ lineDataInfo.x1 = coords[X1];
+ lineDataInfo.y1 = coords[Y1];
+
if (horz) {
float h3 = height / 3;
- float ym2 = dstPts[Y1] + h3 + h3;
- afpDataStream.createLine(
- coords[X1],
- coords[Y1],
- coords[X2],
- coords[Y1],
- Math.round(h3),
- col);
- afpDataStream.createLine(
- coords[X1],
- Math.round(ym2),
- coords[X2],
- Math.round(ym2),
- Math.round(h3),
- col);
+ lineDataInfo.thickness = Math.round(h3);
+
+ lineDataInfo.x2 = coords[X2];
+ lineDataInfo.y2 = coords[Y1];
+ afpDataStream.createLine(lineDataInfo);
+
+ int ym2 = Math.round(dstPts[Y1] + h3 + h3);
+ lineDataInfo.y1 = ym2;
+ lineDataInfo.y2 = ym2;
+ afpDataStream.createLine(lineDataInfo);
} else {
float w3 = width / 3;
- float xm2 = dstPts[X1] + w3 + w3;
- afpDataStream.createLine(
- coords[X1],
- coords[Y1],
- coords[X1],
- coords[Y2],
- Math.round(w3),
- col);
- afpDataStream.createLine(
- Math.round(xm2),
- coords[Y1],
- Math.round(xm2),
- coords[Y2],
- Math.round(w3),
- col);
+ lineDataInfo.thickness = Math.round(w3);
+
+ lineDataInfo.x2 = coords[X1];
+ lineDataInfo.y2 = coords[Y2];
+ afpDataStream.createLine(lineDataInfo);
+
+ int xm2 = Math.round(dstPts[X1] + w3 + w3);
+ lineDataInfo.x1 = xm2;
+ lineDataInfo.x2 = xm2;
+ afpDataStream.createLine(lineDataInfo);
}
break;
+
case Constants.EN_DASHED:
+ lineDataInfo.x1 = coords[X1];
+
if (horz) {
float w2 = 2 * height;
- while (coords[X1] + w2 < coords[X2]) {
- afpDataStream.createLine(
- coords[X1],
- coords[Y1],
- coords[X1] + Math.round(w2),
- coords[Y1],
- Math.round(height),
- col);
- coords[X1] += 2 * w2;
+
+ lineDataInfo.y1 = coords[Y1];
+ lineDataInfo.x2 = coords[X1] + Math.round(w2);
+ lineDataInfo.y2 = coords[Y1];
+ lineDataInfo.thickness = Math.round(height);
+
+ while (lineDataInfo.x1 + w2 < coords[X2]) {
+ afpDataStream.createLine(lineDataInfo);
+ lineDataInfo.x1 += 2 * w2;
}
} else {
float h2 = 2 * width;
- while (coords[Y1] + h2 < coords[Y2]) {
- afpDataStream.createLine(
- coords[X1],
- coords[Y2],
- coords[X1],
- coords[Y1] + Math.round(h2),
- Math.round(width),
- col);
- coords[Y1] += 2 * h2;
+
+ lineDataInfo.y1 = coords[Y2];
+ lineDataInfo.x2 = coords[X1];
+ lineDataInfo.y2 = coords[Y1] + Math.round(h2);
+ lineDataInfo.thickness = Math.round(width);
+
+ while (lineDataInfo.y2 < coords[Y2]) {
+ afpDataStream.createLine(lineDataInfo);
+ lineDataInfo.y2 += 2 * h2;
}
}
break;
+
case Constants.EN_DOTTED:
+
+ lineDataInfo.x1 = coords[X1];
+ lineDataInfo.y1 = coords[Y1];
+
if (horz) {
- while (coords[X1] + height < coords[X2]) {
- afpDataStream.createLine(
- coords[X1],
- coords[Y1],
- coords[X1] + Math.round(height),
- coords[Y1],
- Math.round(height),
- col
- );
+ lineDataInfo.thickness = Math.round(height);
+ lineDataInfo.x2 = coords[X1] + lineDataInfo.thickness;
+ lineDataInfo.y2 = coords[Y1];
+ while (lineDataInfo.x2 < coords[X2]) {
+ afpDataStream.createLine(lineDataInfo);
coords[X1] += 2 * height;
+ lineDataInfo.x1 = coords[X1];
+ lineDataInfo.x2 = coords[X1] + lineDataInfo.thickness;
}
} else {
- while (coords[Y1] + width < coords[Y2]) {
- afpDataStream.createLine(
- coords[X1],
- coords[Y1],
- coords[X1],
- coords[Y1] + Math.round(width),
- Math.round(width),
- col);
+ lineDataInfo.thickness = Math.round(width);
+ lineDataInfo.x2 = coords[X1];
+ lineDataInfo.y2 = coords[Y1] + lineDataInfo.thickness;
+
+ while (lineDataInfo.y2 < coords[Y2]) {
+ afpDataStream.createLine(lineDataInfo);
coords[Y1] += 2 * width;
+ lineDataInfo.y1 = coords[Y1];
+ lineDataInfo.y2 = coords[Y1] + lineDataInfo.thickness;
}
}
break;
case Constants.EN_GROOVE:
case Constants.EN_RIDGE: {
+
float colFactor = (style == EN_GROOVE ? 0.4f : -0.4f);
if (horz) {
- Color uppercol = lightenColor(col, -colFactor);
- Color lowercol = lightenColor(col, colFactor);
+
+ lineDataInfo.x1 = coords[X1];
+ lineDataInfo.x2 = coords[X2];
+
float h3 = height / 3;
- afpDataStream.createLine(
- coords[X1],
- coords[Y1],
- coords[X2],
- coords[Y1],
- Math.round(h3),
- uppercol);
- afpDataStream.createLine(
- coords[X1],
- Math.round(dstPts[Y1] + h3),
- coords[X2],
- Math.round(dstPts[Y1] + h3),
- Math.round(h3),
- col);
- afpDataStream.createLine(
- coords[X1],
- Math.round(dstPts[Y1] + h3 + h3),
- coords[X2],
- Math.round(dstPts[Y1] + h3 + h3),
- Math.round(h3),
- lowercol);
+
+ lineDataInfo.color = lightenColor(col, -colFactor);
+ lineDataInfo.thickness = Math.round(h3);
+ lineDataInfo.y1 = lineDataInfo.y2 = coords[Y1];
+ afpDataStream.createLine(lineDataInfo);
+
+ lineDataInfo.color = col;
+ lineDataInfo.y1 = lineDataInfo.y2 = Math.round(dstPts[Y1] + h3);
+ afpDataStream.createLine(lineDataInfo);
+
+ lineDataInfo.color = lightenColor(col, colFactor);
+ lineDataInfo.y1 = lineDataInfo.y2 = Math.round(dstPts[Y1] + h3 + h3);
+ afpDataStream.createLine(lineDataInfo);
+
} else {
- Color leftcol = lightenColor(col, -colFactor);
- Color rightcol = lightenColor(col, colFactor);
+
+ lineDataInfo.y1 = coords[Y1];
+ lineDataInfo.y2 = coords[Y2];
+
float w3 = width / 3;
float xm1 = dstPts[X1] + (w3 / 2);
- afpDataStream.createLine(
- Math.round(xm1),
- coords[Y1],
- Math.round(xm1),
- coords[Y2],
- Math.round(w3),
- leftcol);
- afpDataStream.createLine(
- Math.round(xm1 + w3),
- coords[Y1],
- Math.round(xm1 + w3),
- coords[Y2],
- Math.round(w3),
- col);
- afpDataStream.createLine(
- Math.round(xm1 + w3 + w3),
- coords[Y1],
- Math.round(xm1 + w3 + w3),
- coords[Y2],
- Math.round(w3),
- rightcol);
+
+ lineDataInfo.color = lightenColor(col, -colFactor);
+ lineDataInfo.x1 = lineDataInfo.x2 = Math.round(xm1);
+ afpDataStream.createLine(lineDataInfo);
+
+ lineDataInfo.color = col;
+ lineDataInfo.x1 = lineDataInfo.x2 = Math.round(xm1 + w3);
+ afpDataStream.createLine(lineDataInfo);
+
+ lineDataInfo.color = lightenColor(col, colFactor);
+ lineDataInfo.x1 = lineDataInfo.x2 = Math.round(xm1 + w3 + w3);
+ afpDataStream.createLine(lineDataInfo);
}
break;
}
+
case Constants.EN_HIDDEN:
break;
+
case Constants.EN_INSET:
case Constants.EN_OUTSET:
default:
- afpDataStream.createLine(
- coords[X1],
- coords[Y1],
- (horz ? coords[X2] : coords[X1]),
- (horz ? coords[Y1] : coords[Y2]),
- Math.abs(Math.round(horz ? height : width)),
- col);
+ lineDataInfo.x1 = coords[X1];
+ lineDataInfo.y1 = coords[Y1];
+ if (horz) {
+ lineDataInfo.thickness = Math.round(height);
+ lineDataInfo.x2 = coords[X2];
+ lineDataInfo.y2 = coords[Y1];
+ } else {
+ lineDataInfo.thickness = Math.round(width);
+ lineDataInfo.x2 = coords[X1];
+ lineDataInfo.y2 = coords[Y2];
+ }
+ lineDataInfo.x2 = (horz ? coords[X2] : coords[X1]);
+ lineDataInfo.y2 = (horz ? coords[Y1] : coords[Y2]);
+ afpDataStream.createLine(lineDataInfo);
}
}
@@ -846,7 +848,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
/** {@inheritDoc} */
public void renderText(TextArea text) {
- log.debug(text.getText());
+// log.debug(text.getText());
renderInlineAreaBackAndBorders(text);
String name = getInternalFontNameForArea(text);
@@ -909,7 +911,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
int interCharacterAdjustment = Math.round(mpt2units(text.getTextLetterSpaceAdjust()));
- AFPTextDataInfo textDataInfo = new AFPTextDataInfo();
+ TextDataInfo textDataInfo = new TextDataInfo();
textDataInfo.setFontReference(fontReference);
textDataInfo.setX(coords[X]);
textDataInfo.setY(coords[Y]);
@@ -917,6 +919,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
textDataInfo.setVariableSpaceCharacterIncrement(variableSpaceCharacterIncrement);
textDataInfo.setInterCharacterAdjustment(interCharacterAdjustment);
textDataInfo.setData(data);
+ textDataInfo.setOrientation(currentState.getOrientation());
getAFPDataStream().createText(textDataInfo);
// word.getOffset() = only height of text itself
// currentBlockIPPosition: 0 for beginning of line; nonzero
diff --git a/src/java/org/apache/fop/render/afp/AFPState.java b/src/java/org/apache/fop/render/afp/AFPState.java
index ddcccdf00..5cf396362 100644
--- a/src/java/org/apache/fop/render/afp/AFPState.java
+++ b/src/java/org/apache/fop/render/afp/AFPState.java
@@ -47,9 +47,6 @@ public class AFPState extends org.apache.fop.render.AbstractState {
/** The current page */
private AFPPageState pageState = new AFPPageState();
- /** Whether or not GOCA is used for handling SVG */
- private boolean goca = false; // false by default
-
/**
* Sets the rotation to be used for portrait pages, valid values are 0
* (default), 90, 180, 270.
@@ -190,24 +187,6 @@ public class AFPState extends org.apache.fop.render.AbstractState {
}
/**
- * Sets if GOCA is to be used for SVG handling
- *
- * @param value is true if GOCA is used for SVG handling
- */
- public void setUseGOCA(boolean value) {
- this.goca = value;
- }
-
- /**
- * Returns true if GOCA is enabled for SVG handling
- *
- * @return true if GOCA is enabled for SVG handling
- */
- public boolean useGOCA() {
- return this.goca;
- }
-
- /**
* Sets if the current painted shape is to be filled
*
* @param fill true if the current painted shape is to be filled
@@ -420,4 +399,14 @@ public class AFPState extends org.apache.fop.render.AbstractState {
+ "}";
}
}
+
+ /**
+ * Returns the current text orientation
+ * TODO the current text orientation
+ * @return the current text orientation
+ */
+ public int getOrientation() {
+ return 0;
+ }
+
} \ No newline at end of file
diff --git a/src/java/org/apache/fop/render/afp/AFPTextPainter.java b/src/java/org/apache/fop/render/afp/AFPTextPainter.java
index 850db550a..3e908792d 100644
--- a/src/java/org/apache/fop/render/afp/AFPTextPainter.java
+++ b/src/java/org/apache/fop/render/afp/AFPTextPainter.java
@@ -62,7 +62,6 @@ public class AFPTextPainter implements TextPainter {
protected Log log = LogFactory.getLog(AFPTextPainter.class);
private AFPTextHandler nativeTextHandler;
- //private FontInfo fontInfo;
/**
* Use the stroking text painter to get the bounds and shape.
diff --git a/src/java/org/apache/fop/render/afp/AFPTextDataInfo.java b/src/java/org/apache/fop/render/afp/TextDataInfo.java
index b1ac0bcb2..a10b10671 100644
--- a/src/java/org/apache/fop/render/afp/AFPTextDataInfo.java
+++ b/src/java/org/apache/fop/render/afp/TextDataInfo.java
@@ -22,19 +22,29 @@ package org.apache.fop.render.afp;
import java.awt.Color;
/**
- * Contains text data information
+ * Text data information
*/
-public class AFPTextDataInfo {
+public class TextDataInfo {
+
private int fontReference;
+
private int x;
+
private int y;
+
private Color color;
+
private int variableSpaceCharacterIncrement;
+
private int interCharacterAdjustment;
+
private byte[] data;
+
private int orientation;
/**
+ * Returns the font reference
+ *
* @return the font reference
*/
public int getFontReference() {
@@ -43,6 +53,7 @@ public class AFPTextDataInfo {
/**
* Sets the font reference
+ *
* @param fontReference the font reference
*/
protected void setFontReference(int fontReference) {
@@ -50,6 +61,8 @@ public class AFPTextDataInfo {
}
/**
+ * Returns the x coordinate
+ *
* @return the x coordinate
*/
public int getX() {
@@ -58,6 +71,7 @@ public class AFPTextDataInfo {
/**
* Sets the X coordinate
+ *
* @param x the X coordinate
*/
protected void setX(int x) {
@@ -65,6 +79,8 @@ public class AFPTextDataInfo {
}
/**
+ * Returns the y coordinate
+ *
* @return the y coordinate
*/
public int getY() {
@@ -73,6 +89,7 @@ public class AFPTextDataInfo {
/**
* Sets the Y coordinate
+ *
* @param y the Y coordinate
*/
protected void setY(int y) {
@@ -80,6 +97,8 @@ public class AFPTextDataInfo {
}
/**
+ * Returns the color
+ *
* @return the color
*/
public Color getColor() {
@@ -88,6 +107,7 @@ public class AFPTextDataInfo {
/**
* Sets the color
+ *
* @param color the color
*/
protected void setColor(Color color) {
@@ -95,6 +115,8 @@ public class AFPTextDataInfo {
}
/**
+ * Return the variable space character increment
+ *
* @return the variable space character increment
*/
public int getVariableSpaceCharacterIncrement() {
@@ -103,6 +125,7 @@ public class AFPTextDataInfo {
/**
* Sets the variable space character increment
+ *
* @param variableSpaceCharacterIncrement the variable space character increment
*/
protected void setVariableSpaceCharacterIncrement(
@@ -111,6 +134,8 @@ public class AFPTextDataInfo {
}
/**
+ * Return the inter character adjustment
+ *
* @return the inter character adjustment
*/
public int getInterCharacterAdjustment() {
@@ -119,6 +144,7 @@ public class AFPTextDataInfo {
/**
* Sets the inter character adjustment
+ *
* @param interCharacterAdjustment the inter character adjustment
*/
protected void setInterCharacterAdjustment(int interCharacterAdjustment) {
@@ -126,6 +152,8 @@ public class AFPTextDataInfo {
}
/**
+ * Return the text data
+ *
* @return the text data
*/
public byte[] getData() {
@@ -134,6 +162,7 @@ public class AFPTextDataInfo {
/**
* Sets the text data
+ *
* @param data the text orientation
*/
protected void setData(byte[] data) {
@@ -142,6 +171,7 @@ public class AFPTextDataInfo {
/**
* Sets the text orientation
+ *
* @param orientation the text orientation
*/
public void setOrientation(int orientation) {
@@ -149,6 +179,8 @@ public class AFPTextDataInfo {
}
/**
+ * Returns the text orientation
+ *
* @return the text orientation
*/
public int getOrientation() {
@@ -157,7 +189,7 @@ public class AFPTextDataInfo {
/** {@inheritDoc} */
public String toString() {
- return "AFPTextDataInfo{fontReference=" + fontReference
+ return "TextDataInfo{fontReference=" + fontReference
+ ", x=" + x
+ ", y=" + y
+ ", color=" + color
diff --git a/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java b/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java
index d36c78d7d..82300197b 100644
--- a/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java
+++ b/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java
@@ -281,7 +281,6 @@ public class CharacterSet {
* in 99.9% of cases the font metrics will be the same as the 0 degrees
* therefore the implementation currently will always use 0 degrees.
*
- *
* @return characterSetOrentation The current orientation metrics.
*/
private CharacterSetOrientation getCharacterSetOrientation() {
diff --git a/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java b/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java
index e9966af57..3105f88b1 100644
--- a/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java
+++ b/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java
@@ -29,7 +29,8 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.fop.render.afp.AFPFontAttributes;
-import org.apache.fop.render.afp.AFPTextDataInfo;
+import org.apache.fop.render.afp.LineDataInfo;
+import org.apache.fop.render.afp.TextDataInfo;
import org.apache.fop.render.afp.DataObjectInfo;
import org.apache.fop.render.afp.ExternalResourceGroupManager;
import org.apache.fop.render.afp.ObjectAreaInfo;
@@ -390,7 +391,7 @@ public class AFPDataStream extends AbstractResourceGroupContainer {
* @param textDataInfo
* the afp text data
*/
- public void createText(AFPTextDataInfo textDataInfo) {
+ public void createText(TextDataInfo textDataInfo) {
textDataInfo.setOrientation(orientation);
getCurrentPage().createText(textDataInfo);
}
@@ -537,22 +538,11 @@ public class AFPDataStream extends AbstractResourceGroupContainer {
/**
* Method to create a line on the current page.
*
- * @param x1
- * the first x coordinate of the line
- * @param y1
- * the first y coordinate of the line
- * @param x2
- * the second x coordinate of the line
- * @param y2
- * the second y coordinate of the line
- * @param thickness
- * the thickness of the line
- * @param col
- * The text color.
+ * @param lineDataInfo the line data information.
*/
- public void createLine(int x1, int y1, int x2, int y2, int thickness,
- Color col) {
- getCurrentPage().createLine(x1, y1, x2, y2, thickness, orientation, col);
+ public void createLine(LineDataInfo lineDataInfo) {
+ lineDataInfo.setOrientation(orientation);
+ getCurrentPage().createLine(lineDataInfo);
}
/**
diff --git a/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java b/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java
index 8e6314adb..540e74c33 100644
--- a/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java
+++ b/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java
@@ -25,7 +25,8 @@ import java.io.OutputStream;
import java.util.Iterator;
import java.util.List;
-import org.apache.fop.render.afp.AFPTextDataInfo;
+import org.apache.fop.render.afp.LineDataInfo;
+import org.apache.fop.render.afp.TextDataInfo;
import org.apache.fop.render.afp.DataObjectCache;
import org.apache.fop.render.afp.ResourceInfo;
import org.apache.fop.render.afp.fonts.AFPFont;
@@ -169,25 +170,11 @@ public abstract class AbstractPageObject extends AbstractNamedAFPObject {
/**
* Helper method to create a line on the current page, this method delegates
* to the presentation text object in order to construct the line.
- *
- * @param x1
- * the first x coordinate of the line
- * @param y1
- * the first y coordinate of the line
- * @param x2
- * the second x coordinate of the line
- * @param y2
- * the second y coordinate of the line
- * @param thickness
- * the thickness of the line
- * @param lineRotation
- * the rotation of the line
- * @param col
- * The text color.
+ *
+ * @param lineDataInfo the line data information.
*/
- public void createLine(int x1, int y1, int x2, int y2, int thickness,
- int lineRotation, Color col) {
- getPresentationTextObject().createLineData(x1, y1, x2, y2, thickness, lineRotation, col);
+ public void createLine(LineDataInfo lineDataInfo) {
+ getPresentationTextObject().createLineData(lineDataInfo);
}
/**
@@ -197,7 +184,7 @@ public abstract class AbstractPageObject extends AbstractNamedAFPObject {
* @param textDataInfo
* the afp text data
*/
- public void createText(AFPTextDataInfo textDataInfo) {
+ public void createText(TextDataInfo textDataInfo) {
getPresentationTextObject().createTextData(textDataInfo);
}
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 44e1e008a..1d3643a61 100644
--- a/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java
+++ b/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java
@@ -24,7 +24,8 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
-import org.apache.fop.render.afp.AFPTextDataInfo;
+import org.apache.fop.render.afp.LineDataInfo;
+import org.apache.fop.render.afp.TextDataInfo;
import org.apache.fop.render.afp.tools.BinaryUtils;
/**
@@ -271,7 +272,7 @@ public class PresentationTextData extends AbstractAFPObject {
* @throws MaximumSizeExceededException
* thrown if the maximum number of text data is exceeded
*/
- public void createTextData(AFPTextDataInfo textDataInfo)
+ public void createTextData(TextDataInfo textDataInfo)
throws MaximumSizeExceededException {
ByteArrayOutputStream afpdata = new ByteArrayOutputStream();
@@ -357,28 +358,22 @@ public class PresentationTextData extends AbstractAFPObject {
* Drawing of lines using the starting and ending coordinates, thickness and
* colour arguments.
*
- * @param x1
- * The starting X coordinate.
- * @param y1
- * The starting Y coordinate.
- * @param x2
- * The ending X coordinate.
- * @param y2
- * The ending Y coordinate.
- * @param thickness
- * The line thickness.
- * @param orientation
- * The orientation of the text data.
- * @param col
- * The text color.
+ * @param lineDataInfo the line data information.
* @throws MaximumSizeExceededException
* thrown if the maximum number of line data has been exceeded
*/
- public void createLineData(int x1, int y1, int x2, int y2, int thickness,
- int orientation, Color col) throws MaximumSizeExceededException {
+ public void createLineData(LineDataInfo lineDataInfo) throws MaximumSizeExceededException {
ByteArrayOutputStream afpdata = new ByteArrayOutputStream();
+ int thickness = lineDataInfo.getThickness();
+ int orientation = lineDataInfo.getOrientation();
+ int x1 = lineDataInfo.getX1();
+ int y1 = lineDataInfo.getY1();
+ int x2 = lineDataInfo.getX2();
+ int y2 = lineDataInfo.getY2();
+ Color col = lineDataInfo.getColor();
+
if (currentOrientation != orientation) {
setTextOrientation(orientation, afpdata);
currentOrientation = orientation;
@@ -407,9 +402,9 @@ public class PresentationTextData extends AbstractAFPObject {
return;
}
- int s = afpdata.size();
+ int dataSize = afpdata.size();
- if (baos.size() + s > MAX_SIZE) {
+ if (baos.size() + dataSize > MAX_SIZE) {
currentXCoordinate = -1;
currentYCoordinate = -1;
throw new MaximumSizeExceededException();
@@ -533,9 +528,7 @@ public class PresentationTextData extends AbstractAFPObject {
}, 0, 5);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void write(OutputStream os) throws IOException {
byte[] data = baos.toByteArray();
byte[] size = BinaryUtils.convert(data.length - 1, 2);
diff --git a/src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java b/src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java
index 88e29851f..5828b7171 100644
--- a/src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java
+++ b/src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java
@@ -24,7 +24,8 @@ import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
-import org.apache.fop.render.afp.AFPTextDataInfo;
+import org.apache.fop.render.afp.LineDataInfo;
+import org.apache.fop.render.afp.TextDataInfo;
/**
* The Presentation Text object is the data object used in document processing
@@ -81,7 +82,7 @@ public class PresentationTextObject extends AbstractNamedAFPObject {
* @param textDataInfo
* The afp text data
*/
- public void createTextData(AFPTextDataInfo textDataInfo) {
+ public void createTextData(TextDataInfo textDataInfo) {
if (currentPresentationTextData == null) {
startPresentationTextData();
}
@@ -94,56 +95,20 @@ public class PresentationTextObject extends AbstractNamedAFPObject {
}
/**
- * Drawing of lines using the starting and ending coordinates, thickness.
- *
- * @param x1
- * The first x coordinate of the line.
- * @param y1
- * The first y coordinate of the line.
- * @param x2
- * The second x coordinate of the line.
- * @param y2
- * The second y coordinate of the line.
- * @param thickness
- * The thickness of the line.
- * @param col
- * The text color.
- */
- public void createLineData(int x1, int y1, int x2, int y2, int thickness, Color col) {
- // Default orientation
- createLineData(x1, y1, x2, y2, thickness, 0, col);
- }
-
- /**
* Drawing of lines using the starting and ending coordinates, thickness and
* orientation arguments.
*
- * @param x1
- * The first x coordinate of the line.
- * @param y1
- * The first y coordinate of the line.
- * @param x2
- * The second x coordinate of the line.
- * @param y2
- * The second y coordinate of the line.
- * @param thickness
- * The thickness of the line.
- * @param orientation
- * The orientation of the line.
- * @param col
- * The text color.
+ * @param lineDataInfo the line data information.
*/
- public void createLineData(int x1, int y1, int x2, int y2, int thickness,
- int orientation, Color col) {
+ public void createLineData(LineDataInfo lineDataInfo) {
if (currentPresentationTextData == null) {
startPresentationTextData();
}
try {
- currentPresentationTextData.createLineData(x1, y1, x2, y2,
- thickness, orientation, col);
+ currentPresentationTextData.createLineData(lineDataInfo);
} catch (MaximumSizeExceededException msee) {
endPresentationTextData();
- createLineData(x1, y1, x2, y2, thickness, orientation, col);
+ createLineData(lineDataInfo);
}
}