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 je...@apache.org on 2007/12/12 17:13:16 UTC
svn commit: r603656 [6/7] - in
/xmlgraphics/fop/branches/Temp_ImagePackageRedesign: ./ examples/fo/basic/
lib/ src/documentation/ src/documentation/content/xdocs/
src/documentation/content/xdocs/trunk/
src/documentation/intermediate-format-ng/ src/java...
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/ImageSegment.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/ImageSegment.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/ImageSegment.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/ImageSegment.java Wed Dec 12 08:13:06 2007
@@ -18,6 +18,7 @@
/* $Id$ */
package org.apache.fop.render.afp.modca;
+
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
@@ -42,25 +43,23 @@
/**
* The name of the image segment
*/
- private String _name;
+ private String name;
/**
* The name of the image segment as EBCIDIC bytes
*/
- private byte[] _nameBytes;
+ private byte[] nameBytes;
/**
* The ImageContent for the image segment
*/
- private ImageContent _imageContent = null;
+ private ImageContent imageContent = null;
/**
* Default constructor for the ImageSegment.
*/
public ImageSegment() {
-
this(DEFAULT_NAME);
-
}
/**
@@ -69,28 +68,20 @@
* @param name The name of the image.
*/
public ImageSegment(String name) {
-
if (name.length() != 4) {
String msg = "Image segment name must be 4 characters long " + name;
log.error("Constructor:: " + msg);
throw new IllegalArgumentException(msg);
}
-
- _name = name;
-
+ this.name = name;
try {
-
- _nameBytes = name.getBytes(AFPConstants.EBCIDIC_ENCODING);
-
+ this.nameBytes = name.getBytes(AFPConstants.EBCIDIC_ENCODING);
} catch (UnsupportedEncodingException usee) {
-
- _nameBytes = name.getBytes();
+ this.nameBytes = name.getBytes();
log.warn(
"Constructor:: UnsupportedEncodingException translating the name "
+ name);
-
}
-
}
/**
@@ -102,10 +93,10 @@
* @param vsize The vertival size of the image.
*/
public void setImageSize(int hresol, int vresol, int hsize, int vsize) {
- if (_imageContent == null) {
- _imageContent = new ImageContent();
+ if (imageContent == null) {
+ imageContent = new ImageContent();
}
- _imageContent.setImageSize(hresol, vresol, hsize, vsize);
+ imageContent.setImageSize(hresol, vresol, hsize, vsize);
}
/**
@@ -113,10 +104,10 @@
* @param encoding The image encoding.
*/
public void setImageEncoding(byte encoding) {
- if (_imageContent == null) {
- _imageContent = new ImageContent();
+ if (imageContent == null) {
+ imageContent = new ImageContent();
}
- _imageContent.setImageEncoding(encoding);
+ imageContent.setImageEncoding(encoding);
}
/**
@@ -124,10 +115,10 @@
* @param compression The image compression.
*/
public void setImageCompression(byte compression) {
- if (_imageContent == null) {
- _imageContent = new ImageContent();
+ if (imageContent == null) {
+ imageContent = new ImageContent();
}
- _imageContent.setImageCompression(compression);
+ imageContent.setImageCompression(compression);
}
/**
@@ -135,10 +126,10 @@
* @param size The IDE size.
*/
public void setImageIDESize(byte size) {
- if (_imageContent == null) {
- _imageContent = new ImageContent();
+ if (imageContent == null) {
+ imageContent = new ImageContent();
}
- _imageContent.setImageIDESize(size);
+ imageContent.setImageIDESize(size);
}
/**
@@ -146,48 +137,41 @@
* @param colorModel the IDE color model.
*/
public void setImageIDEColorModel(byte colorModel) {
- if (_imageContent == null) {
- _imageContent = new ImageContent();
+ if (imageContent == null) {
+ imageContent = new ImageContent();
}
- _imageContent.setImageIDEColorModel(colorModel);
+ imageContent.setImageIDEColorModel(colorModel);
}
/**
* Set the data of the image.
* @param data the image data
*/
- public void setImageData(byte data[]) {
- if (_imageContent == null) {
- _imageContent = new ImageContent();
+ public void setImageData(byte[] data) {
+ if (imageContent == null) {
+ imageContent = new ImageContent();
}
- _imageContent.setImageData(data);
+ imageContent.setImageData(data);
}
/**
* Accessor method to write the AFP datastream for the Image Segment
* @param os The stream to write to
- * @throws java.io.IOException
+ * @throws java.io.IOException if an I/O exception occurred
*/
- public void writeDataStream(OutputStream os)
- throws IOException {
-
+ public void writeDataStream(OutputStream os) throws IOException {
writeStart(os);
-
- if (_imageContent != null) {
- _imageContent.writeDataStream(os);
+ if (imageContent != null) {
+ imageContent.writeDataStream(os);
}
-
writeEnd(os);
-
}
/**
* Helper method to write the start of the Image Segment.
* @param os The stream to write to
*/
- private void writeStart(OutputStream os)
- throws IOException {
-
+ private void writeStart(OutputStream os) throws IOException {
byte[] data = new byte[] {
0x70, // ID
0x04, // Length
@@ -196,13 +180,9 @@
0x00, // Name byte 3
0x00, // Name byte 4
};
-
- for (int i = 0; i < _nameBytes.length; i++) {
-
- data[2 + i] = _nameBytes[i];
-
+ for (int i = 0; i < nameBytes.length; i++) {
+ data[2 + i] = nameBytes[i];
}
-
os.write(data);
}
@@ -211,16 +191,11 @@
* Helper method to write the end of the Image Segment.
* @param os The stream to write to
*/
- private void writeEnd(OutputStream os)
- throws IOException {
-
+ private void writeEnd(OutputStream os) throws IOException {
byte[] data = new byte[] {
0x71, // ID
0x00, // Length
};
-
os.write(data);
-
}
-
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/ImageSizeParameter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/ImageSizeParameter.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/ImageSizeParameter.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/ImageSizeParameter.java Wed Dec 12 08:13:06 2007
@@ -28,10 +28,10 @@
*/
public class ImageSizeParameter extends AbstractAFPObject {
- private int _hresol = 0;
- private int _vresol = 0;
- private int _hsize = 0;
- private int _vsize = 0;
+ private int hRes = 0;
+ private int vRes = 0;
+ private int hSize = 0;
+ private int vSize = 0;
/**
* Constructor for a ImageSizeParameter for the specified
@@ -42,22 +42,18 @@
* @param vsize The vsize of the vsize.
*/
public ImageSizeParameter(int hresol, int vresol, int hsize, int vsize) {
-
- _hresol = hresol;
- _vresol = vresol;
- _hsize = hsize;
- _vsize = vsize;
-
+ this.hRes = hresol;
+ this.vRes = vresol;
+ this.hSize = hsize;
+ this.vSize = vsize;
}
/**
* Accessor method to write the AFP datastream for the Image Size Parameter
* @param os The stream to write to
- * @throws java.io.IOException
+ * @throws java.io.IOException if an I/O exception occured
*/
- public void writeDataStream(OutputStream os)
- throws IOException {
-
+ public void writeDataStream(OutputStream os) throws IOException {
byte[] data = new byte[] {
(byte)0x94, // ID = Image Size Parameter
0x09, // Length
@@ -72,24 +68,22 @@
0x00, //
};
- byte[] x = BinaryUtils.convert(_hresol, 2);
+ byte[] x = BinaryUtils.convert(hRes, 2);
data[3] = x[0];
data[4] = x[1];
- byte[] y = BinaryUtils.convert(_vresol, 2);
+ byte[] y = BinaryUtils.convert(vRes, 2);
data[5] = y[0];
data[6] = y[1];
- byte[] w = BinaryUtils.convert(_hsize, 2);
+ byte[] w = BinaryUtils.convert(hSize, 2);
data[7] = w[0];
data[8] = w[1];
- byte[] h = BinaryUtils.convert(_vsize, 2);
+ byte[] h = BinaryUtils.convert(vSize, 2);
data[9] = h[0];
data[10] = h[1];
os.write(data);
-
}
-
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/MapCodedFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/MapCodedFont.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/MapCodedFont.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/MapCodedFont.java Wed Dec 12 08:13:06 2007
@@ -23,7 +23,8 @@
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
import org.apache.fop.render.afp.exceptions.FontRuntimeException;
import org.apache.fop.render.afp.fonts.AFPFont;
@@ -46,44 +47,44 @@
/**
* The collection of map coded fonts (maximum of 254)
*/
- private ArrayList _fontlist = null;
+ private List fontList = null;
/**
* Constructor for the MapCodedFont
*/
public MapCodedFont() {
- _fontlist = new ArrayList();
+ fontList = new java.util.ArrayList();
}
/**
* Accessor method to write the AFP datastream for the Map Coded Font
* @param os The stream to write to
- * @throws java.io.IOException
+ * @throws java.io.IOException an I/O exception of some sort has occurred
*/
- public void writeDataStream(OutputStream os)
- throws IOException {
-
+ public void writeDataStream(OutputStream os) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos.write(0x5A);
- baos.write(new byte[] { 0x00, 0x00 });
+ baos.write(new byte[] {0x00, 0x00});
// Field identifier for a MapCodedFont
- baos.write(new byte[] { (byte) 0xD3, (byte) 0xAB, (byte) 0x8A });
+ baos.write(new byte[] {(byte) 0xD3, (byte) 0xAB, (byte) 0x8A});
// Reserved
- baos.write(new byte[] { 0x00, 0x00, 0x00 });
+ baos.write(new byte[] {0x00, 0x00, 0x00});
- for (int i = 0; i < _fontlist.size(); i++) {
+
+ Iterator iter = fontList.iterator();
+ while (iter.hasNext()) {
- FontDefinition fd = (FontDefinition) _fontlist.get(i);
+ FontDefinition fd = (FontDefinition) iter.next();
// Start of repeating groups (occurs 1 to 254)
baos.write(0x00);
- if (fd._scale == 0) {
+ if (fd.scale == 0) {
// Raster Font
baos.write(0x22); // Length of 34
} else {
@@ -96,46 +97,46 @@
baos.write(0x02);
baos.write((byte) 0x86);
baos.write(0x00);
- baos.write(fd._characterset);
+ baos.write(fd.characterSet);
// Font Code Page Name Reference
baos.write(0x0C);
baos.write(0x02);
baos.write((byte) 0x85);
baos.write(0x00);
- baos.write(fd._codepage);
+ baos.write(fd.codePage);
// Character Rotation
baos.write(0x04);
baos.write(0x26);
- baos.write(fd._orientation);
+ baos.write(fd.orientation);
baos.write(0x00);
// Resource Local Identifier
baos.write(0x04);
baos.write(0x24);
baos.write(0x05);
- baos.write(fd._fontReferenceKey);
+ baos.write(fd.fontReferenceKey);
- if (fd._scale != 0) {
+ if (fd.scale != 0) {
// Outline Font (triplet '1F')
baos.write(0x14);
baos.write(0x1F);
baos.write(0x00);
baos.write(0x00);
- baos.write(BinaryUtils.convert(fd._scale, 2)); // Height
- baos.write(new byte[] { 0x00, 0x00 }); // Width
+ baos.write(BinaryUtils.convert(fd.scale, 2)); // Height
+ baos.write(new byte[] {0x00, 0x00}); // Width
- baos.write(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00 });
+ baos.write(new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00});
baos.write(0x60);
// Outline Font (triplet '5D')
baos.write(0x04);
baos.write(0x5D);
- baos.write(BinaryUtils.convert(fd._scale, 2));
+ baos.write(BinaryUtils.convert(fd.scale, 2));
}
}
@@ -162,26 +163,27 @@
* the size of the font
* @param orientation
* the orientation of the font
+ * @throws MaximumSizeExceededException if the maximum number of fonts have been exceeded
*/
- public void addFont(byte fontReference, AFPFont font, int size, int orientation)
+ public void addFont(int fontReference, AFPFont font, int size, int orientation)
throws MaximumSizeExceededException {
FontDefinition fd = new FontDefinition();
- fd._fontReferenceKey = fontReference;
+ fd.fontReferenceKey = BinaryUtils.convert(fontReference)[0];
switch (orientation) {
case 90:
- fd._orientation = 0x2D;
+ fd.orientation = 0x2D;
break;
case 180:
- fd._orientation = 0x5A;
+ fd.orientation = 0x5A;
break;
case 270:
- fd._orientation = (byte) 0x87;
+ fd.orientation = (byte) 0x87;
break;
default:
- fd._orientation = 0x00;
+ fd.orientation = 0x00;
break;
}
@@ -198,21 +200,21 @@
throw new FontRuntimeException(msg);
}
- fd._characterset = cs.getNameBytes();
+ fd.characterSet = cs.getNameBytes();
- if (fd._characterset.length != 8) {
+ if (fd.characterSet.length != 8) {
throw new IllegalArgumentException("The character set "
- + new String(fd._characterset,
+ + new String(fd.characterSet,
AFPConstants.EBCIDIC_ENCODING)
+ " must have a fixed length of 8 characters.");
}
- fd._codepage = cs.getCodePage().getBytes(
+ fd.codePage = cs.getCodePage().getBytes(
AFPConstants.EBCIDIC_ENCODING);
- if (fd._codepage.length != 8) {
+ if (fd.codePage.length != 8) {
throw new IllegalArgumentException("The code page "
- + new String(fd._codepage,
+ + new String(fd.codePage,
AFPConstants.EBCIDIC_ENCODING)
+ " must have a fixed length of 8 characters.");
}
@@ -221,18 +223,18 @@
OutlineFont outline = (OutlineFont) font;
CharacterSet cs = outline.getCharacterSet();
- fd._characterset = cs.getNameBytes();
+ fd.characterSet = cs.getNameBytes();
// There are approximately 72 points to 1 inch or 20 1440ths per point.
- fd._scale = ((size / 1000) * 20);
+ fd.scale = ((size / 1000) * 20);
- fd._codepage = cs.getCodePage().getBytes(
+ fd.codePage = cs.getCodePage().getBytes(
AFPConstants.EBCIDIC_ENCODING);
- if (fd._codepage.length != 8) {
+ if (fd.codePage.length != 8) {
throw new IllegalArgumentException("The code page "
- + new String(fd._codepage,
+ + new String(fd.codePage,
AFPConstants.EBCIDIC_ENCODING)
+ " must have a fixed length of 8 characters.");
}
@@ -244,15 +246,13 @@
throw new FontRuntimeException(msg);
}
- if (_fontlist.size() > 253) {
+ if (fontList.size() > 253) {
// Throw an exception if the size is exceeded
throw new MaximumSizeExceededException();
} else {
-
- _fontlist.add(fd);
-
+ fontList.add(fd);
}
} catch (UnsupportedEncodingException ex) {
@@ -260,8 +260,7 @@
throw new FontRuntimeException("Failed to create font "
+ " due to a UnsupportedEncodingException", ex);
- }
-
+ }
}
/**
@@ -272,27 +271,27 @@
/**
* The code page of the font
*/
- private byte[] _codepage;
+ private byte[] codePage;
/**
* The character set of the font
*/
- private byte[] _characterset;
+ private byte[] characterSet;
/**
* The font reference key
*/
- private byte _fontReferenceKey;
+ private byte fontReferenceKey;
/**
* The orientation of the font
*/
- private byte _orientation;
+ private byte orientation;
/**
* The scale (only specified for outline fonts)
*/
- private int _scale = 0;
+ private int scale = 0;
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/MapPageOverlay.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/MapPageOverlay.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/MapPageOverlay.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/MapPageOverlay.java Wed Dec 12 08:13:06 2007
@@ -22,7 +22,7 @@
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
+import java.util.List;
import org.apache.fop.render.afp.tools.BinaryUtils;
@@ -37,7 +37,7 @@
/**
* The collection of overlays (maximum of 254 stored as byte[])
*/
- private ArrayList _overLays = new ArrayList();
+ private List overLays = new java.util.ArrayList();
/**
* Constructor for the Map Page Overlay
@@ -51,10 +51,11 @@
*
* @param name
* The name of the overlay.
+ * @throws MaximumSizeExceededException if the maximum size is reached
*/
public void addOverlay(String name) throws MaximumSizeExceededException {
- if (_overLays.size() > 253) {
+ if (overLays.size() > 253) {
throw new MaximumSizeExceededException();
}
@@ -72,28 +73,22 @@
try {
data = name.getBytes(AFPConstants.EBCIDIC_ENCODING);
- _overLays.add(data);
+ overLays.add(data);
} catch (UnsupportedEncodingException usee) {
- log
- .error("addOverlay():: UnsupportedEncodingException translating the name "
+ log.error("addOverlay():: UnsupportedEncodingException translating the name "
+ name);
-
}
-
}
/**
* Accessor method to write the AFP datastream for the Map Page Overlay
* @param os The stream to write to
- * @throws java.io.IOException
+ * @throws java.io.IOException if an I/O exception occurred
*/
- public void writeDataStream(OutputStream os)
- throws IOException {
-
-
- int oLayCount = _overLays.size();
+ public void writeDataStream(OutputStream os) throws IOException {
+ int oLayCount = overLays.size();
int recordlength = oLayCount * 18;
byte[] data = new byte[recordlength + 9];
@@ -134,12 +129,10 @@
data[++pos] = 0x00;
//now add the name
- byte[] name = (byte[]) _overLays.get(i);
+ byte[] name = (byte[]) overLays.get(i);
for (int j = 0; j < name.length; j++) {
-
data[++pos] = name[j];
-
}
data[++pos] = 0x04; //Resource Local Identifier (RLI)
@@ -148,11 +141,7 @@
//now add the unique id to the RLI
data[++pos] = olayref;
-
}
-
os.write(data);
-
}
-
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/MaximumSizeExceededException.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/MaximumSizeExceededException.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/MaximumSizeExceededException.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/MaximumSizeExceededException.java Wed Dec 12 08:13:06 2007
@@ -25,6 +25,11 @@
*/
public class MaximumSizeExceededException extends Exception {
+ private static final long serialVersionUID = 7823120005542216446L;
+
+ /**
+ * Default constructor
+ */
public MaximumSizeExceededException() {
super();
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/ObjectAreaDescriptor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/ObjectAreaDescriptor.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/ObjectAreaDescriptor.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/ObjectAreaDescriptor.java Wed Dec 12 08:13:06 2007
@@ -35,11 +35,11 @@
* and object height.
* @param width The page width.
* @param height The page height.
- * @param widthResolution The page width resolution.
- * @param heightResolution The page height resolution.
+ * @param widthRes The page width resolution.
+ * @param heightRes The page height resolution.
*/
- public ObjectAreaDescriptor(int width, int height, int widthResolution, int heightResolution) {
- super(width, height, widthResolution, heightResolution);
+ public ObjectAreaDescriptor(int width, int height, int widthRes, int heightRes) {
+ super(width, height, widthRes, heightRes);
}
/**
@@ -47,8 +47,7 @@
* @param os The stream to write to
* @throws java.io.IOException thrown if an I/O exception of some sort has occurred
*/
- public void writeDataStream(OutputStream os)
- throws IOException {
+ public void writeDataStream(OutputStream os) throws IOException {
byte[] data = new byte[29];
data[0] = 0x5A;
@@ -72,12 +71,12 @@
data[15] = 0x00; // YaoBase = 10 inches
// XaoUnits
- byte[] xdpi = BinaryUtils.convert(widthResolution * 10, 2);
+ byte[] xdpi = BinaryUtils.convert(this.widthRes * 10, 2);
data[16] = xdpi[0];
data[17] = xdpi[1];
// YaoUnits
- byte[] ydpi = BinaryUtils.convert(heightResolution * 10, 2);
+ byte[] ydpi = BinaryUtils.convert(this.heightRes * 10, 2);
data[18] = ydpi[0];
data[19] = ydpi[1];
@@ -85,18 +84,16 @@
data[21] = 0x4C; // tid = Object Area Size
data[22] = 0x02; // Size Type
- byte[] x = BinaryUtils.convert(width, 3);
+ byte[] x = BinaryUtils.convert(this.width, 3);
data[23] = x[0];
data[24] = x[1];
data[25] = x[2];
- byte[] y = BinaryUtils.convert(height, 3);
+ byte[] y = BinaryUtils.convert(this.height, 3);
data[26] = y[0];
data[27] = y[1];
data[28] = y[2];
os.write(data);
-
}
-
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/ObjectAreaPosition.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/ObjectAreaPosition.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/ObjectAreaPosition.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/ObjectAreaPosition.java Wed Dec 12 08:13:06 2007
@@ -30,9 +30,9 @@
*/
public class ObjectAreaPosition extends AbstractAFPObject {
- private int _x = 0;
- private int _y = 0;
- private int _rot = 0;
+ private int x;
+ private int y;
+ private int rotation;
/**
* Construct an object area position for the specified object y, y position.
@@ -41,24 +41,25 @@
* @param rotation The coordinate system rotation (must be 0, 90, 180, 270).
*/
public ObjectAreaPosition(int x, int y, int rotation) {
-
- _x = x;
- _y = y;
- _rot = rotation;
+ this.x = x;
+ this.y = y;
+ this.rotation = rotation;
}
/**
* Accessor method to write the AFP datastream for the Object Area Position
* @param os The stream to write to
- * @throws java.io.IOException
+ * @throws java.io.IOException in the event that an I/O exception of some sort has occurred.
*/
- public void writeDataStream(OutputStream os)
- throws IOException {
+ public void writeDataStream(OutputStream os) throws IOException {
+ byte[] len = BinaryUtils.convert(32, 2);
+ byte[] xcoord = BinaryUtils.convert(x, 3);
+ byte[] ycoord = BinaryUtils.convert(y, 3);
byte[] data = new byte[] {
0x5A,
- 0x00, // Length
- 0x20, // Length
+ len[0], // Length
+ len[1], // Length
(byte) 0xD3,
(byte) 0xAC,
(byte) 0x6B,
@@ -67,15 +68,15 @@
0x00, // Reserved
0x01, // OAPosID = 1
0x17, // RGLength = 23
- 0x00, // XoaOSet
- 0x00,
- 0x00,
- 0x00, // YoaOSet
- 0x00,
- 0x00,
- (byte)(_rot / 2), // XoaOrent
+ xcoord[0], // XoaOSet
+ xcoord[1],
+ xcoord[2],
+ ycoord[0], // YoaOSet
+ ycoord[1],
+ ycoord[2],
+ (byte)(rotation / 2), // XoaOrent
0x00,
- (byte)(_rot / 2 + 45), // YoaOrent
+ (byte)(rotation / 2 + 45), // YoaOrent
0x00,
0x00, // Reserved
0x00, // XocaOSet
@@ -88,23 +89,9 @@
0x00,
0x2D, // YocaOrent
0x00,
- 0x01, // RefCSys
+ 0x00, // RefCSys
};
-
- byte[] l = BinaryUtils.convert(data.length - 1, 2);
- data[1] = l[0];
- data[2] = l[1];
-
- byte[] x = BinaryUtils.convert(_x, 3);
- data[11] = x[0];
- data[12] = x[1];
- data[13] = x[2];
-
- byte[] y = BinaryUtils.convert(_y, 3);
- data[14] = y[0];
- data[15] = y[1];
- data[16] = y[2];
-
+
os.write(data);
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/ObjectEnvironmentGroup.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/ObjectEnvironmentGroup.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/ObjectEnvironmentGroup.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/ObjectEnvironmentGroup.java Wed Dec 12 08:13:06 2007
@@ -18,6 +18,7 @@
/* $Id$ */
package org.apache.fop.render.afp.modca;
+
import java.io.IOException;
import java.io.OutputStream;
@@ -33,7 +34,7 @@
* normally contained in the object environment group, or it may specify that one or
* more default values are to be used.
*/
-public final class ObjectEnvironmentGroup extends AbstractNamedAFPObject {
+public final class ObjectEnvironmentGroup extends AbstractStructuredAFPObject {
/**
* Default name for the object environment group
@@ -56,12 +57,15 @@
private ImageDataDescriptor imageDataDescriptor = null;
/**
+ * The GraphicsDataDescriptor for the object environment group
+ */
+ private GraphicsDataDescriptor graphicsDataDescriptor = null;
+
+ /**
* Default constructor for the ObjectEnvironmentGroup.
*/
public ObjectEnvironmentGroup() {
-
this(DEFAULT_NAME);
-
}
/**
@@ -70,9 +74,7 @@
* @param name the object environment group name
*/
public ObjectEnvironmentGroup(String name) {
-
super(name);
-
}
/**
@@ -82,15 +84,14 @@
* @param width the object width
* @param height the object height
* @param rotation the object orientation
- * @param widthResolution the object resolution width
- * @param heightResolution the object resolution height
+ * @param widthRes the object resolution width
+ * @param heightRes the object resolution height
*/
- public void setObjectArea(int x, int y, int width, int height, int rotation,
- int widthResolution, int heightResolution) {
-
- objectAreaDescriptor = new ObjectAreaDescriptor(width, height,
- widthResolution, heightResolution);
- objectAreaPosition = new ObjectAreaPosition(x, y, rotation);
+ public void setObjectArea(int x, int y, int width, int height,
+ int widthRes, int heightRes, int rotation) {
+ this.objectAreaDescriptor = new ObjectAreaDescriptor(width, height,
+ widthRes, heightRes);
+ this.objectAreaPosition = new ObjectAreaPosition(x, y, rotation);
}
@@ -102,40 +103,28 @@
* @param height the image height
*/
public void setImageData(int xresol, int yresol, int width, int height) {
- imageDataDescriptor = new ImageDataDescriptor(xresol, yresol, width, height);
+ this.imageDataDescriptor = new ImageDataDescriptor(xresol, yresol, width, height);
}
/**
- * Accessor method to obtain write the AFP datastream for
- * the object environment group.
- * @param os The stream to write to
- * @throws java.io.IOException throw if an I/O exception of some sort has occurred
+ * Set the graphics data descriptor.
+ * @param xresol the x resolution of the graphics window
+ * @param yresol the y resolution of the graphics window
+ * @param xlwind the left edge of the graphics window
+ * @param xrwind the right edge of the graphics window
+ * @param ybwind the top edge of the graphics window
+ * @param ytwind the bottom edge of the graphics window
*/
- public void writeDataStream(OutputStream os)
- throws IOException {
-
-
- writeStart(os);
-
- objectAreaDescriptor.writeDataStream(os);
-
- objectAreaPosition.writeDataStream(os);
-
- if (imageDataDescriptor != null) {
- imageDataDescriptor.writeDataStream(os);
- }
-
- writeEnd(os);
-
+ public void setGraphicsData(int xresol, int yresol,
+ int xlwind, int xrwind, int ybwind, int ytwind) {
+ this.graphicsDataDescriptor = new GraphicsDataDescriptor(xresol, yresol,
+ xlwind, xrwind, ybwind, ytwind);
}
/**
- * Helper method to write the start of the object environment group.
- * @param os The stream to write to
+ * {@inheritDoc}
*/
- private void writeStart(OutputStream os)
- throws IOException {
-
+ protected void writeStart(OutputStream os) throws IOException {
byte[] data = new byte[] {
0x5A, // Structured field identifier
0x00, // Length byte 1
@@ -146,53 +135,57 @@
0x00, // Flags
0x00, // Reserved
0x00, // Reserved
- 0x00, // Name
- 0x00, //
- 0x00, //
- 0x00, //
- 0x00, //
- 0x00, //
- 0x00, //
- 0x00, //
+ nameBytes[0], // Name
+ nameBytes[1], //
+ nameBytes[2], //
+ nameBytes[3], //
+ nameBytes[4], //
+ nameBytes[5], //
+ nameBytes[6], //
+ nameBytes[7] //
};
-
- for (int i = 0; i < nameBytes.length; i++) {
-
- data[9 + i] = nameBytes[i];
-
- }
-
os.write(data);
-
}
/**
- * Helper method to write the end of the object environment group.
- * @param os The stream to write to
+ * {@inheritDoc}
*/
- private void writeEnd(OutputStream os)
- throws IOException {
-
- byte[] data = new byte[17];
-
- data[0] = 0x5A; // Structured field identifier
- data[1] = 0x00; // Length byte 1
- data[2] = 0x10; // Length byte 2
- data[3] = (byte) 0xD3; // Structured field id byte 1
- data[4] = (byte) 0xA9; // Structured field id byte 2
- data[5] = (byte) 0xC7; // Structured field id byte 3
- data[6] = 0x00; // Flags
- data[7] = 0x00; // Reserved
- data[8] = 0x00; // Reserved
-
- for (int i = 0; i < nameBytes.length; i++) {
+ public void writeContent(OutputStream os) throws IOException {
+ objectAreaDescriptor.writeDataStream(os);
+ objectAreaPosition.writeDataStream(os);
- data[9 + i] = nameBytes[i];
+ if (imageDataDescriptor != null) {
+ imageDataDescriptor.writeDataStream(os);
+ }
+ if (graphicsDataDescriptor != null) {
+ graphicsDataDescriptor.writeDataStream(os);
}
+ }
+ /**
+ * {@inheritDoc}
+ */
+ protected void writeEnd(OutputStream os) throws IOException {
+ byte[] data = new byte[] {
+ 0x5A, // Structured field identifier
+ 0x00, // Length byte 1
+ 0x10, // Length byte 2
+ (byte) 0xD3, // Structured field id byte 1
+ (byte) 0xA9, // Structured field id byte 2
+ (byte) 0xC7, // Structured field id byte 3
+ 0x00, // Flags
+ 0x00, // Reserved
+ 0x00, // Reserved
+ nameBytes[0], // Name
+ nameBytes[1], //
+ nameBytes[2], //
+ nameBytes[3], //
+ nameBytes[4], //
+ nameBytes[5], //
+ nameBytes[6], //
+ nameBytes[7], //
+ };
os.write(data);
-
}
-
-}
\ No newline at end of file
+}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/PageDescriptor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/PageDescriptor.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/PageDescriptor.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/PageDescriptor.java Wed Dec 12 08:13:06 2007
@@ -35,11 +35,11 @@
* and page height.
* @param width The page width.
* @param height The page height.
- * @param widthResolution The page width resolution
- * @param heightResolution The page height resolution
+ * @param widthRes The page width resolution
+ * @param heightRes The page height resolution
*/
- public PageDescriptor(int width, int height, int widthResolution, int heightResolution) {
- super(width, height, widthResolution, heightResolution);
+ public PageDescriptor(int width, int height, int widthRes, int heightRes) {
+ super(width, height, widthRes, heightRes);
}
/**
@@ -68,12 +68,12 @@
data[10] = 0x00; // YpgBase = 10 inches
// XpgUnits
- byte[] xdpi = BinaryUtils.convert(widthResolution * 10, 2);
+ byte[] xdpi = BinaryUtils.convert(widthRes * 10, 2);
data[11] = xdpi[0];
data[12] = xdpi[1];
// YpgUnits
- byte[] ydpi = BinaryUtils.convert(heightResolution * 10, 2);
+ byte[] ydpi = BinaryUtils.convert(heightRes * 10, 2);
data[13] = ydpi[0];
data[14] = ydpi[1];
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/PageObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/PageObject.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/PageObject.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/PageObject.java Wed Dec 12 08:13:06 2007
@@ -62,15 +62,15 @@
* the height of the page.
* @param rotation
* the rotation of the page.
- * @param widthResolution
+ * @param widthRes
* the width resolution of the page.
- * @param heightResolution
+ * @param heightRes
* the height resolution of the page.
*/
public PageObject(String name, int width, int height, int rotation,
- int widthResolution, int heightResolution) {
+ int widthRes, int heightRes) {
- super(name, width, height, rotation, widthResolution, heightResolution);
+ super(name, width, height, rotation, widthRes, heightRes);
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java Wed Dec 12 08:13:06 2007
@@ -56,42 +56,42 @@
/**
* The afp data relating to this presentaion text data.
*/
- private ByteArrayOutputStream _baos = new ByteArrayOutputStream(1024);
+ private ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
/**
* The current x coordinate.
*/
- private int _currentXCoordinate = -1;
+ private int currentXCoordinate = -1;
/**
* The current y cooridnate
*/
- private int _currentYCoordinate = -1;
+ private int currentYCoordinate = -1;
/**
* The current font
*/
- private String _currentFont = "";
+ private String currentFont = "";
/**
* The current orientation
*/
- private int _currentOrientation = 0;
+ private int currentOrientation = 0;
/**
* The current color
*/
- private Color _currentColor = new Color(0, 0, 0);
+ private Color currentColor = new Color(0, 0, 0);
/**
* The current variable space increment
*/
- private int _currentVariableSpaceCharacterIncrement = 0;
+ private int currentVariableSpaceCharacterIncrement = 0;
/**
* The current inter character adjustment
*/
- private int _currentInterCharacterAdjustment = 0;
+ private int currentInterCharacterAdjustment = 0;
/**
* Default constructor for the PresentationTextData.
@@ -112,7 +112,7 @@
*/
public PresentationTextData(boolean controlInd) {
- _baos.write(new byte[] { 0x5A, // Structured field identifier
+ baos.write(new byte[] {0x5A, // Structured field identifier
0x00, // Record length byte 1
0x00, // Record length byte 2
(byte) 0xD3, // PresentationTextData identifier byte 1
@@ -124,7 +124,7 @@
}, 0, 9);
if (controlInd) {
- _baos.write(new byte[] { 0x2B, (byte) 0xD3 }, 0, 2);
+ baos.write(new byte[] {0x2B, (byte) 0xD3}, 0, 2);
}
}
@@ -142,13 +142,13 @@
private void setCodedFont(byte font, ByteArrayOutputStream afpdata) {
// Avoid unnecessary specification of the font
- if (String.valueOf(font).equals(_currentFont)) {
+ if (String.valueOf(font).equals(currentFont)) {
return;
} else {
- _currentFont = String.valueOf(font);
+ currentFont = String.valueOf(font);
}
- afpdata.write(new byte[] { 0x03, (byte) 0xF1, font, }, 0, 3);
+ afpdata.write(new byte[] {0x03, (byte) 0xF1, font}, 0, 3);
}
@@ -167,9 +167,9 @@
byte[] b = BinaryUtils.convert(coordinate, 2);
- afpdata.write(new byte[] { 0x04, (byte) 0xC7, b[0], b[1], }, 0, 4);
+ afpdata.write(new byte[] {0x04, (byte) 0xC7, b[0], b[1]}, 0, 4);
- _currentXCoordinate = coordinate;
+ currentXCoordinate = coordinate;
}
@@ -188,9 +188,9 @@
byte[] b = BinaryUtils.convert(coordinate, 2);
- afpdata.write(new byte[] { 0x04, (byte) 0xD3, b[0], b[1], }, 0, 4);
+ afpdata.write(new byte[] {0x04, (byte) 0xD3, b[0], b[1]}, 0, 4);
- _currentYCoordinate = coordinate;
+ currentYCoordinate = coordinate;
}
@@ -214,7 +214,7 @@
"Transparent data is longer than 253 bytes: " + data);
}
- afpdata.write(new byte[] { BinaryUtils.convert(l)[0], (byte) 0xDB, },
+ afpdata.write(new byte[] {BinaryUtils.convert(l)[0], (byte) 0xDB},
0, 2);
afpdata.write(data, 0, data.length);
@@ -236,7 +236,7 @@
private void drawBaxisRule(int length, int width,
ByteArrayOutputStream afpdata) {
- afpdata.write(new byte[] { 0x07, // Length
+ afpdata.write(new byte[] {0x07, // Length
(byte) 0xE7, // Type
}, 0, 2);
@@ -266,7 +266,7 @@
private void drawIaxisRule(int length, int width,
ByteArrayOutputStream afpdata) {
- afpdata.write(new byte[] { 0x07, // Length
+ afpdata.write(new byte[] {0x07, // Length
(byte) 0xE5, // Type
}, 0, 2);
@@ -284,7 +284,7 @@
/**
* Create the presentation text data for the byte array of data.
*
- * @param fontNumber
+ * @param fontReference
* The font resource identifier.
* @param x
* The x coordinate for the text data.
@@ -300,64 +300,64 @@
* The inter character adjustment.
* @param data
* The text data to be created.
- * @throws MaximumSizeExceededException
+ * @throws MaximumSizeExceededException if the maximum size is exceeded
*/
- public void createTextData(int fontNumber, int x, int y, int orientation,
+ public void createTextData(int fontReference, int x, int y, int orientation,
Color col, int vsci, int ica, byte[] data)
throws MaximumSizeExceededException {
ByteArrayOutputStream afpdata = new ByteArrayOutputStream();
- if (_currentOrientation != orientation) {
+ if (currentOrientation != orientation) {
setTextOrientation(orientation, afpdata);
- _currentOrientation = orientation;
- _currentXCoordinate = -1;
- _currentYCoordinate = -1;
+ currentOrientation = orientation;
+ currentXCoordinate = -1;
+ currentYCoordinate = -1;
}
// Avoid unnecessary specification of the Y co-ordinate
- if (y != _currentYCoordinate) {
+ if (y != currentYCoordinate) {
absoluteMoveBaseline(y, afpdata);
- _currentXCoordinate = -1;
+ currentXCoordinate = -1;
}
// Avoid unnecessary specification of the X co-ordinate
- if (x != _currentXCoordinate) {
+ if (x != currentXCoordinate) {
absoluteMoveInline(x, afpdata);
}
// Avoid unnecessary specification of the variable space increment
- if (vsci != _currentVariableSpaceCharacterIncrement) {
+ if (vsci != currentVariableSpaceCharacterIncrement) {
setVariableSpaceCharacterIncrement(vsci, afpdata);
- _currentVariableSpaceCharacterIncrement = vsci;
+ currentVariableSpaceCharacterIncrement = vsci;
}
// Avoid unnecessary specification of the inter character adjustment
- if (ica != _currentInterCharacterAdjustment) {
+ if (ica != currentInterCharacterAdjustment) {
setInterCharacterAdjustment(ica, afpdata);
- _currentInterCharacterAdjustment = ica;
+ currentInterCharacterAdjustment = ica;
}
// Avoid unnecessary specification of the text color
- if (!col.equals(_currentColor)) {
+ if (!col.equals(currentColor)) {
setExtendedTextColor(col, afpdata);
- _currentColor = col;
+ currentColor = col;
}
- setCodedFont(BinaryUtils.convert(fontNumber)[0], afpdata);
+ setCodedFont(BinaryUtils.convert(fontReference)[0], afpdata);
addTransparentData(data, afpdata);
- _currentXCoordinate = -1;
+ currentXCoordinate = -1;
int s = afpdata.size();
- if (_baos.size() + s > MAX_SIZE) {
- _currentXCoordinate = -1;
- _currentYCoordinate = -1;
+ if (baos.size() + s > MAX_SIZE) {
+ currentXCoordinate = -1;
+ currentYCoordinate = -1;
throw new MaximumSizeExceededException();
}
byte[] outputdata = afpdata.toByteArray();
- _baos.write(outputdata, 0, outputdata.length);
+ baos.write(outputdata, 0, outputdata.length);
}
@@ -379,30 +379,31 @@
* The orientation of the text data.
* @param col
* The text color.
+ * @throws MaximumSizeExceededException if the maximum size is exceeded
*/
public void createLineData(int x1, int y1, int x2, int y2, int thickness,
int orientation, Color col) throws MaximumSizeExceededException {
ByteArrayOutputStream afpdata = new ByteArrayOutputStream();
- if (_currentOrientation != orientation) {
+ if (currentOrientation != orientation) {
setTextOrientation(orientation, afpdata);
- _currentOrientation = orientation;
+ currentOrientation = orientation;
}
// Avoid unnecessary specification of the Y coordinate
- if (y1 != _currentYCoordinate) {
+ if (y1 != currentYCoordinate) {
absoluteMoveBaseline(y1, afpdata);
}
// Avoid unnecessary specification of the X coordinate
- if (x1 != _currentXCoordinate) {
+ if (x1 != currentXCoordinate) {
absoluteMoveInline(x1, afpdata);
}
- if (!col.equals(_currentColor)) {
+ if (!col.equals(currentColor)) {
setExtendedTextColor(col, afpdata);
- _currentColor = col;
+ currentColor = col;
}
if (y1 == y2) {
@@ -415,14 +416,14 @@
int s = afpdata.size();
- if (_baos.size() + s > MAX_SIZE) {
- _currentXCoordinate = -1;
- _currentYCoordinate = -1;
+ if (baos.size() + s > MAX_SIZE) {
+ currentXCoordinate = -1;
+ currentYCoordinate = -1;
throw new MaximumSizeExceededException();
}
byte[] outputdata = afpdata.toByteArray();
- _baos.write(outputdata, 0, outputdata.length);
+ baos.write(outputdata, 0, outputdata.length);
}
@@ -443,7 +444,7 @@
private void setTextOrientation(int orientation,
ByteArrayOutputStream afpdata) {
- afpdata.write(new byte[] { 0x06, (byte) 0xF7, }, 0, 2);
+ afpdata.write(new byte[] {0x06, (byte) 0xF7}, 0, 2);
switch (orientation) {
case 90:
@@ -559,12 +560,11 @@
* Accessor method to write the AFP datastream for
* the text data.
* @param os The stream to write to
- * @throws java.io.IOException
+ * @throws java.io.IOException if an I/O exception occurred
*/
- public void writeDataStream(OutputStream os)
- throws IOException {
+ public void writeDataStream(OutputStream os) throws IOException {
- byte[] data = _baos.toByteArray();
+ byte[] data = baos.toByteArray();
byte[] size = BinaryUtils.convert(data.length - 1, 2);
data[1] = size[0];
data[2] = size[1];
@@ -580,7 +580,7 @@
* presentation text data objects, but must eventually be terminated. This
* method terminates the control sequence.
*
- * @throws MaximumSizeExceededException
+ * @throws MaximumSizeExceededException if the maximum size is exceeded
*/
public void endControlSequence() throws MaximumSizeExceededException {
@@ -588,12 +588,10 @@
data[0] = 0x02;
data[1] = (byte) 0xF8;
- if (data.length + _baos.size() > MAX_SIZE) {
+ if (data.length + baos.size() > MAX_SIZE) {
throw new MaximumSizeExceededException();
}
-
- _baos.write(data, 0, data.length);
-
+ baos.write(data, 0, data.length);
}
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/PresentationTextDescriptor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/PresentationTextDescriptor.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/PresentationTextDescriptor.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/PresentationTextDescriptor.java Wed Dec 12 08:13:06 2007
@@ -52,12 +52,11 @@
* width and height.
* @param width The width of the page.
* @param height The height of the page.
- * @param widthResolution The width resolution of the page.
- * @param heightResolution The height resolution of the page.
+ * @param widthRes The width resolution of the page.
+ * @param heightRes The height resolution of the page.
*/
- public PresentationTextDescriptor(int width, int height,
- int widthResolution, int heightResolution) {
- super(width, height, widthResolution, heightResolution);
+ public PresentationTextDescriptor(int width, int height, int widthRes, int heightRes) {
+ super(width, height, widthRes, heightRes);
}
/**
@@ -81,11 +80,11 @@
data[9] = 0x00;
data[10] = 0x00;
- byte[] xdpi = BinaryUtils.convert(widthResolution * 10, 2);
+ byte[] xdpi = BinaryUtils.convert(widthRes * 10, 2);
data[11] = xdpi[0]; // xdpi
data[12] = xdpi[1];
- byte[] ydpi = BinaryUtils.convert(heightResolution * 10, 2);
+ byte[] ydpi = BinaryUtils.convert(heightRes * 10, 2);
data[13] = ydpi[0]; // ydpi
data[14] = ydpi[1];
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java Wed Dec 12 08:13:06 2007
@@ -100,7 +100,7 @@
/**
* Create the presentation text data for the byte array of data.
*
- * @param fontNumber
+ * @param fontReference
* The font resource identifier.
* @param x
* The x coordinate for the text data.
@@ -117,7 +117,7 @@
* @param data
* The text data to be created.
*/
- public void createTextData(int fontNumber, int x, int y, int orientation,
+ public void createTextData(int fontReference, int x, int y, int orientation,
Color col, int vsci, int ica, byte[] data) {
if (currentPresentationTextData == null) {
@@ -126,13 +126,13 @@
try {
- currentPresentationTextData.createTextData(fontNumber, x, y,
+ currentPresentationTextData.createTextData(fontReference, x, y,
orientation, col, vsci, ica, data);
} catch (MaximumSizeExceededException msee) {
endPresentationTextData();
- createTextData(fontNumber, x, y, orientation, col, vsci, ica, data);
+ createTextData(fontReference, x, y, orientation, col, vsci, ica, data);
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/TagLogicalElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/TagLogicalElement.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/TagLogicalElement.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/TagLogicalElement.java Wed Dec 12 08:13:06 2007
@@ -49,22 +49,22 @@
/**
* Name of the key, used within the TLE
*/
- private String _tleName = null;
+ private String tleName = null;
/**
* Value returned by the key
*/
- private String _tleValue = null;
+ private String tleValue = null;
/**
* Byte representaion of the name
*/
- private byte[] _tleByteName = null;
+ private byte[] tleByteName = null;
/**
* Byte representaion of the value
*/
- private byte[] _tleByteValue = null;
+ private byte[] tleByteValue = null;
/**
* Construct a tag logical element with the name and value specified.
@@ -73,18 +73,18 @@
*/
public TagLogicalElement(String name, String value) {
- _tleName = name;
- _tleValue = value;
+ this.tleName = name;
+ this.tleValue = value;
try {
- _tleByteName = name.getBytes(AFPConstants.EBCIDIC_ENCODING);
- _tleByteValue = value.getBytes(AFPConstants.EBCIDIC_ENCODING);
+ this.tleByteName = name.getBytes(AFPConstants.EBCIDIC_ENCODING);
+ this.tleByteValue = value.getBytes(AFPConstants.EBCIDIC_ENCODING);
} catch (UnsupportedEncodingException usee) {
- _tleByteName = name.getBytes();
- _tleByteValue = value.getBytes();
+ this.tleByteName = name.getBytes();
+ this.tleByteValue = value.getBytes();
log.warn(
"Constructor:: UnsupportedEncodingException translating the name "
+ name);
@@ -97,16 +97,16 @@
* Accessor method to obtain the byte array AFP datastream for the
* TagLogicalElement.
* @param os The outputsteam stream
- * @throws java.io.IOException
+ * @throws java.io.IOException if an I/O exception occurred
*/
public void writeDataStream(OutputStream os) throws IOException {
- byte[] data = new byte[17 + _tleName.length() + _tleValue.length()];
+ byte[] data = new byte[17 + tleName.length() + tleValue.length()];
data[0] = 0x5A;
// Set the total record length
- byte[] rl1 =
- BinaryUtils.convert(16 + _tleName.length() + _tleValue.length(), 2);
+ byte[] rl1
+ = BinaryUtils.convert(16 + tleName.length() + tleValue.length(), 2);
//Ignore first byte
data[1] = rl1[0];
data[2] = rl1[1];
@@ -122,28 +122,26 @@
//Use 2 triplets, attrubute name and value (the key for indexing)
- byte[] rl2 = BinaryUtils.convert(_tleName.length() + 4, 1);
+ byte[] rl2 = BinaryUtils.convert(tleName.length() + 4, 1);
data[9] = rl2[0]; // length of the triplet, including this field
data[10] = 0x02; //Identifies it as a FQN triplet
data[11] = 0x0B; // GID format
data[12] = 0x00;
int pos = 13;
- for (int i = 0; i < _tleByteName.length; i++) {
- data[pos++] = _tleByteName[i];
+ for (int i = 0; i < tleByteName.length; i++) {
+ data[pos++] = tleByteName[i];
}
- byte[] rl3 = BinaryUtils.convert(_tleByteValue.length + 4, 1);
+ byte[] rl3 = BinaryUtils.convert(tleByteValue.length + 4, 1);
data[pos++] = rl3[0]; // length of the triplet, including this field
data[pos++] = 0x36; //Identifies the triplet, attribute value
data[pos++] = 0x00; // Reserved
data[pos++] = 0x00; // Reserved
- for (int i = 0; i < _tleByteValue.length; i++) {
- data[pos++] = _tleByteValue[i];
+ for (int i = 0; i < tleByteValue.length; i++) {
+ data[pos++] = tleByteValue[i];
}
os.write(data);
-
}
-
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/TagLogicalElementBean.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/TagLogicalElementBean.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/TagLogicalElementBean.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/modca/TagLogicalElementBean.java Wed Dec 12 08:13:06 2007
@@ -27,10 +27,10 @@
public class TagLogicalElementBean {
/** The key attribute */
- private String _key;
+ private String key;
/** The value attribute */
- private String _value;
+ private String value;
/**
* Constructor for the TagLogicalElementBean.
@@ -38,8 +38,8 @@
* @param value the value attribute
*/
public TagLogicalElementBean(String key, String value) {
- _key = key;
- _value = value;
+ this.key = key;
+ this.value = value;
}
/**
@@ -47,7 +47,7 @@
* @return the key
*/
public String getKey() {
- return _key;
+ return this.key;
}
/**
@@ -55,7 +55,7 @@
* @return the value
*/
public String getValue() {
- return _value;
+ return this.value;
}
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/tools/BinaryUtils.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/tools/BinaryUtils.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/tools/BinaryUtils.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/tools/BinaryUtils.java Wed Dec 12 08:13:06 2007
@@ -33,40 +33,41 @@
* to the length specified by bufsize.
* @param integer The int representation.
* @param bufsize The required byte array size.
+ * @return the hexadecimal digits as a byte array
*/
public static byte[] convert(int integer, int bufsize) {
-
StringBuffer buf = new StringBuffer(Integer.toHexString(integer));
- if (buf.length() % 2 == 0) {
- // Ignore even number of digits
- } else {
- // Convert to an even number of digits
+ //Convert to an even number of digits
+ if (buf.length() % 2 != 0) {
buf.insert(0, "0");
}
int size = buf.length() / 2;
- while (size < bufsize) {
- buf.insert(0, "00");
- size++;
- };
- return convert(buf.toString());
-
+ if (size > bufsize) {
+ buf.delete(0, buf.length() - (bufsize * 2));
+ } else {
+ while (size < bufsize) {
+ buf.insert(0, "00");
+ size++;
+ }
+ }
+ return convert(buf.toString());
}
/**
* Convert an int into the corresponding byte array by encoding each
* two hexadecimal digits as a char.
* @param integer The int representation
+ * @return the hexadecimal digits as a byte array
*/
public static byte[] convert(int integer) {
-
return convert(Integer.toHexString(integer));
-
}
/**
* Convert a String of hexadecimal digits into the corresponding
* byte array by encoding each two hexadecimal digits as a byte.
* @param digits The hexadecimal digits representation.
+ * @return the hexadecimal digits as a byte array
*/
public static byte[] convert(String digits) {
@@ -82,26 +83,28 @@
char c1 = digits.charAt(i);
char c2 = digits.charAt(i + 1);
byte b = 0;
- if ((c1 >= '0') && (c1 <= '9'))
+ if ((c1 >= '0') && (c1 <= '9')) {
b += ((c1 - '0') * 16);
- else if ((c1 >= 'a') && (c1 <= 'f'))
+ } else if ((c1 >= 'a') && (c1 <= 'f')) {
b += ((c1 - 'a' + 10) * 16);
- else if ((c1 >= 'A') && (c1 <= 'F'))
+ } else if ((c1 >= 'A') && (c1 <= 'F')) {
b += ((c1 - 'A' + 10) * 16);
- else
+ } else {
throw new IllegalArgumentException("Bad hexadecimal digit");
- if ((c2 >= '0') && (c2 <= '9'))
+ }
+
+ if ((c2 >= '0') && (c2 <= '9')) {
b += (c2 - '0');
- else if ((c2 >= 'a') && (c2 <= 'f'))
+ } else if ((c2 >= 'a') && (c2 <= 'f')) {
b += (c2 - 'a' + 10);
- else if ((c2 >= 'A') && (c2 <= 'F'))
+ } else if ((c2 >= 'A') && (c2 <= 'F')) {
b += (c2 - 'A' + 10);
- else
+ } else {
throw new IllegalArgumentException("Bad hexadecimal digit");
+ }
baos.write(b);
}
return (baos.toByteArray());
-
}
/**
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/tools/DTDEntityResolver.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/tools/DTDEntityResolver.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/tools/DTDEntityResolver.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/tools/DTDEntityResolver.java Wed Dec 12 08:13:06 2007
@@ -37,22 +37,28 @@
public class DTDEntityResolver implements EntityResolver {
/** Public ID for the AFP fonts 1.0 DTD. */
- public static final String AFP_DTD_1_0_ID = "-//APACHE/DTD AFP Installed Font Definition DTD 1.0//EN";
+ public static final String AFP_DTD_1_0_ID
+ = "-//APACHE/DTD AFP Installed Font Definition DTD 1.0//EN";
/** Resource location for the AFP fonts 1.0 DTD. */
- public static final String AFP_DTD_1_0_RESOURCE = "afp-fonts-1.0.dtd";
+ public static final String AFP_DTD_1_0_RESOURCE
+ = "afp-fonts-1.0.dtd";
/** Public ID for the AFP fonts 1.1 DTD. */
- public static final String AFP_DTD_1_1_ID = "-//APACHE/DTD AFP Installed Font Definition DTD 1.1//EN";
+ public static final String AFP_DTD_1_1_ID
+ = "-//APACHE/DTD AFP Installed Font Definition DTD 1.1//EN";
/** Resource location for the AFP fonts 1.1 DTD. */
- public static final String AFP_DTD_1_1_RESOURCE = "afp-fonts-1.1.dtd";
+ public static final String AFP_DTD_1_1_RESOURCE
+ = "afp-fonts-1.1.dtd";
/** Public ID for the AFP fonts 1.2 DTD. */
- public static final String AFP_DTD_1_2_ID = "-//APACHE/DTD AFP Installed Font Definition DTD 1.2//EN";
+ public static final String AFP_DTD_1_2_ID
+ = "-//APACHE/DTD AFP Installed Font Definition DTD 1.2//EN";
/** Resource location for the AFP fonts 1.2 DTD. */
- public static final String AFP_DTD_1_2_RESOURCE = "afp-fonts-1.2.dtd";
+ public static final String AFP_DTD_1_2_RESOURCE
+ = "afp-fonts-1.2.dtd";
/**
* Resolve the combination of system and public identifiers.
@@ -76,7 +82,7 @@
} else if ( AFP_DTD_1_0_ID.equals(publicId) ) {
throw new FontRuntimeException(
"The AFP Installed Font Definition 1.0 DTD is not longer supported" );
- } else if( systemId != null && systemId.indexOf("afp-fonts.dtd") >= 0 ) {
+ } else if (systemId != null && systemId.indexOf("afp-fonts.dtd") >= 0 ) {
throw new FontRuntimeException(
"The AFP Installed Font Definition DTD must be specified using the public id" );
} else {
@@ -105,8 +111,8 @@
URL resource = cl.getResource( resourcePath );
if (resource == null) {
- throw new FontRuntimeException( "Resource " + resourcePath +
- " could not be found on the classpath" );
+ throw new FontRuntimeException( "Resource " + resourcePath
+ + "could not be found on the classpath" );
}
return resource;
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/tools/StructuredFieldReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/tools/StructuredFieldReader.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/tools/StructuredFieldReader.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/afp/tools/StructuredFieldReader.java Wed Dec 12 08:13:06 2007
@@ -43,23 +43,22 @@
/**
* The input stream to read
*/
- private InputStream _inputStream = null;
+ private InputStream inputStream = null;
/**
* The constructor for the StructuredFieldReader
* @param inputStream the input stream to process
*/
public StructuredFieldReader(InputStream inputStream) {
-
- _inputStream = inputStream;
-
+ this.inputStream = inputStream;
}
/**
* Get the next structured field as identified by the identifer
* parameter (this must be a valid MO:DCA structured field.
* @param identifier the three byte identifier
- * @throws IOException
+ * @throws IOException if an I/O exception occurred
+ * @return the next structured field
*/
public byte[] getNext(byte[] identifier) throws IOException {
@@ -70,7 +69,7 @@
}
int c;
- while ((c = _inputStream.read()) > -1) {
+ while ((c = inputStream.read()) > -1) {
bufferData[bufferPointer] = (byte) c;
@@ -116,7 +115,7 @@
byte[] retval = new byte[reclength];
- _inputStream.read(retval, 0, reclength);
+ inputStream.read(retval, 0, reclength);
return retval;
@@ -131,7 +130,5 @@
return new byte[] {
};
-
}
-
}
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/pdf/PDFSVGHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/pdf/PDFSVGHandler.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/pdf/PDFSVGHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/pdf/PDFSVGHandler.java Wed Dec 12 08:13:06 2007
@@ -157,6 +157,7 @@
+ userAgent.getTargetResolution()
+ "dpi.");
final float deviceResolution = userAgent.getTargetResolution();
+ log.debug("Generating SVG at " + deviceResolution + "dpi.");
final float uaResolution = userAgent.getSourceResolution();
SVGUserAgent ua = new SVGUserAgent(25.4f / uaResolution, new AffineTransform());
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java Wed Dec 12 08:13:06 2007
@@ -21,7 +21,12 @@
import java.awt.Color;
+import java.io.BufferedOutputStream;
import java.io.IOException;
+import java.io.OutputStream;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.svg.SVGLength;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.batik.bridge.BridgeContext;
@@ -29,13 +34,12 @@
import org.apache.batik.transcoder.TranscoderException;
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.TextHandler;
+
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontSetup;
import org.apache.fop.svg.AbstractFOPTranscoder;
-import org.apache.xmlgraphics.java2d.ps.AbstractPSDocumentGraphics2D;
-import org.apache.xmlgraphics.java2d.ps.TextHandler;
-import org.w3c.dom.Document;
-import org.w3c.dom.svg.SVGLength;
/**
* This class enables to transcode an input to a PostScript document.
@@ -114,7 +118,11 @@
getLogger().trace("document size: " + w + "pt x " + h + "pt");
try {
- graphics.setupDocument(output.getOutputStream(), w, h);
+ OutputStream out = output.getOutputStream();
+ if (!(out instanceof BufferedOutputStream)) {
+ out = new BufferedOutputStream(out);
+ }
+ graphics.setupDocument(out, w, h);
graphics.setViewportDimension(width, height);
if (hints.containsKey(ImageTranscoder.KEY_BACKGROUND_COLOR)) {
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/ps/NativeTextHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/ps/NativeTextHandler.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/ps/NativeTextHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/ps/NativeTextHandler.java Wed Dec 12 08:13:06 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/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/ps/PSTextPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/ps/PSTextPainter.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/ps/PSTextPainter.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/render/ps/PSTextPainter.java Wed Dec 12 08:13:06 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);
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/svg/PDFGraphicsDevice.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/svg/PDFGraphicsDevice.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/svg/PDFGraphicsDevice.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/svg/PDFGraphicsDevice.java Wed Dec 12 08:13:06 2007
@@ -68,7 +68,7 @@
/**
* Return out sole GraphicsConfig.
*
- * @return the grpahics configuration that created this object
+ * @return the graphics configuration that created this object
*/
public GraphicsConfiguration getDefaultConfiguration() {
return gc;
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/status.xml?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/status.xml (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/status.xml Wed Dec 12 08:13:06 2007
@@ -28,6 +28,61 @@
<changes>
<release version="FOP Trunk">
+ <action context="Code" dev="AC" type="add">
+ Added SVG support for AFP (GOCA).
+ </action>
+ <action context="Code" dev="JM" type="fix" fixes-bug="37993">
+ Bugfix: allow multiple bookmarks to point at the same destination.
+ </action>
+ <action context="Code" dev="JM" type="fix" fixes-bug="43917">
+ Bugfix for border-after painting and element list generation when a
+ forced break is involved.
+ </action>
+ <action context="Code" dev="JM" type="fix" fixes-bug="40230">
+ Bugfix: no empty page is generated anymore if there's no content
+ after a break-after.
+ </action>
+ <action context="Code" dev="VH" type="fix" fixes-bug="43803">
+ Restored proper handling of fo:table-cell having no children, which is allowed in relaxed
+ validation mode.
+ </action>
+ <action context="Code" dev="JM" type="fix">
+ Memory Leak fixed in the Property Cache. Fixed by Jeremias Maerki. Reported and Tested By
+ Chris Bowditch.
+ </action>
+ <action context="Code" dev="VH" type="fix" fixes-bug="43712">
+ Bugfix in tables: wrong element generation by the merging algorithm when glues must be
+ produced to cope with conditional spaces. The corresponding length was added twice: one in
+ the glue itself and one in the following box.
+ </action>
+ <action context="Code" dev="JM" type="fix">
+ Bugfix for URI resolution: Make StreamSources without system identifier work again.
+ </action>
+ <action context="Code" dev="JM" type="fix" fixes-bug="43910" due-to="David Delbecq">
+ Avoid a NullPointerException in AreaTreeHandler.endDocument().
+ </action>
+ <action context="Code" dev="VH" type="fix" fixes-bug="43766">
+ Bugfix: breaks generated by the merging algorithm for a table-row containing empty cells
+ had always a penalty of 900.
+ </action>
+ <action context="Code" dev="JM" type="add" fixes-bug="43605" due-to="V. Schappert">
+ Added methods for fo:page-number-citation(-last) in FOEventHandler.
+ </action>
+ <action context="Code" dev="VH" type="add">
+ Step towards performance: the collapsing-border resolution algorithm no longer triggers the
+ retrieving of the whole table, when possible.
+ </action>
+ <action context="Code" dev="VH" type="fix">
+ In case of missing cells the border-end of the table was applied to an inner cell, instead
+ of the (empty) cell in the last column.
+ </action>
+ <action context="Code" dev="VH" type="fix">
+ Fixed the resolution of borders with table-columns (border-before/after was wrongly applied
+ to every cell of the column).
+ </action>
+ <action context="Code" dev="VH" type="fix" fixes-bug="42768">
+ Fixed the resolution of border-end on cells spanning several rows.
+ </action>
<action context="Code" dev="JM" type="fix" fixes-bug="43835" due-to="David Churavy">
Bugfix: Use Font.getName() (logical font name) instead of Font.getFontName()
(localized) when registering fonts from AWT.
Propchange: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/test/fotree/unittests/table/RowGroupBuilder_no-row_simple.fo
('svn:kewords' removed)
Propchange: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/test/fotree/unittests/table/RowGroupBuilder_no-row_simple.fo
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/test/fotree/unittests/table/RowGroupBuilder_no-row_spans.fo
('svn:kewords' removed)
Propchange: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/test/fotree/unittests/table/RowGroupBuilder_no-row_spans.fo
------------------------------------------------------------------------------
svn:keywords = Id
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/test/java/org/apache/fop/memory/MemoryEater.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/test/java/org/apache/fop/memory/MemoryEater.java?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/test/java/org/apache/fop/memory/MemoryEater.java (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/test/java/org/apache/fop/memory/MemoryEater.java Wed Dec 12 08:13:06 2007
@@ -23,15 +23,19 @@
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
+import java.net.MalformedURLException;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
+import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.stream.StreamSource;
import org.apache.commons.io.output.NullOutputStream;
+
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.MimeConstants;
@@ -41,17 +45,21 @@
*/
public class MemoryEater {
- private static void eatMemory(File foFile, int replicatorRepeats) throws Exception {
-
- SAXTransformerFactory tFactory = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
- FopFactory fopFactory = FopFactory.newInstance();
-
+ private SAXTransformerFactory tFactory
+ = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
+ private FopFactory fopFactory = FopFactory.newInstance();
+ private Templates replicatorTemplates;
+
+ public MemoryEater() throws TransformerConfigurationException, MalformedURLException {
File xsltFile = new File("test/xsl/fo-replicator.xsl");
Source xslt = new StreamSource(xsltFile);
-
+ replicatorTemplates = tFactory.newTemplates(xslt);
+ }
+
+ private void eatMemory(File foFile, int replicatorRepeats) throws Exception {
Source src = new StreamSource(foFile);
- Transformer transformer = tFactory.newTransformer(xslt);
+ Transformer transformer = replicatorTemplates.newTransformer();
transformer.setParameter("repeats", new Integer(replicatorRepeats));
OutputStream out = new NullOutputStream(); //write to /dev/nul
@@ -78,13 +86,17 @@
boolean doPrompt = true; //true if you want a chance to start the monitoring console
try {
int replicatorRepeats = 2;
+ int runRepeats = 1;
if (args.length > 0) {
replicatorRepeats = Integer.parseInt(args[0]);
}
+ if (args.length > 1) {
+ runRepeats = Integer.parseInt(args[1]);
+ }
File testFile = new File("examples/fo/basic/readme.fo");
System.out.println("MemoryEater! About to replicate the test file "
- + replicatorRepeats + " times...");
+ + replicatorRepeats + " times and run it " + runRepeats + " times...");
if (doPrompt) {
prompt();
}
@@ -92,7 +104,10 @@
System.out.println("Processing...");
long start = System.currentTimeMillis();
- eatMemory(testFile, replicatorRepeats);
+ MemoryEater app = new MemoryEater();
+ for (int i = 0; i < runRepeats; i++) {
+ app.eatMemory(testFile, replicatorRepeats);
+ }
long duration = System.currentTimeMillis() - start;
System.out.println("Success! Job took " + duration + " ms");
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/test/layoutengine/disabled-testcases.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/test/layoutengine/disabled-testcases.xml?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/test/layoutengine/disabled-testcases.xml (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/test/layoutengine/disabled-testcases.xml Wed Dec 12 08:13:06 2007
@@ -307,13 +307,6 @@
added to the area tree.</description>
</testcase>
<testcase>
- <name>Bugzilla #40230: invalid extra page break</name>
- <file>block_break-after_bug40230.xml</file>
- <description>Currently an extra page is created even if there is nothing
- after a block with break-after="page"</description>
- <reference>http://issues.apache.org/bugzilla/show_bug.cgi?id=40230</reference>
- </testcase>
- <testcase>
<name>Soft hyphen with normal hyphenation enabled</name>
<file>block_shy_linebreaking_hyph.xml</file>
<description>A soft hyphen should be a preferred as break compared to a
Modified: xmlgraphics/fop/branches/Temp_ImagePackageRedesign/test/layoutengine/standard-testcases/page-production_empty_block_only.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ImagePackageRedesign/test/layoutengine/standard-testcases/page-production_empty_block_only.xml?rev=603656&r1=603655&r2=603656&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ImagePackageRedesign/test/layoutengine/standard-testcases/page-production_empty_block_only.xml (original)
+++ xmlgraphics/fop/branches/Temp_ImagePackageRedesign/test/layoutengine/standard-testcases/page-production_empty_block_only.xml Wed Dec 12 08:13:06 2007
@@ -51,5 +51,9 @@
</fo>
<checks>
<eval expected="3" xpath="count(//pageViewport)"/>
+ <element-list category="breaker" index="1">
+ <box w="0" aux="true"/> <!-- auxiliary box for empty box -->
+ <skip>3</skip>
+ </element-list>
</checks>
</testcase>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org