xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acumis...@apache.org
Subject svn commit: r675507 [3/3] - in /xmlgraphics/fop/branches/Temp_AFPGOCAResources: ./ src/java/org/apache/fop/pdf/ src/java/org/apache/fop/render/ src/java/org/apache/fop/render/afp/ src/java/org/apache/fop/render/afp/modca/ src/java/org/apache/fop/render...
Date Thu, 10 Jul 2008 10:59:41 GMT
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java?rev=675507&r1=675506&r2=675507&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java
(original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java
Thu Jul 10 03:59:39 2008
@@ -30,6 +30,7 @@
 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.DataObjectInfo;
 import org.apache.fop.render.afp.ObjectAreaInfo;
 import org.apache.fop.render.afp.ResourceInfo;
@@ -122,19 +123,9 @@
     private int landscapeRotation = 270;
 
     /**
-     * The x offset
-     */
-    private int xOffset = 0;
-
-    /**
-     * The y offset
-     */
-    private int yOffset = 0;
-
-    /**
      * The rotation
      */
-    private int rotation;
+    private int orientation;
 
     /**
      * The outputstream for the data stream
@@ -276,7 +267,7 @@
                 pageRotation, pageWidthRes, pageHeightRes);
         currentPage = currentPageObject;
         currentOverlay = null;
-        setOffsets(0, 0, 0);
+//        setOffsets(0, 0, 0);
     }
 
     /**
@@ -315,7 +306,7 @@
 
         currentPageObject.createIncludePageOverlay(overlayName, x, y, 0);
         currentPage = currentOverlay;
-        setOffsets(0, 0, 0);
+//        setOffsets(0, 0, 0);
     }
 
     /**
@@ -380,16 +371,25 @@
      *            the offset in the x direction
      * @param yOff
      *            the offset in the y direction
-     * @param rot
+     * @param orientation
      *            the rotation
+     * @deprecated offsets are no longer used, use setOrientation() for setting the orientation
      */
-    public void setOffsets(int xOff, int yOff, int rot) {
-        this.xOffset = xOff;
-        this.yOffset = yOff;
-        this.rotation = rot;
+    public void setOffsets(int xOff, int yOff, int orientation) {
+        setOrientation(orientation);
     }
 
     /**
+     * Sets the orientation to be used for element positioning
+     * 
+     * @param orientation
+     *            the orientation used for element positioning
+     */
+    public void setOrientation(int orientation) {
+        this.orientation = orientation;
+    }
+    
+    /**
      * Creates the given page fonts in the current page
      *
      * @param pageFonts
@@ -425,25 +425,12 @@
      * Helper method to create text on the current page, this method delegates
      * to the current presentation text object in order to construct the text.
      *
-     * @param fontReference
-     *            the font reference used as the resource identifier
-     * @param x
-     *            the x coordinate of the text
-     * @param y
-     *            the y coordinate of the text
-     * @param col
-     *            the text color
-     * @param vsci
-     *            The variable space character increment.
-     * @param ica
-     *            The inter character adjustment.
-     * @param data
-     *            the text data to create
-     */
-    public void createText(int fontReference, int x, int y, Color col,
-            int vsci, int ica, byte[] data) {
-        getCurrentPage().createText(fontReference, x + xOffset, y + yOffset,
-                rotation, col, vsci, ica, data);
+     * @param textDataInfo
+     *            the afp text data
+     */
+    public void createText(AFPTextDataInfo textDataInfo) {
+        textDataInfo.setOrientation(orientation);
+        getCurrentPage().createText(textDataInfo);
     }
 
     /**
@@ -469,8 +456,8 @@
 
         //Update placement with current state
         ObjectAreaInfo areaInfo = dataObjectInfo.getObjectAreaInfo();
-        areaInfo.setX(areaInfo.getX() + this.xOffset);
-        areaInfo.setY(areaInfo.getY() + this.yOffset);
+        areaInfo.setX(areaInfo.getX());
+        areaInfo.setY(areaInfo.getY());
         areaInfo.setRotation(this.rotation);
 
         Registry registry = Registry.getInstance();
@@ -593,8 +580,7 @@
      */
     public void createLine(int x1, int y1, int x2, int y2, int thickness,
             Color col) {
-        getCurrentPage().createLine(x1 + xOffset, y1 + yOffset, x2 + xOffset,
-                y2 + yOffset, thickness, rotation, col);
+        getCurrentPage().createLine(x1, y1, x2, y2, thickness, orientation, col);
     }
 
     /**
@@ -614,8 +600,7 @@
      *            the shading color
      */
     public void createShading(int x, int y, int w, int h, Color col) {
-        currentPageObject.createShading(x + xOffset, y + xOffset, w, h,
-                col.getRed(), col.getGreen(), col.getBlue());
+        currentPageObject.createShading(x, y, w, h, col.getRed(), col.getGreen(), col.getBlue());
     }
 
     /**
@@ -626,7 +611,7 @@
      *            the name of the static overlay
      */
     public void createIncludePageOverlay(String name) {
-        currentPageObject.createIncludePageOverlay(name, 0, 0, rotation);
+        currentPageObject.createIncludePageOverlay(name, 0, 0, orientation);
         currentPageObject.getActiveEnvironmentGroup().createOverlay(name);
     }
 
@@ -653,22 +638,22 @@
     public void createIncludePageSegment(String name, int x, int y) {
         int xOrigin;
         int yOrigin;
-        switch (rotation) {
+        switch (orientation) {
         case 90:
-            xOrigin = getCurrentPage().getWidth() - y - yOffset;
-            yOrigin = x + xOffset;
+            xOrigin = getCurrentPage().getWidth() - y;
+            yOrigin = x;
             break;
         case 180:
-            xOrigin = getCurrentPage().getWidth() - x - xOffset;
-            yOrigin = getCurrentPage().getHeight() - y - yOffset;
+            xOrigin = getCurrentPage().getWidth() - x;
+            yOrigin = getCurrentPage().getHeight() - y;
             break;
         case 270:
-            xOrigin = y + yOffset;
-            yOrigin = getCurrentPage().getHeight() - x - xOffset;
+            xOrigin = y;
+            yOrigin = getCurrentPage().getHeight() - x;
             break;
         default:
-            xOrigin = x + xOffset;
-            yOrigin = y + yOffset;
+            xOrigin = x;
+            yOrigin = y;
             break;
         }
         getCurrentPage().createIncludePageSegment(name, xOrigin, yOrigin);

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java?rev=675507&r1=675506&r2=675507&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java
(original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java
Thu Jul 10 03:59:39 2008
@@ -24,6 +24,7 @@
 import java.io.OutputStream;
 import java.util.List;
 
+import org.apache.fop.render.afp.AFPTextDataInfo;
 import org.apache.fop.render.afp.fonts.AFPFont;
 
 /**
@@ -189,27 +190,11 @@
      * Helper method to create text on the current page, this method delegates
      * to the presentation text object in order to construct the text.
      *
-     * @param fontRef
-     *            the font number used as the resource identifier
-     * @param x
-     *            the x coordinate of the text data
-     * @param y
-     *            the y coordinate of the text data
-     * @param textRotation
-     *            the rotation of the text data
-     * @param col
-     *            the text color
-     * @param vsci
-     *            The variable space character increment.
-     * @param ica
-     *            The inter character adjustment.
-     * @param data
-     *            the text data to create
-     */
-    public void createText(int fontRef, int x, int y, int textRotation, Color col,
-            int vsci, int ica, byte[] data) {
-        getPresentationTextObject().createTextData(
-                fontRef, x, y, textRotation, col, vsci, ica, data);
+     * @param textDataInfo
+     *            the afp text data
+     */
+    public void createText(AFPTextDataInfo textDataInfo) {
+        getPresentationTextObject().createTextData(textDataInfo);
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java?rev=675507&r1=675506&r2=675507&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java
(original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java
Thu Jul 10 03:59:39 2008
@@ -24,6 +24,7 @@
 import java.io.IOException;
 import java.io.OutputStream;
 
+import org.apache.fop.render.afp.AFPTextDataInfo;
 import org.apache.fop.render.afp.tools.BinaryUtils;
 
 /**
@@ -33,18 +34,18 @@
  * that position them - modal control sequences that adjust the positions by
  * small amounts - other functions causing text to be presented with differences
  * in appearance.
- *
+ * 
  * The graphic characters are expected to conform to a coded font representation
  * so that they can be translated from the code point in the object data to the
  * character in the coded font. The units of measure for linear displacements
  * are derived from the PresentationTextDescriptor or from the hierarchical
  * defaults.
- *
+ * 
  * In addition to graphic character code points, Presentation Text data can
  * contain embedded control sequences. These are strings of two or more bytes
  * which signal an alternate mode of processing for the content of the current
  * Presentation Text data.
- *
+ * 
  */
 public class PresentationTextData extends AbstractAFPObject {
 
@@ -104,21 +105,20 @@
      * Constructor for the PresentationTextData, the boolean flag indicate
      * whether the control sequence prefix should be set to indicate the start
      * of a new control sequence.
-     *
+     * 
      * @param controlInd
      *            The control sequence indicator.
      */
     public PresentationTextData(boolean controlInd) {
-        final byte[] data = {
-            0x5A, // Structured field identifier
-            0x00, // Record length byte 1
-            0x00, // Record length byte 2
-            (byte) 0xD3, // PresentationTextData identifier byte 1
-            (byte) 0xEE, // PresentationTextData identifier byte 2
-            (byte) 0x9B, // PresentationTextData identifier byte 3
-            0x00, // Flag
-            0x00, // Reserved
-            0x00, // Reserved
+        final byte[] data = { 0x5A, // Structured field identifier
+                0x00, // Record length byte 1
+                0x00, // Record length byte 2
+                (byte) 0xD3, // PresentationTextData identifier byte 1
+                (byte) 0xEE, // PresentationTextData identifier byte 2
+                (byte) 0x9B, // PresentationTextData identifier byte 3
+                0x00, // Flag
+                0x00, // Reserved
+                0x00, // Reserved
         };
         baos.write(data, 0, 9);
 
@@ -131,7 +131,7 @@
      * The Set Coded Font Local control sequence activates a coded font and
      * specifies the character attributes to be used. This is a modal control
      * sequence.
-     *
+     * 
      * @param font
      *            The font local identifier.
      * @param afpdata
@@ -152,13 +152,14 @@
      * Establishes the current presentation position on the baseline at a new
      * I-axis coordinate, which is a specified number of measurement units from
      * the B-axis. There is no change to the current B-axis coordinate.
-     *
+     * 
      * @param coordinate
      *            The coordinate for the inline move.
      * @param afpdata
      *            The output stream to which data should be written.
      */
-    private void absoluteMoveInline(int coordinate, ByteArrayOutputStream afpdata) {
+    private void absoluteMoveInline(int coordinate,
+            ByteArrayOutputStream afpdata) {
         byte[] b = BinaryUtils.convert(coordinate, 2);
         afpdata.write(new byte[] { 0x04, (byte) 0xC7, b[0], b[1], }, 0, 4);
         currentXCoordinate = coordinate;
@@ -168,13 +169,14 @@
      * Establishes the baseline and the current presentation position at a new
      * B-axis coordinate, which is a specified number of measurement units from
      * the I-axis. There is no change to the current I-axis coordinate.
-     *
+     * 
      * @param coordinate
      *            The coordinate for the baseline move.
      * @param afpdata
      *            The output stream to which data should be written.
      */
-    private void absoluteMoveBaseline(int coordinate, ByteArrayOutputStream afpdata) {
+    private void absoluteMoveBaseline(int coordinate,
+            ByteArrayOutputStream afpdata) {
         byte[] b = BinaryUtils.convert(coordinate, 2);
         afpdata.write(new byte[] { 0x04, (byte) 0xD3, b[0], b[1], }, 0, 4);
         currentYCoordinate = coordinate;
@@ -183,7 +185,7 @@
     /**
      * The Transparent Data control sequence contains a sequence of code points
      * that are presented without a scan for embedded control sequences.
-     *
+     * 
      * @param data
      *            The text data to add.
      * @param afpdata
@@ -195,10 +197,10 @@
         if (l > 255) {
             // Check that we are not exceeding the maximum length
             throw new IllegalArgumentException(
-                "Transparent data is longer than 253 bytes: " + data);
+                    "Transparent data is longer than 253 bytes: " + data);
         }
         afpdata.write(new byte[] { BinaryUtils.convert(l)[0], (byte) 0xDB, },
-            0, 2);
+                0, 2);
         afpdata.write(data, 0, data.length);
     }
 
@@ -206,7 +208,7 @@
      * Draws a line of specified length and specified width in the B-direction
      * from the current presentation position. The location of the current
      * presentation position is unchanged.
-     *
+     * 
      * @param length
      *            The length of the rule.
      * @param width
@@ -214,9 +216,10 @@
      * @param afpdata
      *            The output stream to which data should be written.
      */
-    private void drawBaxisRule(int length, int width, ByteArrayOutputStream afpdata) {
+    private void drawBaxisRule(int length, int width,
+            ByteArrayOutputStream afpdata) {
         afpdata.write(new byte[] { 0x07, // Length
-            (byte) 0xE7, // Type
+                (byte) 0xE7, // Type
         }, 0, 2);
         // Rule length
         byte[] data1 = BinaryUtils.shortToByteArray((short) length);
@@ -232,7 +235,7 @@
      * Draws a line of specified length and specified width in the I-direction
      * from the current presentation position. The location of the current
      * presentation position is unchanged.
-     *
+     * 
      * @param length
      *            The length of the rule.
      * @param width
@@ -240,9 +243,10 @@
      * @param afpdata
      *            The output stream to which data should be written.
      */
-    private void drawIaxisRule(int length, int width, ByteArrayOutputStream afpdata) {
+    private void drawIaxisRule(int length, int width,
+            ByteArrayOutputStream afpdata) {
         afpdata.write(new byte[] { 0x07, // Length
-            (byte) 0xE5, // Type
+                (byte) 0xE5, // Type
         }, 0, 2);
         // Rule length
         byte[] data1 = BinaryUtils.shortToByteArray((short) length);
@@ -256,73 +260,66 @@
 
     /**
      * Create the presentation text data for the byte array of data.
-     *
-     * @param fontNumber
-     *            The font resource identifier.
-     * @param x
-     *            The x coordinate for the text data.
-     * @param y
-     *            The y coordinate for the text data.
-     * @param orientation
-     *            The orientation of the text data.
-     * @param col
-     *            The text color.
-     * @param vsci
-     *            The variable space character increment.
-     * @param ica
-     *            The inter character adjustment.
-     * @param data
-     *            The text data to be created.
+     * 
+     * @param textDataInfo
+     *            the afp text data
      * @throws MaximumSizeExceededException
+     *             thrown if the maximum number of text data is exceeded
      */
-    public void createTextData(int fontNumber, int x, int y, int orientation,
-        Color col, int vsci, int ica, byte[] data) throws MaximumSizeExceededException {
+    public void createTextData(AFPTextDataInfo textDataInfo)
+            throws MaximumSizeExceededException {
 
         ByteArrayOutputStream afpdata = new ByteArrayOutputStream();
 
-        if (currentOrientation != orientation) {
-            setTextOrientation(orientation, afpdata);
-            currentOrientation = orientation;
+        if (currentOrientation != textDataInfo.getOrientation()) {
+            setTextOrientation(textDataInfo.getOrientation(), afpdata);
+            currentOrientation = textDataInfo.getOrientation();
             currentXCoordinate = -1;
             currentYCoordinate = -1;
         }
 
         // Avoid unnecessary specification of the Y co-ordinate
-        if (y != currentYCoordinate) {
-            absoluteMoveBaseline(y, afpdata);
+        if (textDataInfo.getY() != currentYCoordinate) {
+            absoluteMoveBaseline(textDataInfo.getY(), afpdata);
             currentXCoordinate = -1;
         }
 
         // Avoid unnecessary specification of the X co-ordinate
-        if (x != currentXCoordinate) {
-            absoluteMoveInline(x, afpdata);
+        if (textDataInfo.getX() != currentXCoordinate) {
+            absoluteMoveInline(textDataInfo.getX(), afpdata);
         }
 
         // Avoid unnecessary specification of the variable space increment
-        if (vsci != currentVariableSpaceCharacterIncrement) {
-            setVariableSpaceCharacterIncrement(vsci, afpdata);
-            currentVariableSpaceCharacterIncrement = vsci;
+        if (textDataInfo.getVariableSpaceCharacterIncrement()
+                != currentVariableSpaceCharacterIncrement) {
+            setVariableSpaceCharacterIncrement(textDataInfo
+                    .getVariableSpaceCharacterIncrement(), afpdata);
+            currentVariableSpaceCharacterIncrement = textDataInfo
+                    .getVariableSpaceCharacterIncrement();
         }
 
         // Avoid unnecessary specification of the inter character adjustment
-        if (ica != currentInterCharacterAdjustment) {
-            setInterCharacterAdjustment(ica, afpdata);
-            currentInterCharacterAdjustment = ica;
+        if (textDataInfo.getInterCharacterAdjustment() != currentInterCharacterAdjustment)
{
+            setInterCharacterAdjustment(textDataInfo.getInterCharacterAdjustment(),
+                    afpdata);
+            currentInterCharacterAdjustment = textDataInfo
+                    .getInterCharacterAdjustment();
         }
 
         // Avoid unnecessary specification of the text color
-        if (!col.equals(currentColor)) {
-            setExtendedTextColor(col, afpdata);
-            currentColor = col;
+        if (!textDataInfo.getColor().equals(currentColor)) {
+            setExtendedTextColor(textDataInfo.getColor(), afpdata);
+            currentColor = textDataInfo.getColor();
         }
 
-        setCodedFont(BinaryUtils.convert(fontNumber)[0], afpdata);
-        addTransparentData(data, afpdata);
+        setCodedFont(BinaryUtils.convert(textDataInfo.getFontReference())[0],
+                afpdata);
+        addTransparentData(textDataInfo.getData(), afpdata);
         currentXCoordinate = -1;
 
-        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();
@@ -335,7 +332,7 @@
     /**
      * Drawing of lines using the starting and ending coordinates, thickness and
      * colour arguments.
-     *
+     * 
      * @param x1
      *            The starting X coordinate.
      * @param y1
@@ -350,9 +347,11 @@
      *            The orientation of the text data.
      * @param col
      *            The text color.
+     * @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 {
+            int orientation, Color col) throws MaximumSizeExceededException {
 
         ByteArrayOutputStream afpdata = new ByteArrayOutputStream();
 
@@ -399,105 +398,103 @@
     /**
      * The Set Text Orientation control sequence establishes the I-direction and
      * B-direction for the subsequent text. This is a modal control sequence.
-     *
+     * 
      * Semantics: This control sequence specifies the I-axis and B-axis
      * orientations with respect to the Xp-axis for the current Presentation
      * Text object. The orientations are rotational values expressed in degrees
      * and minutes.
-     *
+     * 
      * @param orientation
-     *            The text orientation (0,90, 180, 270).
+     *            The text orientation (0, 90, 180, 270).
      * @param afpdata
      *            The output stream to which data should be written.
      */
-    private void setTextOrientation(int orientation, ByteArrayOutputStream afpdata) {
-        afpdata.write(new byte[] { 0x06, (byte) 0xF7, }, 0, 2);
+    private void setTextOrientation(int orientation,
+            ByteArrayOutputStream afpdata) {
+        afpdata.write(new byte[] {0x06, (byte) 0xF7, }, 0, 2);
         switch (orientation) {
-            case 90:
-                afpdata.write(0x2D);
-                afpdata.write(0x00);
-                afpdata.write(0x5A);
-                afpdata.write(0x00);
-                break;
-            case 180:
-                afpdata.write(0x5A);
-                afpdata.write(0x00);
-                afpdata.write(0x87);
-                afpdata.write(0x00);
-                break;
-            case 270:
-                afpdata.write(0x87);
-                afpdata.write(0x00);
-                afpdata.write(0x00);
-                afpdata.write(0x00);
-                break;
-            default:
-                afpdata.write(0x00);
-                afpdata.write(0x00);
-                afpdata.write(0x2D);
-                afpdata.write(0x00);
-                break;
+        case 90:
+            afpdata.write(0x2D);
+            afpdata.write(0x00);
+            afpdata.write(0x5A);
+            afpdata.write(0x00);
+            break;
+        case 180:
+            afpdata.write(0x5A);
+            afpdata.write(0x00);
+            afpdata.write(0x87);
+            afpdata.write(0x00);
+            break;
+        case 270:
+            afpdata.write(0x87);
+            afpdata.write(0x00);
+            afpdata.write(0x00);
+            afpdata.write(0x00);
+            break;
+        default:
+            afpdata.write(0x00);
+            afpdata.write(0x00);
+            afpdata.write(0x2D);
+            afpdata.write(0x00);
+            break;
         }
     }
 
     /**
      * The Set Extended Text Color control sequence specifies a color value and
-     * defines the color space and encoding for that value.  The specified color
-     * value is applied to foreground areas of the text presentation space.
-     * This is a modal control sequence.
-     *
+     * defines the color space and encoding for that value. The specified color
+     * value is applied to foreground areas of the text presentation space. This
+     * is a modal control sequence.
+     * 
      * @param col
      *            The color to be set.
      * @param afpdata
      *            The output stream to which data should be written.
      */
-    private void setExtendedTextColor(Color col,
-        ByteArrayOutputStream afpdata) {
-
-        afpdata.write(new byte[] {
-              15                // Control sequence length
-            , (byte)0x81        // Control sequence function type
-            , 0x00              // Reserved; must be zero
-            , 0x01              // Color space - 0x01 = RGB
-            , 0x00              // Reserved; must be zero
-            , 0x00              // Reserved; must be zero
-            , 0x00              // Reserved; must be zero
-            , 0x00              // Reserved; must be zero
-            , 8                 // Number of bits in component 1
-            , 8                 // Number of bits in component 2
-            , 8                 // Number of bits in component 3
-            , 0                 // Number of bits in component 4
-            , (byte)(col.getRed())   // Red intensity
-            , (byte)(col.getGreen()) // Green intensity
-            , (byte)(col.getBlue())  // Blue intensity
-        }, 0, 15);
-
+    private void setExtendedTextColor(Color col, ByteArrayOutputStream afpdata) {
+        byte[] colorData = new byte[] {
+            15, // Control sequence length
+            (byte) 0x81, // Control sequence function type
+            0x00, // Reserved; must be zero
+            0x01, // Color space - 0x01 = RGB
+            0x00, // Reserved; must be zero
+            0x00, // Reserved; must be zero
+            0x00, // Reserved; must be zero
+            0x00, // Reserved; must be zero
+            8, // Number of bits in component 1
+            8, // Number of bits in component 2
+            8, // Number of bits in component 3
+            0, // Number of bits in component 4
+            (byte) (col.getRed()), // Red intensity
+            (byte) (col.getGreen()), // Green intensity
+            (byte) (col.getBlue()), // Blue intensity
+        };
+        
+        afpdata.write(colorData, 0, colorData.length);
     }
 
     /**
-     * //TODO
-     * This is a modal control sequence.
-     *
+     * //TODO This is a modal control sequence.
+     * 
      * @param incr
      *            The increment to be set.
      * @param afpdata
      *            The output stream to which data should be written.
      */
-    private void setVariableSpaceCharacterIncrement(int incr, ByteArrayOutputStream afpdata)
{
+    private void setVariableSpaceCharacterIncrement(int incr,
+            ByteArrayOutputStream afpdata) {
         byte[] b = BinaryUtils.convert(incr, 2);
 
         afpdata.write(new byte[] {
-              4                  // Control sequence length
-            , (byte)0xC5         // Control sequence function type
-            , b[0]
-            , b[1]
-        }, 0, 4);
+                4, // Control sequence length
+                (byte) 0xC5, // Control sequence function type
+                b[0], b[1] },
+                0, 4);
     }
 
     /**
-     * //TODO
-     * This is a modal control sequence.
-     *
+     * //TODO This is a modal control sequence.
+     * 
      * @param incr
      *            The increment to be set.
      * @param afpdata
@@ -506,12 +503,10 @@
     private void setInterCharacterAdjustment(int incr, ByteArrayOutputStream afpdata) {
         byte[] b = BinaryUtils.convert(Math.abs(incr), 2);
         afpdata.write(new byte[] {
-              5                  // Control sequence length
-            , (byte)0xC3         // Control sequence function type
-            , b[0]
-            , b[1]
-            , (byte)(incr >= 0 ? 0 : 1) // Direction
-        }, 0, 5);
+                5, // Control sequence length
+                (byte) 0xC3, // Control sequence function type
+                b[0], b[1], (byte) (incr >= 0 ? 0 : 1) // Direction
+                }, 0, 5);
     }
 
     /**
@@ -531,8 +526,9 @@
      * and zero or more parameters. The control sequence can extend multiple
      * presentation text data objects, but must eventually be terminated. This
      * method terminates the control sequence.
-     *
+     * 
      * @throws MaximumSizeExceededException
+     *       thrown in the event that maximum size has been exceeded
      */
     public void endControlSequence() throws MaximumSizeExceededException {
         byte[] data = new byte[2];

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java?rev=675507&r1=675506&r2=675507&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java
(original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java
Thu Jul 10 03:59:39 2008
@@ -24,6 +24,8 @@
 import java.io.OutputStream;
 import java.util.List;
 
+import org.apache.fop.render.afp.AFPTextDataInfo;
+
 /**
  * The Presentation Text object is the data object used in document processing
  * environments for representing text which has been prepared for presentation.
@@ -76,58 +78,18 @@
     /**
      * Create the presentation text data for the byte array of data.
      *
-     * @param fontNum
-     *            The font resource identifier.
-     * @param x
-     *            The x coordinate for the text data.
-     * @param y
-     *            The y coordinate for the text data.
-     * @param col
-     *            The text color.
-     * @param vsci
-     *            The variable space character increment.
-     * @param ica
-     *            The inter character increment.
-     * @param data
-     *            The text data to be created.
-     */
-    public void createTextData(int fontNum, int x, int y, Color col,
-            int vsci, int ica, byte[] data) {
-        // Use a default orientation of zero
-        createTextData(fontNum, x, y, 0, col, vsci, ica, data);
-    }
-
-    /**
-     * Create the presentation text data for the byte array of data.
-     *
-     * @param fontRef
-     *            The font resource identifier.
-     * @param x
-     *            The x coordinate for the text data.
-     * @param y
-     *            The y coordinate for the text data.
-     * @param orientation
-     *            The orientation of the text data.
-     * @param col
-     *            The text color.
-     * @param vsci
-     *            The variable space character increment.
-     * @param ica
-     *            The inter character adjustment.
-     * @param data
-     *            The text data to be created.
+     * @param textDataInfo
+     *            The afp text data
      */
-    public void createTextData(int fontRef, int x, int y, int orientation,
-        Color col, int vsci, int ica, byte[] data) {
+    public void createTextData(AFPTextDataInfo textDataInfo) {
         if (currentPresentationTextData == null) {
             startPresentationTextData();
         }
         try {
-            currentPresentationTextData.createTextData(fontRef, x, y,
-                orientation, col, vsci, ica, data);
+            currentPresentationTextData.createTextData(textDataInfo);
         } catch (MaximumSizeExceededException msee) {
             endPresentationTextData();
-            createTextData(fontRef, x, y, orientation, col, vsci, ica, data);
+            createTextData(textDataInfo);
         }
     }
 

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=675507&r1=675506&r2=675507&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
Thu Jul 10 03:59:39 2008
@@ -112,6 +112,7 @@
 import org.apache.fop.pdf.PDFXMode;
 import org.apache.fop.pdf.PDFXObject;
 import org.apache.fop.render.AbstractPathOrientedRenderer;
+import org.apache.fop.render.AbstractState;
 import org.apache.fop.render.Graphics2DAdapter;
 import org.apache.fop.render.RendererContext;
 import org.apache.fop.util.CharUtilities;
@@ -1094,7 +1095,7 @@
      */
     protected List breakOutOfStateStack() {
         List breakOutList = new java.util.ArrayList();
-        PDFState.Data data;
+        AbstractState.AbstractData data;
         while (true) {
             data = currentState.getData();
             if (currentState.pop() == null) {
@@ -1115,10 +1116,10 @@
      */
     protected void restoreStateStackAfterBreakOut(List breakOutList) {
         comment("------ restoring context after break-out...");
-        PDFState.Data data;
+        AbstractState.AbstractData data;
         Iterator i = breakOutList.iterator();
         while (i.hasNext()) {
-            data = (PDFState.Data)i.next();
+            data = (AbstractState.AbstractData)i.next();
             saveGraphicsState();
             AffineTransform at = data.getTransform();
             concatenateTransformationMatrix(at);



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Mime
View raw message