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 2007/12/12 13:24:16 UTC
svn commit: r603590 [5/5] - in /xmlgraphics/fop/trunk: lib/
src/java/org/apache/fop/render/afp/ src/java/org/apache/fop/render/afp/modca/
src/java/org/apache/fop/render/afp/modca/goca/
src/java/org/apache/fop/render/ps/
Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetCurrentPosition.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetCurrentPosition.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetCurrentPosition.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetCurrentPosition.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+
+/**
+ * Sets the current painting position of the graphics object
+ */
+public class GraphicsSetCurrentPosition extends AbstractGraphicsCoord {
+
+ /**
+ * @param coords the x/y coordinates for this object
+ */
+ public GraphicsSetCurrentPosition(int[] coords) {
+ super(coords);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected byte getOrderCode() {
+ return (byte)0x21;
+ }
+}
\ No newline at end of file
Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetLineType.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetLineType.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetLineType.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetLineType.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+/**
+ * Sets the value of the current line type attribute when stroking GOCA shapes (structured fields)
+ */
+public class GraphicsSetLineType extends AbstractPreparedAFPObject {
+ /** the default line type */
+ public static final byte DEFAULT = 0x00; // normally SOLID
+
+ /** the default line type */
+ public static final byte DOTTED = 0x01;
+
+ /** short dashed line type */
+ public static final byte SHORT_DASHED = 0x02;
+
+ /** dashed dotted line type */
+ public static final byte DASH_DOT = 0x03;
+
+ /** double dotted line type */
+ public static final byte DOUBLE_DOTTED = 0x04;
+
+ /** long dashed line type */
+ public static final byte LONG_DASHED = 0x05;
+
+ /** dash double dotted line type */
+ public static final byte DASH_DOUBLE_DOTTED = 0x06;
+
+ /** solid line type */
+ public static final byte SOLID = 0x07;
+
+ /** invisible line type */
+ public static final byte INVISIBLE = 0x08;
+
+ /** line type */
+ private byte type = DEFAULT;
+
+ /**
+ * Main constructor
+ * @param type line type
+ */
+ public GraphicsSetLineType(byte type) {
+ this.type = type;
+ prepareData();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void prepareData() {
+ super.data = new byte[] {
+ 0x18, // GSLW order code
+ type // line type
+ };
+ }
+
+ private static final String[] TYPES = {
+ "DEFAULT", "DOTTED", "SHORT_DASHED", "DASH_DOT", "DOUBLE_DOTTED",
+ "LONG_DASHED", "DASH_DOUBLE_DOTTED", "SOLID", "INVISIBLE"
+ };
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString() {
+ return "GraphicsSetLineType(type=" + TYPES[type] + ")";
+ }
+}
\ No newline at end of file
Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetLineWidth.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetLineWidth.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetLineWidth.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetLineWidth.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+/**
+ * Sets the line width to use when stroking GOCA shapes (structured fields)
+ */
+public class GraphicsSetLineWidth extends AbstractPreparedAFPObject {
+ /** line width multiplier */
+ private int multiplier = 1;
+
+ /**
+ * Main constructor
+ * @param multiplier the line width multiplier
+ */
+ public GraphicsSetLineWidth(int multiplier) {
+ this.multiplier = multiplier;
+ prepareData();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void prepareData() {
+ super.data = new byte[] {
+ 0x19, // GSLW order code
+ (byte)multiplier // MH (line-width)
+ };
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString() {
+ return "GraphicsSetLineWidth(multiplier=" + multiplier + ")";
+ }
+}
\ No newline at end of file
Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetPatternSymbol.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetPatternSymbol.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetPatternSymbol.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetPatternSymbol.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+/**
+ * Sets the pattern symbol to use when filling following GOCA structured fields
+ */
+public class GraphicsSetPatternSymbol extends AbstractPreparedAFPObject {
+ /** dotted density 1 */
+ public static final byte DOTTED_DENSITY_1 = 0x01;
+
+ /** dotted density 2 */
+ public static final byte DOTTED_DENSITY_2 = 0x02;
+
+ /** dotted density 3 */
+ public static final byte DOTTED_DENSITY_3 = 0x03;
+
+ /** dotted density 4 */
+ public static final byte DOTTED_DENSITY_4 = 0x04;
+
+ /** dotted density 5 */
+ public static final byte DOTTED_DENSITY_5 = 0x05;
+
+ /** dotted density 6 */
+ public static final byte DOTTED_DENSITY_6 = 0x06;
+
+ /** dotted density 7 */
+ public static final byte DOTTED_DENSITY_7 = 0x07;
+
+ /** dotted density 8 */
+ public static final byte DOTTED_DENSITY_8 = 0x08;
+
+ /** dotted density 9 */
+ public static final byte VERTICAL_LINES = 0x09;
+
+ /** horizontal lines */
+ public static final byte HORIZONTAL_LINES = 0x0A;
+
+ /** diagonal lines, bottom left to top right 1 */
+ public static final byte DIAGONAL_LINES_BLTR_1 = 0x0B;
+
+ /** diagonal lines, bottom left to top right 2 */
+ public static final byte DIAGONAL_LINES_BLTR_2 = 0x0C;
+
+ /** diagonal lines, top left to bottom right 1 */
+ public static final byte DIAGONAL_LINES_TLBR_1 = 0x0D;
+
+ /** diagonal lines, top left to bottom right 2 */
+ public static final byte DIAGONAL_LINES_TLBR_2 = 0x0E;
+
+ /** no fill */
+ public static final byte NO_FILL = 0x0F;
+
+ /** solid fill */
+ public static final byte SOLID_FILL = 0x10;
+
+ /** blank (same as no fill) */
+ public static final byte BLANK = 0x40; // processed same as NO_FILL
+
+ /** the graphics pattern symbol to use */
+ private byte symbol;
+
+ /**
+ * Main constructor
+ * @param symb the pattern symbol to use
+ */
+ public GraphicsSetPatternSymbol(byte symb) {
+ this.symbol = symb;
+ prepareData();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void prepareData() {
+ super.data = new byte[] {
+ 0x28, // GSPT order code
+ symbol
+ };
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString() {
+ return "GraphicsSetPatternSymbol(fill="
+ + (symbol == SOLID_FILL ? true : false) + ")";
+ }
+}
\ No newline at end of file
Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetProcessColor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetProcessColor.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetProcessColor.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetProcessColor.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+import java.awt.Color;
+import java.awt.color.ColorSpace;
+
+import org.apache.fop.render.afp.modca.GraphicsObject;
+
+/**
+ * Sets the current processing color for the following GOCA structured fields
+ */
+public class GraphicsSetProcessColor extends AbstractPreparedAFPObject {
+ /** the color to set */
+ private Color col;
+
+ /**
+ * Main constructor
+ * @param col the color to set
+ */
+ public GraphicsSetProcessColor(Color col) {
+ this.col = col;
+ prepareData();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void prepareData() {
+ // COLSPCE
+ byte colspace;
+ int colSpaceType = col.getColorSpace().getType();
+ if (colSpaceType == ColorSpace.TYPE_CMYK) {
+ colspace = 0x04;
+ } else if (colSpaceType == ColorSpace.TYPE_RGB) {
+ colspace = 0x01;
+ } else {
+ GraphicsObject.log.error("unsupported colorspace " + colSpaceType);
+ colspace = 0x01;
+ }
+
+ // COLSIZE(S)
+ float[] colcomp = col.getColorComponents(null);
+ byte[] colsizes = new byte[] {0x00, 0x00, 0x00, 0x00};
+ for (int i = 0; i < colcomp.length; i++) {
+ colsizes[i] = (byte)8;
+ }
+
+ int len = 10 + colcomp.length;
+ super.data = new byte[len + 2];
+ data[0] = (byte)0xB2; // GSPCOL order code
+ data[1] = (byte)len; // LEN
+ data[2] = 0x00; // reserved; must be zero
+ data[3] = colspace; // COLSPCE
+ data[4] = 0x00; // reserved; must be zero
+ data[5] = 0x00; // reserved; must be zero
+ data[6] = 0x00; // reserved; must be zero
+ data[7] = 0x00; // reserved; must be zero
+ data[8] = colsizes[0]; // COLSIZE(S)
+ data[9] = colsizes[1];
+ data[10] = colsizes[2];
+ data[11] = colsizes[3];
+ // COLVALUE(S)
+ for (int i = 0; i < colcomp.length; i++) {
+ data[i + 12] = (byte)(colcomp[i] * 255);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString() {
+ return "GraphicsSetProcessColor(col=" + col + ")";
+ }
+}
\ No newline at end of file
Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsString.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsString.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsString.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsString.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+import java.io.UnsupportedEncodingException;
+
+import org.apache.fop.render.afp.modca.AFPConstants;
+import org.apache.fop.render.afp.modca.GraphicsObject;
+import org.apache.fop.render.afp.tools.BinaryUtils;
+
+/**
+ * A GOCA graphics string
+ */
+public class GraphicsString extends AbstractPreparedAFPObject {
+ /** Up to 255 bytes of character data */
+ private static final int MAX_STR_LEN = 255;
+
+ /** drawn from the current position */
+ private boolean fromCurrentPosition = false;
+
+ /** the string to draw */
+ private String str = null;
+
+ /** x coordinate */
+ private int x;
+
+ /** y coordinate */
+ private int y;
+
+ /**
+ * @param str the character string
+ */
+ public GraphicsString(String str) {
+ this.str = str;
+ fromCurrentPosition = true;
+ prepareData();
+ }
+
+ /**
+ * @param str the character string
+ * @param x the x coordinate
+ * @param y the y coordinate
+ */
+ public GraphicsString(String str, int x, int y) {
+ this.str = str;
+ this.x = x;
+ this.y = y;
+ prepareData();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void prepareData() {
+ int maxStrLen = MAX_STR_LEN - (fromCurrentPosition ? 0 : 4);
+ if (str.length() > maxStrLen) {
+ str = str.substring(0, maxStrLen);
+ log.warn("truncated character string, longer than " + maxStrLen + " chars");
+ }
+ byte[] strData = null;
+ try {
+ strData = str.getBytes(AFPConstants.EBCIDIC_ENCODING);
+ } catch (UnsupportedEncodingException ex) {
+ GraphicsObject.log.error("unsupported encoding: " + ex.getMessage());
+ }
+ int len = strData.length;
+ if (fromCurrentPosition) {
+ data = new byte[len + 2];
+ data[0] = (byte)0x83;
+ data[1] = (byte)len;
+ System.arraycopy(strData, 0, data, 2, strData.length);
+ } else {
+ len += 4; // x/y coordinates
+ byte[] osx = BinaryUtils.convert(x, 2);
+ byte[] osy = BinaryUtils.convert(y, 2);
+ data = new byte[len + 2];
+ data[0] = (byte)0xC3;
+ data[1] = (byte)len;
+ data[2] = osx[0];
+ data[3] = osx[1];
+ data[4] = osy[0];
+ data[5] = osy[1];
+ System.arraycopy(strData, 0, data, 6, strData.length);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString() {
+ String string = "GraphicsString(str='" + str + "'";
+ if (!fromCurrentPosition) {
+ string += ",x=" + x + ",y=" + y;
+ }
+ string += ")";
+ return string;
+ }
+}
\ No newline at end of file
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java?rev=603590&r1=603589&r2=603590&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java Wed Dec 12 04:24:10 2007
@@ -35,7 +35,7 @@
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.image.ImageTranscoder;
import org.apache.xmlgraphics.java2d.ps.AbstractPSDocumentGraphics2D;
-import org.apache.xmlgraphics.java2d.ps.TextHandler;
+import org.apache.xmlgraphics.java2d.TextHandler;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontSetup;
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/NativeTextHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/NativeTextHandler.java?rev=603590&r1=603589&r2=603590&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/NativeTextHandler.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/NativeTextHandler.java Wed Dec 12 04:24:10 2007
@@ -28,14 +28,14 @@
import org.apache.fop.fonts.FontSetup;
import org.apache.fop.fonts.FontTriplet;
import org.apache.xmlgraphics.java2d.ps.PSGraphics2D;
-import org.apache.xmlgraphics.java2d.ps.TextHandler;
+import org.apache.xmlgraphics.java2d.ps.PSTextHandler;
import org.apache.xmlgraphics.ps.PSGenerator;
/**
* Specialized TextHandler implementation that the PSGraphics2D class delegates to to paint text
* using PostScript text operations.
*/
-public class NativeTextHandler implements TextHandler {
+public class NativeTextHandler implements PSTextHandler {
private PSGraphics2D g2d;
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSTextPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSTextPainter.java?rev=603590&r1=603589&r2=603590&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSTextPainter.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSTextPainter.java Wed Dec 12 04:24:10 2007
@@ -40,7 +40,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.xmlgraphics.java2d.ps.PSGraphics2D;
-import org.apache.xmlgraphics.java2d.ps.TextHandler;
+import org.apache.xmlgraphics.java2d.TextHandler;
import org.apache.batik.dom.svg.SVGOMTextElement;
import org.apache.batik.gvt.text.Mark;
@@ -385,7 +385,6 @@
String style = getStyle(aci);
int weight = getWeight(aci);
- boolean found = false;
String fontFamily = null;
List gvtFonts = (List) aci.getAttribute(
GVTAttributedCharacterIterator.TextAttribute.GVT_FONT_FAMILIES);
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org