aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/svg
diff options
context:
space:
mode:
authorTore Engvig <tore@apache.org>2001-07-30 20:29:35 +0000
committerTore Engvig <tore@apache.org>2001-07-30 20:29:35 +0000
commite0edd215721150e6c04ac49706622d6189cb0b42 (patch)
tree6b59b872d9c0e93f99316ea2f421209b71a97755 /src/org/apache/fop/svg
parenteb57915dec9bcd907e495595efac60dbf3579ad8 (diff)
downloadxmlgraphics-fop-e0edd215721150e6c04ac49706622d6189cb0b42.tar.gz
xmlgraphics-fop-e0edd215721150e6c04ac49706622d6189cb0b42.zip
Formatted code according to code standards.
Changed license to use short license. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194380 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/svg')
-rw-r--r--src/org/apache/fop/svg/PDFAElementBridge.java5
-rw-r--r--src/org/apache/fop/svg/PDFANode.java3
-rw-r--r--src/org/apache/fop/svg/PDFDocumentGraphics2D.java22
-rw-r--r--src/org/apache/fop/svg/PDFGraphics2D.java479
-rw-r--r--src/org/apache/fop/svg/PDFTextPainter.java113
-rw-r--r--src/org/apache/fop/svg/PDFTranscoder.java99
-rw-r--r--src/org/apache/fop/svg/SVGArea.java12
-rw-r--r--src/org/apache/fop/svg/SVGElement.java43
-rw-r--r--src/org/apache/fop/svg/SVGElementMapping.java14
-rw-r--r--src/org/apache/fop/svg/SVGObj.java4
-rw-r--r--src/org/apache/fop/svg/SVGStringProperty.java14
-rw-r--r--src/org/apache/fop/svg/SVGUtilities.java45
-rw-r--r--src/org/apache/fop/svg/XMLObj.java57
13 files changed, 473 insertions, 437 deletions
diff --git a/src/org/apache/fop/svg/PDFAElementBridge.java b/src/org/apache/fop/svg/PDFAElementBridge.java
index 116b27e0a..560e8fb13 100644
--- a/src/org/apache/fop/svg/PDFAElementBridge.java
+++ b/src/org/apache/fop/svg/PDFAElementBridge.java
@@ -1,4 +1,5 @@
-/* $Id$
+/*
+ * $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -62,7 +63,7 @@ public class PDFAElementBridge extends AbstractGraphicsNodeBridge {
* @param node the graphics node to build
*/
public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) {
- PDFANode aNode = (PDFANode) super.createGraphicsNode(ctx, e);
+ PDFANode aNode = (PDFANode)super.createGraphicsNode(ctx, e);
return aNode;
}
diff --git a/src/org/apache/fop/svg/PDFANode.java b/src/org/apache/fop/svg/PDFANode.java
index 1d25071cb..e604e74d0 100644
--- a/src/org/apache/fop/svg/PDFANode.java
+++ b/src/org/apache/fop/svg/PDFANode.java
@@ -1,4 +1,5 @@
-/* $Id$
+/*
+ * $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
diff --git a/src/org/apache/fop/svg/PDFDocumentGraphics2D.java b/src/org/apache/fop/svg/PDFDocumentGraphics2D.java
index d0921dbd7..ae790ad9a 100644
--- a/src/org/apache/fop/svg/PDFDocumentGraphics2D.java
+++ b/src/org/apache/fop/svg/PDFDocumentGraphics2D.java
@@ -1,4 +1,5 @@
-/* $Id$
+/*
+ * $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -54,8 +55,8 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D {
* @param width the width of the document
* @param height the height of the document
*/
- public PDFDocumentGraphics2D(boolean textAsShapes,
- OutputStream stream, int width, int height) {
+ public PDFDocumentGraphics2D(boolean textAsShapes, OutputStream stream,
+ int width, int height) {
super(textAsShapes);
if (!textAsShapes) {
@@ -64,8 +65,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D {
try {
fontState = new FontState(fontInfo, "Helvetica", "normal",
"normal", 12, 0);
- } catch (FOPException e) {
- }
+ } catch (FOPException e) {}
}
standalone = true;
this.stream = stream;
@@ -99,8 +99,8 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D {
* The result is scaled so that the svg fits correctly inside the pdf document.
*/
public void setSVGDimension(float w, float h) {
- currentStream.write("" + PDFNumber.doubleOut(width / w) +
- " 0 0 " + PDFNumber.doubleOut(height / h) + " 0 0 cm\n");
+ currentStream.write("" + PDFNumber.doubleOut(width / w) + " 0 0 "
+ + PDFNumber.doubleOut(height / h) + " 0 0 cm\n");
}
/**
@@ -129,9 +129,8 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D {
public void finish() throws IOException {
pdfStream.add(getString());
PDFResources pdfResources = this.pdfDoc.getResources();
- PDFPage currentPage =
- this.pdfDoc.makePage(pdfResources, pdfStream, width,
- height, null);
+ PDFPage currentPage = this.pdfDoc.makePage(pdfResources, pdfStream,
+ width, height, null);
if (fontInfo != null) {
FontSetup.addToResources(this.pdfDoc, fontInfo);
}
@@ -154,7 +153,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D {
* Creates a new <code>Graphics</code> object that is
* a copy of this <code>Graphics</code> object.
* @return a new graphics context that is a copy of
- * this graphics context.
+ * this graphics context.
*/
public Graphics create() {
return new PDFDocumentGraphics2D(this);
@@ -171,5 +170,6 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D {
super.drawString(s, x, y);
}
}
+
}
diff --git a/src/org/apache/fop/svg/PDFGraphics2D.java b/src/org/apache/fop/svg/PDFGraphics2D.java
index 5239b0f58..530e25fc5 100644
--- a/src/org/apache/fop/svg/PDFGraphics2D.java
+++ b/src/org/apache/fop/svg/PDFGraphics2D.java
@@ -1,7 +1,8 @@
-/* $Id$
+/*
+ * $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
- * LICENSE file included with these sources."
+ * LICENSE file included with these sources.
*/
package org.apache.fop.svg;
@@ -45,27 +46,41 @@ import java.util.Vector;
public class PDFGraphics2D extends AbstractGraphics2D {
boolean standalone = false;
- /** the PDF Document being created */
+ /**
+ * the PDF Document being created
+ */
protected PDFDocument pdfDoc;
protected FontState fontState;
- /** the current stream to add PDF commands to */
+ /**
+ * the current stream to add PDF commands to
+ */
StringWriter currentStream = new StringWriter();
- /** the current (internal) font name */
+ /**
+ * the current (internal) font name
+ */
protected String currentFontName;
- /** the current font size in millipoints */
+ /**
+ * the current font size in millipoints
+ */
protected int currentFontSize;
- /** the current vertical position in millipoints from bottom */
+ /**
+ * the current vertical position in millipoints from bottom
+ */
protected int currentYPosition = 0;
- /** the current horizontal position in millipoints from left */
+ /**
+ * the current horizontal position in millipoints from left
+ */
protected int currentXPosition = 0;
- /** the current colour for use in svg */
+ /**
+ * the current colour for use in svg
+ */
PDFColor currentColour = new PDFColor(0, 0, 0);
/**
@@ -73,8 +88,8 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* This is used to create a Graphics object for use inside an already
* existing document.
*/
- public PDFGraphics2D(boolean textAsShapes, FontState fs,
- PDFDocument doc, String font, int size, int xpos, int ypos) {
+ public PDFGraphics2D(boolean textAsShapes, FontState fs, PDFDocument doc,
+ String font, int size, int xpos, int ypos) {
super(textAsShapes);
pdfDoc = doc;
currentFontName = font;
@@ -107,7 +122,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* Creates a new <code>Graphics</code> object that is
* a copy of this <code>Graphics</code> object.
* @return a new graphics context that is a copy of
- * this graphics context.
+ * this graphics context.
*/
public Graphics create() {
return new PDFGraphics2D(this);
@@ -132,14 +147,14 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* @param x the <i>x</i> coordinate.
* @param y the <i>y</i> coordinate.
* @param observer object to be notified as more of
- * the image is converted.
+ * the image is converted.
* @see java.awt.Image
* @see java.awt.image.ImageObserver
* @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
*/
public boolean drawImage(Image img, int x, int y,
ImageObserver observer) {
- //System.err.println("drawImage:x, y");
+ // System.err.println("drawImage:x, y");
final int width = img.getWidth(observer);
final int height = img.getHeight(observer);
@@ -162,8 +177,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
}
g.dispose();
- final byte[] result =
- new byte[buf.getWidth() * buf.getHeight() * 3];
+ final byte[] result = new byte[buf.getWidth() * buf.getHeight() * 3];
final byte[] mask = new byte[buf.getWidth() * buf.getHeight()];
Raster raster = buf.getData();
@@ -171,39 +185,42 @@ public class PDFGraphics2D extends AbstractGraphics2D {
int count = 0;
int maskpos = 0;
- int [] iarray;
+ int[] iarray;
int i, j, val, alpha, add, mult;
switch (bd.getDataType()) {
- case DataBuffer.TYPE_INT:
- int[][] idata = ((DataBufferInt) bd).getBankData();
- for (i = 0; i < idata.length; i++) {
- iarray = idata[i];
- for (j = 0; j < iarray.length; j++) {
- val = iarray[j];
- alpha = val >>> 24;
- //mask[maskpos++] = (byte)((idata[i][j] >> 24) & 0xFF);
- if (alpha != 255) {
- // System.out.println("Alpha: " + alpha);
- // Composite with opaque white...
- add = (255 - alpha);
- mult = (alpha << 16) / 255;
- result[count++] = (byte)(add +
- ((((val >> 16) & 0xFF) * mult) >> 16));
- result[count++] = (byte)(add +
- ((((val >> 8) & 0xFF) * mult) >> 16));
- result[count++] = (byte)(add +
- ((((val) & 0xFF) * mult) >>16));
- } else {
- result[count++] = (byte)((val >> 16) & 0xFF);
- result[count++] = (byte)((val >> 8) & 0xFF);
- result[count++] = (byte)((val) & 0xFF);
- }
+ case DataBuffer.TYPE_INT:
+ int[][] idata = ((DataBufferInt)bd).getBankData();
+ for (i = 0; i < idata.length; i++) {
+ iarray = idata[i];
+ for (j = 0; j < iarray.length; j++) {
+ val = iarray[j];
+ alpha = val >>> 24;
+ // mask[maskpos++] = (byte)((idata[i][j] >> 24) & 0xFF);
+ if (alpha != 255) {
+ // System.out.println("Alpha: " + alpha);
+ // Composite with opaque white...
+ add = (255 - alpha);
+ mult = (alpha << 16) / 255;
+ result[count++] =
+ (byte)(add
+ + ((((val >> 16) & 0xFF) * mult) >> 16));
+ result[count++] =
+ (byte)(add
+ + ((((val >> 8) & 0xFF) * mult) >> 16));
+ result[count++] = (byte)(add
+ + ((((val) & 0xFF) * mult)
+ >> 16));
+ } else {
+ result[count++] = (byte)((val >> 16) & 0xFF);
+ result[count++] = (byte)((val >> 8) & 0xFF);
+ result[count++] = (byte)((val) & 0xFF);
}
}
- break;
- default:
- // error
- break;
+ }
+ break;
+ default:
+ // error
+ break;
}
try {
@@ -215,12 +232,12 @@ public class PDFGraphics2D extends AbstractGraphics2D {
currentStream.write("q\n");
Shape imclip = getClip();
writeClip(imclip);
- currentStream.write("" + matrix[0] + " " + matrix[1] +
- " " + matrix[2] + " " + matrix[3] + " " +
- matrix[4] + " " + matrix[5] + " cm\n");
- currentStream.write("" + width + " 0 0 " + (-height) +
- " " + x + " " + (y + height) + " cm\n" + "/Im" +
- xObjectNum + " Do\nQ\n");
+ currentStream.write("" + matrix[0] + " " + matrix[1] + " "
+ + matrix[2] + " " + matrix[3] + " "
+ + matrix[4] + " " + matrix[5] + " cm\n");
+ currentStream.write("" + width + " 0 0 " + (-height) + " " + x
+ + " " + (y + height) + " cm\n" + "/Im"
+ + xObjectNum + " Do\nQ\n");
} catch (Exception e) {
e.printStackTrace();
}
@@ -248,8 +265,8 @@ public class PDFGraphics2D extends AbstractGraphics2D {
this.m_width = width;
this.m_bitsPerPixel = 8;
this.m_colorSpace = new ColorSpace(ColorSpace.DEVICE_RGB);
- //this.m_isTransparent = false;
- //this.m_bitmapsSize = this.m_width * this.m_height * 3;
+ // this.m_isTransparent = false;
+ // this.m_bitmapsSize = this.m_width * this.m_height * 3;
this.m_bitmaps = result;
this.m_mask = mask;
}
@@ -281,18 +298,22 @@ public class PDFGraphics2D extends AbstractGraphics2D {
public boolean isTransparent() throws FopImageException {
return transparent != null;
}
+
public PDFColor getTransparentColor() throws FopImageException {
return transparent;
}
+
public byte[] getMask() throws FopImageException {
return m_mask;
}
+
// get the image bytes, and bytes properties
// get uncompressed image bytes
public byte[] getBitmaps() throws FopImageException {
return m_bitmaps;
}
+
// width * (bitsPerPixel / 8) * height, no ?
public int getBitmapsSize() throws FopImageException {
return m_width * m_height * 3;
@@ -304,9 +325,11 @@ public class PDFGraphics2D extends AbstractGraphics2D {
public byte[] getRessourceBytes() throws FopImageException {
return null;
}
+
public int getRessourceBytesSize() throws FopImageException {
return 0;
}
+
// return null if no corresponding PDFFilter
public PDFFilter getPDFFilter() throws FopImageException {
return null;
@@ -346,13 +369,13 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* @param width the width of the rectangle.
* @param height the height of the rectangle.
* @param observer object to be notified as more of
- * the image is converted.
+ * the image is converted.
* @see java.awt.Image
* @see java.awt.image.ImageObserver
* @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
*/
- public boolean drawImage(Image img, int x, int y, int width,
- int height, ImageObserver observer) {
+ public boolean drawImage(Image img, int x, int y, int width, int height,
+ ImageObserver observer) {
System.out.println("drawImage");
return true;
}
@@ -385,7 +408,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* @see java.awt.Graphics#create
*/
public void dispose() {
- //System.out.println("dispose");
+ // System.out.println("dispose");
pdfDoc = null;
fontState = null;
currentStream = null;
@@ -410,7 +433,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* @see #setComposite
*/
public void draw(Shape s) {
- //System.out.println("draw(Shape)");
+ // System.out.println("draw(Shape)");
currentStream.write("q\n");
Shape imclip = getClip();
writeClip(imclip);
@@ -425,33 +448,33 @@ public class PDFGraphics2D extends AbstractGraphics2D {
double vals[] = new double[6];
int type = iter.currentSegment(vals);
switch (type) {
- case PathIterator.SEG_CUBICTO:
- currentStream.write(PDFNumber.doubleOut(vals[0]) +
- " " + PDFNumber.doubleOut(vals[1]) + " " +
- PDFNumber.doubleOut(vals[2]) + " " +
- PDFNumber.doubleOut(vals[3]) + " " +
- PDFNumber.doubleOut(vals[4]) + " " +
- PDFNumber.doubleOut(vals[5]) + " c\n");
- break;
- case PathIterator.SEG_LINETO:
- currentStream.write(PDFNumber.doubleOut(vals[0]) +
- " " + PDFNumber.doubleOut(vals[1]) + " l\n");
- break;
- case PathIterator.SEG_MOVETO:
- currentStream.write(PDFNumber.doubleOut(vals[0]) +
- " " + PDFNumber.doubleOut(vals[1]) + " m\n");
- break;
- case PathIterator.SEG_QUADTO:
- currentStream.write(PDFNumber.doubleOut(vals[0]) +
- " " + PDFNumber.doubleOut(vals[1]) + " " +
- PDFNumber.doubleOut(vals[2]) + " " +
- PDFNumber.doubleOut(vals[3]) + " y\n");
- break;
- case PathIterator.SEG_CLOSE:
- currentStream.write("h\n");
- break;
- default:
- break;
+ case PathIterator.SEG_CUBICTO:
+ currentStream.write(PDFNumber.doubleOut(vals[0]) + " "
+ + PDFNumber.doubleOut(vals[1]) + " "
+ + PDFNumber.doubleOut(vals[2]) + " "
+ + PDFNumber.doubleOut(vals[3]) + " "
+ + PDFNumber.doubleOut(vals[4]) + " "
+ + PDFNumber.doubleOut(vals[5]) + " c\n");
+ break;
+ case PathIterator.SEG_LINETO:
+ currentStream.write(PDFNumber.doubleOut(vals[0]) + " "
+ + PDFNumber.doubleOut(vals[1]) + " l\n");
+ break;
+ case PathIterator.SEG_MOVETO:
+ currentStream.write(PDFNumber.doubleOut(vals[0]) + " "
+ + PDFNumber.doubleOut(vals[1]) + " m\n");
+ break;
+ case PathIterator.SEG_QUADTO:
+ currentStream.write(PDFNumber.doubleOut(vals[0]) + " "
+ + PDFNumber.doubleOut(vals[1]) + " "
+ + PDFNumber.doubleOut(vals[2]) + " "
+ + PDFNumber.doubleOut(vals[3]) + " y\n");
+ break;
+ case PathIterator.SEG_CLOSE:
+ currentStream.write("h\n");
+ break;
+ default:
+ break;
}
iter.next();
}
@@ -468,33 +491,33 @@ public class PDFGraphics2D extends AbstractGraphics2D {
double vals[] = new double[6];
int type = iter.currentSegment(vals);
switch (type) {
- case PathIterator.SEG_CUBICTO:
- currentStream.write(PDFNumber.doubleOut(vals[0]) +
- " " + PDFNumber.doubleOut(vals[1]) + " " +
- PDFNumber.doubleOut(vals[2]) + " " +
- PDFNumber.doubleOut(vals[3]) + " " +
- PDFNumber.doubleOut(vals[4]) + " " +
- PDFNumber.doubleOut(vals[5]) + " c\n");
- break;
- case PathIterator.SEG_LINETO:
- currentStream.write(PDFNumber.doubleOut(vals[0]) +
- " " + PDFNumber.doubleOut(vals[1]) + " l\n");
- break;
- case PathIterator.SEG_MOVETO:
- currentStream.write(PDFNumber.doubleOut(vals[0]) +
- " " + PDFNumber.doubleOut(vals[1]) + " m\n");
- break;
- case PathIterator.SEG_QUADTO:
- currentStream.write(PDFNumber.doubleOut(vals[0]) +
- " " + PDFNumber.doubleOut(vals[1]) + " " +
- PDFNumber.doubleOut(vals[2]) + " " +
- PDFNumber.doubleOut(vals[3]) + " y\n");
- break;
- case PathIterator.SEG_CLOSE:
- currentStream.write("h\n");
- break;
- default:
- break;
+ case PathIterator.SEG_CUBICTO:
+ currentStream.write(PDFNumber.doubleOut(vals[0]) + " "
+ + PDFNumber.doubleOut(vals[1]) + " "
+ + PDFNumber.doubleOut(vals[2]) + " "
+ + PDFNumber.doubleOut(vals[3]) + " "
+ + PDFNumber.doubleOut(vals[4]) + " "
+ + PDFNumber.doubleOut(vals[5]) + " c\n");
+ break;
+ case PathIterator.SEG_LINETO:
+ currentStream.write(PDFNumber.doubleOut(vals[0]) + " "
+ + PDFNumber.doubleOut(vals[1]) + " l\n");
+ break;
+ case PathIterator.SEG_MOVETO:
+ currentStream.write(PDFNumber.doubleOut(vals[0]) + " "
+ + PDFNumber.doubleOut(vals[1]) + " m\n");
+ break;
+ case PathIterator.SEG_QUADTO:
+ currentStream.write(PDFNumber.doubleOut(vals[0]) + " "
+ + PDFNumber.doubleOut(vals[1]) + " "
+ + PDFNumber.doubleOut(vals[2]) + " "
+ + PDFNumber.doubleOut(vals[3]) + " y\n");
+ break;
+ case PathIterator.SEG_CLOSE:
+ currentStream.write("h\n");
+ break;
+ default:
+ break;
}
iter.next();
}
@@ -505,41 +528,39 @@ public class PDFGraphics2D extends AbstractGraphics2D {
protected void applyColor(Color col, boolean fill) {
Color c = col;
- if (c.getColorSpace().getType() ==
- java.awt.color.ColorSpace.TYPE_RGB) {
- currentColour =
- new PDFColor(c.getRed(), c.getGreen(), c.getBlue());
+ if (c.getColorSpace().getType()
+ == java.awt.color.ColorSpace.TYPE_RGB) {
+ currentColour = new PDFColor(c.getRed(), c.getGreen(),
+ c.getBlue());
currentStream.write(currentColour.getColorSpaceOut(fill));
- } else if (c.getColorSpace().getType() ==
- java.awt.color.ColorSpace.TYPE_CMYK) {
+ } else if (c.getColorSpace().getType()
+ == java.awt.color.ColorSpace.TYPE_CMYK) {
float[] cComps = c.getColorComponents(new float[3]);
double[] cmyk = new double[3];
for (int i = 0; i < 3; i++) {
// convert the float elements to doubles for pdf
cmyk[i] = cComps[i];
}
- currentColour =
- new PDFColor(cmyk[0], cmyk[1], cmyk[2], cmyk[3]);
+ currentColour = new PDFColor(cmyk[0], cmyk[1], cmyk[2], cmyk[3]);
currentStream.write(currentColour.getColorSpaceOut(fill));
- } else if (c.getColorSpace().getType() ==
- java.awt.color.ColorSpace.TYPE_2CLR) {
+ } else if (c.getColorSpace().getType()
+ == java.awt.color.ColorSpace.TYPE_2CLR) {
// used for black/magenta
float[] cComps = c.getColorComponents(new float[1]);
double[] blackMagenta = new double[1];
for (int i = 0; i < 1; i++) {
blackMagenta[i] = cComps[i];
}
- //currentColour = new PDFColor(blackMagenta[0], blackMagenta[1]);
+ // currentColour = new PDFColor(blackMagenta[0], blackMagenta[1]);
currentStream.write(currentColour.getColorSpaceOut(fill));
- }
- else {
+ } else {
System.err.println("Color Space not supported by PDFGraphics2D");
}
}
protected void applyPaint(Paint paint, boolean fill) {
if (paint instanceof GradientPaint) {
- GradientPaint gp = (GradientPaint) paint;
+ GradientPaint gp = (GradientPaint)paint;
Color c1 = gp.getColor1();
Color c2 = gp.getColor2();
Point2D p1 = gp.getPoint1();
@@ -581,61 +602,58 @@ public class PDFGraphics2D extends AbstractGraphics2D {
c2.getBlue());
someColors.addElement(color2);
- PDFFunction myfunc =
- this.pdfDoc.makeFunction(2, theDomain, null,
- color1.getVector(), color2.getVector(), 1.0);
+ PDFFunction myfunc = this.pdfDoc.makeFunction(2, theDomain, null,
+ color1.getVector(), color2.getVector(), 1.0);
ColorSpace aColorSpace = new ColorSpace(ColorSpace.DEVICE_RGB);
- PDFPattern myPat =
- this.pdfDoc.createGradient(false, aColorSpace,
- someColors, null, theCoords);
+ PDFPattern myPat = this.pdfDoc.createGradient(false, aColorSpace,
+ someColors, null, theCoords);
currentStream.write(myPat.getColorSpaceOut(fill));
- } else if (paint instanceof TexturePaint) {
- }
+ } else if (paint instanceof TexturePaint) {}
}
protected void applyStroke(Stroke stroke) {
if (stroke instanceof BasicStroke) {
- BasicStroke bs = (BasicStroke) stroke;
+ BasicStroke bs = (BasicStroke)stroke;
float[] da = bs.getDashArray();
if (da != null) {
currentStream.write("[");
for (int count = 0; count < da.length; count++) {
- currentStream.write("" + ((int) da[count]));
+ currentStream.write("" + ((int)da[count]));
if (count < da.length - 1) {
currentStream.write(" ");
}
}
currentStream.write("] ");
float offset = bs.getDashPhase();
- currentStream.write(((int) offset) + " d\n");
+ currentStream.write(((int)offset) + " d\n");
}
int ec = bs.getEndCap();
switch (ec) {
- case BasicStroke.CAP_BUTT:
- currentStream.write(0 + " J\n");
- break;
- case BasicStroke.CAP_ROUND:
- currentStream.write(1 + " J\n");
- break;
- case BasicStroke.CAP_SQUARE:
- currentStream.write(2 + " J\n");
- break;
+ case BasicStroke.CAP_BUTT:
+ currentStream.write(0 + " J\n");
+ break;
+ case BasicStroke.CAP_ROUND:
+ currentStream.write(1 + " J\n");
+ break;
+ case BasicStroke.CAP_SQUARE:
+ currentStream.write(2 + " J\n");
+ break;
}
int lj = bs.getLineJoin();
switch (lj) {
- case BasicStroke.JOIN_MITER:
- currentStream.write(0 + " j\n");
- break;
- case BasicStroke.JOIN_ROUND:
- currentStream.write(1 + " j\n");
- break;
- case BasicStroke.JOIN_BEVEL:
- currentStream.write(2 + " j\n");
- break;
+ case BasicStroke.JOIN_MITER:
+ currentStream.write(0 + " j\n");
+ break;
+ case BasicStroke.JOIN_ROUND:
+ currentStream.write(1 + " j\n");
+ break;
+ case BasicStroke.JOIN_BEVEL:
+ currentStream.write(2 + " j\n");
+ break;
}
float lw = bs.getLineWidth();
currentStream.write(PDFNumber.doubleOut(lw) + " w\n");
@@ -665,8 +683,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* @see #clip
* @see #setClip
*/
- public void drawRenderedImage(RenderedImage img,
- AffineTransform xform) {
+ public void drawRenderedImage(RenderedImage img, AffineTransform xform) {
System.out.println("drawRenderedImage");
}
@@ -683,7 +700,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* <code>Transform</code>, and <code>Composite</code> attributes. Note
* that no rendering is done if the specified transform is
* noninvertible.
- *<p>
+ * <p>
* Rendering hints set on the <code>Graphics2D</code> object might
* be used in rendering the <code>RenderableImage</code>.
* If explicit control is required over specific hints recognized by a
@@ -691,7 +708,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* are used is required, then a <code>RenderedImage</code> should be
* obtained directly from the <code>RenderableImage</code>
* and rendered using
- *{@link #drawRenderedImage(RenderedImage, AffineTransform) drawRenderedImage}.
+ * {@link #drawRenderedImage(RenderedImage, AffineTransform) drawRenderedImage}.
* @param img the image to be rendered
* @param xform the transformation from image space into user space
* @see #transform
@@ -729,7 +746,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* @see #setClip
*/
public void drawString(String s, float x, float y) {
- //System.out.println("drawString(String)");
+ // System.out.println("drawString(String)");
currentStream.write("BT\n");
Shape imclip = getClip();
@@ -748,18 +765,18 @@ public class PDFGraphics2D extends AbstractGraphics2D {
String style = gFont.isItalic() ? "italic" : "normal";
String weight = gFont.isBold() ? "bold" : "normal";
try {
- fontState = new FontState(fontState.getFontInfo(), name,
- style, weight, size * 1000, 0);
+ fontState = new FontState(fontState.getFontInfo(), name, style,
+ weight, size * 1000, 0);
} catch (org.apache.fop.apps.FOPException fope) {
fope.printStackTrace();
}
name = fontState.getFontName();
size = fontState.getFontSize() / 1000;
- //System.out.println("ffn:" + gFont.getFontName() + "fn:" + gFont.getName() + " ff:" + gFont.getFamily() + " fs:" + fontState.getFontName());
+ // System.out.println("ffn:" + gFont.getFontName() + "fn:" + gFont.getName() + " ff:" + gFont.getFamily() + " fs:" + fontState.getFontName());
- if ((!name.equals(this.currentFontName)) ||
- (size != this.currentFontSize)) {
+ if ((!name.equals(this.currentFontName))
+ || (size != this.currentFontSize)) {
this.currentFontName = name;
this.currentFontSize = size;
currentStream.write("/" + name + " " + size + " Tf\n");
@@ -770,12 +787,13 @@ public class PDFGraphics2D extends AbstractGraphics2D {
double[] vals = new double[6];
trans.getMatrix(vals);
- currentStream.write(PDFNumber.doubleOut(vals[0]) + " " +
- PDFNumber.doubleOut(vals[1]) + " " +
- PDFNumber.doubleOut(vals[2]) + " " +
- PDFNumber.doubleOut(-vals[3]) + " " +
- PDFNumber.doubleOut(vals[4]) + " " +
- PDFNumber.doubleOut(vals[5]) + " Tm (" + s + ") Tj\n");
+ currentStream.write(PDFNumber.doubleOut(vals[0]) + " "
+ + PDFNumber.doubleOut(vals[1]) + " "
+ + PDFNumber.doubleOut(vals[2]) + " "
+ + PDFNumber.doubleOut(-vals[3]) + " "
+ + PDFNumber.doubleOut(vals[4]) + " "
+ + PDFNumber.doubleOut(vals[5]) + " Tm (" + s
+ + ") Tj\n");
currentStream.write("ET\n");
}
@@ -803,8 +821,8 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* @see #setComposite
* @see #setClip
*/
- public void drawString(AttributedCharacterIterator iterator,
- float x, float y) {
+ public void drawString(AttributedCharacterIterator iterator, float x,
+ float y) {
System.err.println("drawString(AttributedCharacterIterator)");
currentStream.write("BT\n");
@@ -826,21 +844,22 @@ public class PDFGraphics2D extends AbstractGraphics2D {
String name = fontState.getFontName();
int size = fontState.getFontSize();
- if ((!name.equals(this.currentFontName)) ||
- (size != this.currentFontSize)) {
+ if ((!name.equals(this.currentFontName))
+ || (size != this.currentFontSize)) {
this.currentFontName = name;
this.currentFontSize = size;
- currentStream.write("/" + name + " " + (size / 1000) +
- " Tf\n");
+ currentStream.write("/" + name + " " + (size / 1000)
+ + " Tf\n");
}
- currentStream.write(PDFNumber.doubleOut(vals[0]) + " " +
- PDFNumber.doubleOut(vals[1]) + " " +
- PDFNumber.doubleOut(vals[2]) + " " +
- PDFNumber.doubleOut(vals[3]) + " " +
- PDFNumber.doubleOut(vals[4]) + " " +
- PDFNumber.doubleOut(vals[5]) + " Tm (" + ch + ") Tj\n");
+ currentStream.write(PDFNumber.doubleOut(vals[0]) + " "
+ + PDFNumber.doubleOut(vals[1]) + " "
+ + PDFNumber.doubleOut(vals[2]) + " "
+ + PDFNumber.doubleOut(vals[3]) + " "
+ + PDFNumber.doubleOut(vals[4]) + " "
+ + PDFNumber.doubleOut(vals[5]) + " Tm (" + ch
+ + ") Tj\n");
}
currentStream.write("ET\n");
@@ -861,7 +880,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* @see #setClip
*/
public void fill(Shape s) {
- //System.err.println("fill");
+ // System.err.println("fill");
currentStream.write("q\n");
Shape imclip = getClip();
writeClip(imclip);
@@ -877,33 +896,33 @@ public class PDFGraphics2D extends AbstractGraphics2D {
double vals[] = new double[6];
int type = iter.currentSegment(vals);
switch (type) {
- case PathIterator.SEG_CUBICTO:
- currentStream.write(PDFNumber.doubleOut(vals[0]) +
- " " + PDFNumber.doubleOut(vals[1]) + " " +
- PDFNumber.doubleOut(vals[2]) + " " +
- PDFNumber.doubleOut(vals[3]) + " " +
- PDFNumber.doubleOut(vals[4]) + " " +
- PDFNumber.doubleOut(vals[5]) + " c\n");
- break;
- case PathIterator.SEG_LINETO:
- currentStream.write(PDFNumber.doubleOut(vals[0]) +
- " " + PDFNumber.doubleOut(vals[1]) + " l\n");
- break;
- case PathIterator.SEG_MOVETO:
- currentStream.write(PDFNumber.doubleOut(vals[0]) +
- " " + PDFNumber.doubleOut(vals[1]) + " m\n");
- break;
- case PathIterator.SEG_QUADTO:
- currentStream.write(PDFNumber.doubleOut(vals[0]) +
- " " + PDFNumber.doubleOut(vals[1]) + " " +
- PDFNumber.doubleOut(vals[2]) + " " +
- PDFNumber.doubleOut(vals[3]) + " y\n");
- break;
- case PathIterator.SEG_CLOSE:
- currentStream.write("h\n");
- break;
- default:
- break;
+ case PathIterator.SEG_CUBICTO:
+ currentStream.write(PDFNumber.doubleOut(vals[0]) + " "
+ + PDFNumber.doubleOut(vals[1]) + " "
+ + PDFNumber.doubleOut(vals[2]) + " "
+ + PDFNumber.doubleOut(vals[3]) + " "
+ + PDFNumber.doubleOut(vals[4]) + " "
+ + PDFNumber.doubleOut(vals[5]) + " c\n");
+ break;
+ case PathIterator.SEG_LINETO:
+ currentStream.write(PDFNumber.doubleOut(vals[0]) + " "
+ + PDFNumber.doubleOut(vals[1]) + " l\n");
+ break;
+ case PathIterator.SEG_MOVETO:
+ currentStream.write(PDFNumber.doubleOut(vals[0]) + " "
+ + PDFNumber.doubleOut(vals[1]) + " m\n");
+ break;
+ case PathIterator.SEG_QUADTO:
+ currentStream.write(PDFNumber.doubleOut(vals[0]) + " "
+ + PDFNumber.doubleOut(vals[1]) + " "
+ + PDFNumber.doubleOut(vals[2]) + " "
+ + PDFNumber.doubleOut(vals[3]) + " y\n");
+ break;
+ case PathIterator.SEG_CLOSE:
+ currentStream.write("h\n");
+ break;
+ default:
+ break;
}
iter.next();
}
@@ -912,8 +931,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
currentStream.write("Q\n");
}
- protected void doDrawing(boolean fill, boolean stroke,
- boolean nonzero) {
+ protected void doDrawing(boolean fill, boolean stroke, boolean nonzero) {
if (fill) {
if (stroke) {
if (nonzero)
@@ -927,7 +945,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
currentStream.write("f\n");
}
} else {
- //if(stroke)
+ // if(stroke)
currentStream.write("S\n");
}
}
@@ -946,18 +964,18 @@ public class PDFGraphics2D extends AbstractGraphics2D {
*/
static class PDFGraphicsConfiguration extends GraphicsConfiguration {
// We use this to get a good colormodel..
- static BufferedImage BIWithAlpha =
- new BufferedImage (1, 1, BufferedImage.TYPE_INT_ARGB);
+ static BufferedImage BIWithAlpha = new BufferedImage(1, 1,
+ BufferedImage.TYPE_INT_ARGB);
// We use this to get a good colormodel..
- static BufferedImage BIWithOutAlpha =
- new BufferedImage (1, 1, BufferedImage.TYPE_INT_RGB);
+ static BufferedImage BIWithOutAlpha = new BufferedImage(1, 1,
+ BufferedImage.TYPE_INT_RGB);
/**
* Construct a buffered image with an alpha channel, unless
* transparencty is OPAQUE (no alpha at all).
*/
- public BufferedImage createCompatibleImage(int width,
- int height, int transparency) {
+ public BufferedImage createCompatibleImage(int width, int height,
+ int transparency) {
if (transparency == Transparency.OPAQUE)
return new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
@@ -1023,6 +1041,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
public GraphicsDevice getDevice() {
return new PDFGraphicsDevice(this);
}
+
}
/**
@@ -1032,7 +1051,9 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* I suppose).
*/
static class PDFGraphicsDevice extends GraphicsDevice {
- /** The Graphics Config that created us...
+
+ /**
+ * The Graphics Config that created us...
*/
GraphicsConfiguration gc;
@@ -1046,34 +1067,40 @@ public class PDFGraphics2D extends AbstractGraphics2D {
/**
* Ignore template and return the only config we have
*/
- public GraphicsConfiguration getBestConfiguration (
- GraphicsConfigTemplate gct) {
+ public GraphicsConfiguration getBestConfiguration(GraphicsConfigTemplate gct) {
return gc;
}
+
/**
* Return an array of our one GraphicsConfig
*/
public GraphicsConfiguration[] getConfigurations() {
- return new GraphicsConfiguration[]{ gc };
+ return new GraphicsConfiguration[] {
+ gc
+ };
}
+
/**
* Return out sole GraphicsConfig.
*/
public GraphicsConfiguration getDefaultConfiguration() {
return gc;
}
+
/**
* Generate an IdString..
*/
public String getIDstring() {
return toString();
}
+
/**
* Let the caller know that we are "a printer"
*/
public int getType() {
return GraphicsDevice.TYPE_PRINTER;
}
+
}
/**
@@ -1082,8 +1109,8 @@ public class PDFGraphics2D extends AbstractGraphics2D {
private Graphics2D fmg;
{
- BufferedImage bi =
- new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
+ BufferedImage bi = new BufferedImage(1, 1,
+ BufferedImage.TYPE_INT_ARGB);
fmg = bi.createGraphics();
}
diff --git a/src/org/apache/fop/svg/PDFTextPainter.java b/src/org/apache/fop/svg/PDFTextPainter.java
index a7435cb0f..db9ed1b92 100644
--- a/src/org/apache/fop/svg/PDFTextPainter.java
+++ b/src/org/apache/fop/svg/PDFTextPainter.java
@@ -1,10 +1,9 @@
-/*****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- *****************************************************************************/
+/*
+ * $Id$
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources.
+ */
package org.apache.fop.svg;
@@ -56,12 +55,12 @@ public class PDFTextPainter implements TextPainter {
*/
public void paint(TextNode node, Graphics2D g2d,
GraphicsNodeRenderContext context) {
- //System.out.println("PDFText paint");
+ // System.out.println("PDFText paint");
String txt = node.getText();
Point2D loc = node.getLocation();
AttributedCharacterIterator aci =
- node.getAttributedCharacterIterator();
+ node.getAttributedCharacterIterator();
// reset position to start of char iterator
if (aci.getBeginIndex() == aci.getEndIndex()) {
return;
@@ -70,46 +69,46 @@ public class PDFTextPainter implements TextPainter {
if (ch == AttributedCharacterIterator.DONE) {
return;
}
- TextNode.Anchor anchor = (TextNode.Anchor) aci.getAttribute(
- GVTAttributedCharacterIterator.TextAttribute.ANCHOR_TYPE);
-
- Vector gvtFonts = (Vector) aci.getAttribute(
- GVTAttributedCharacterIterator.TextAttribute.GVT_FONT_FAMILIES);
- Paint forg = (Paint) aci.getAttribute(TextAttribute.FOREGROUND);
- Float size = (Float) aci.getAttribute(TextAttribute.SIZE);
- Stroke stroke = (Stroke) aci.getAttribute(
- GVTAttributedCharacterIterator.TextAttribute.STROKE);
- Float xpos = (Float) aci.getAttribute(
- GVTAttributedCharacterIterator.TextAttribute.X);
- Float ypos = (Float) aci.getAttribute(
- GVTAttributedCharacterIterator.TextAttribute.Y);
-
- Float posture = (Float) aci.getAttribute(TextAttribute.POSTURE);
- Float taWeight = (Float) aci.getAttribute(TextAttribute.WEIGHT);
+ TextNode.Anchor anchor =
+ (TextNode.Anchor)aci.getAttribute(GVTAttributedCharacterIterator.TextAttribute.ANCHOR_TYPE);
+
+ Vector gvtFonts =
+ (Vector)aci.getAttribute(GVTAttributedCharacterIterator.TextAttribute.GVT_FONT_FAMILIES);
+ Paint forg = (Paint)aci.getAttribute(TextAttribute.FOREGROUND);
+ Float size = (Float)aci.getAttribute(TextAttribute.SIZE);
+ Stroke stroke =
+ (Stroke)aci.getAttribute(GVTAttributedCharacterIterator.TextAttribute.STROKE);
+ Float xpos =
+ (Float)aci.getAttribute(GVTAttributedCharacterIterator.TextAttribute.X);
+ Float ypos =
+ (Float)aci.getAttribute(GVTAttributedCharacterIterator.TextAttribute.Y);
+
+ Float posture = (Float)aci.getAttribute(TextAttribute.POSTURE);
+ Float taWeight = (Float)aci.getAttribute(TextAttribute.WEIGHT);
if (forg instanceof Color) {
- g2d.setColor((Color) forg);
+ g2d.setColor((Color)forg);
}
g2d.setPaint(forg);
g2d.setStroke(stroke);
- String style = ((posture != null) && (posture.floatValue() > 0.0)) ?
- "italic" : "normal";
- String weight = ((taWeight != null) &&
- (taWeight.floatValue() > 1.0)) ? "bold" : "normal";
+ String style = ((posture != null) && (posture.floatValue() > 0.0))
+ ? "italic" : "normal";
+ String weight = ((taWeight != null) && (taWeight.floatValue() > 1.0))
+ ? "bold" : "normal";
FontInfo fi = fontState.getFontInfo();
boolean found = false;
if (gvtFonts != null) {
- for (Enumeration e = gvtFonts.elements();
- e.hasMoreElements();) {
- GVTFontFamily fam = (GVTFontFamily) e.nextElement();
+ for (Enumeration e = gvtFonts.elements(); e.hasMoreElements(); ) {
+ GVTFontFamily fam = (GVTFontFamily)e.nextElement();
String name = fam.getFamilyName();
if (fi.hasFont(name, weight, style)) {
try {
- int fsize = (int) size.floatValue();
+ int fsize = (int)size.floatValue();
fontState = new FontState(fontState.getFontInfo(),
- name, style, weight, fsize * 1000, 0);
+ name, style, weight,
+ fsize * 1000, 0);
} catch (org.apache.fop.apps.FOPException fope) {
fope.printStackTrace();
}
@@ -120,7 +119,7 @@ public class PDFTextPainter implements TextPainter {
}
if (!found) {
try {
- int fsize = (int) size.floatValue();
+ int fsize = (int)size.floatValue();
fontState = new FontState(fontState.getFontInfo(), "any",
style, weight, fsize * 1000, 0);
} catch (org.apache.fop.apps.FOPException fope) {
@@ -151,11 +150,11 @@ public class PDFTextPainter implements TextPainter {
float tx = 0;
if (anchor != null) {
switch (anchor.getType()) {
- case TextNode.Anchor.ANCHOR_MIDDLE:
- tx = -advance / 2;
- break;
- case TextNode.Anchor.ANCHOR_END:
- tx = -advance;
+ case TextNode.Anchor.ANCHOR_MIDDLE:
+ tx = -advance / 2;
+ break;
+ case TextNode.Anchor.ANCHOR_END:
+ tx = -advance;
}
}
g2d.drawString(txt, (float)(loc.getX() + tx), (float)(loc.getY()));
@@ -184,17 +183,16 @@ public class PDFTextPainter implements TextPainter {
* Initiates a text selection on a particular AttributedCharacterIterator,
* using the text/font metrics employed by this TextPainter instance.
* @param x the x coordinate, in the text layout's coordinate system,
- * of the selection event.
+ * of the selection event.
* @param y the y coordinate, in the text layout's coordinate system,
- * of the selection event.
+ * of the selection event.
* @param aci the AttributedCharacterIterator describing the text
* @param context the GraphicsNodeRenderContext to use when doing text layout.
* @return an instance of Mark which encapsulates the state necessary to
* implement hit testing and text selection.
*/
- public Mark selectAt(double x, double y,
- AttributedCharacterIterator aci, TextNode node,
- GraphicsNodeRenderContext context) {
+ public Mark selectAt(double x, double y, AttributedCharacterIterator aci,
+ TextNode node, GraphicsNodeRenderContext context) {
System.out.println("PDFText selectAt");
return null;
}
@@ -203,9 +201,9 @@ public class PDFTextPainter implements TextPainter {
* Continues a text selection on a particular AttributedCharacterIterator,
* using the text/font metrics employed by this TextPainter instance.
* @param x the x coordinate, in the text layout's coordinate system,
- * of the selection event.
+ * of the selection event.
* @param y the y coordinate, in the text layout's coordinate system,
- * of the selection event.
+ * of the selection event.
* @param aci the AttributedCharacterIterator describing the text
* @param context the GraphicsNodeRenderContext to use when doing text layout.
* @return an instance of Mark which encapsulates the state necessary to
@@ -222,9 +220,9 @@ public class PDFTextPainter implements TextPainter {
* Select all of the text represented by an AttributedCharacterIterator,
* using the text/font metrics employed by this TextPainter instance.
* @param x the x coordinate, in the text layout's coordinate system,
- * of the selection event.
+ * of the selection event.
* @param y the y coordinate, in the text layout's coordinate system,
- * of the selection event.
+ * of the selection event.
* @param aci the AttributedCharacterIterator describing the text
* @param context the GraphicsNodeRenderContext to use when doing text layout.
* @return an instance of Mark which encapsulates the state necessary to
@@ -268,8 +266,8 @@ public class PDFTextPainter implements TextPainter {
* selectTo(), since the TextPainter implementation may rely on hidden
* implementation details of its own Mark implementation.
*/
- public int[] getSelected(AttributedCharacterIterator aci,
- Mark start, Mark finish) {
+ public int[] getSelected(AttributedCharacterIterator aci, Mark start,
+ Mark finish) {
System.out.println("PDFText getSelected");
return null;
}
@@ -294,9 +292,9 @@ public class PDFTextPainter implements TextPainter {
* @param node the TextNode to measure
* @param frc the font rendering context.
* @param includeDecoration whether to include text decoration
- * outlines.
+ * outlines.
* @param includeStroke whether to create the "stroke shape outlines"
- * instead of glyph outlines.
+ * instead of glyph outlines.
*/
public Shape getShape(TextNode node, FontRenderContext frc) {
System.out.println("PDFText getShape");
@@ -308,9 +306,9 @@ public class PDFTextPainter implements TextPainter {
* @param node the TextNode to measure
* @param frc the font rendering context.
* @param includeDecoration whether to include text decoration
- * outlines.
+ * outlines.
* @param includeStroke whether to create the "stroke shape outlines"
- * instead of glyph outlines.
+ * instead of glyph outlines.
*/
public Shape getDecoratedShape(TextNode node, FontRenderContext frc) {
System.out.println("PDFText getDecoratedShape");
@@ -353,8 +351,9 @@ public class PDFTextPainter implements TextPainter {
*/
public Rectangle2D getPaintedBounds(TextNode node,
FontRenderContext frc) {
- //System.out.println("PDFText getPaintedBounds");
+ // System.out.println("PDFText getPaintedBounds");
return null;
}
+
}
diff --git a/src/org/apache/fop/svg/PDFTranscoder.java b/src/org/apache/fop/svg/PDFTranscoder.java
index dedd179a9..5ceb4f3b2 100644
--- a/src/org/apache/fop/svg/PDFTranscoder.java
+++ b/src/org/apache/fop/svg/PDFTranscoder.java
@@ -1,4 +1,5 @@
-/* $Id$
+/*
+ * $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -130,7 +131,9 @@ public class PDFTranscoder extends XMLAbstractTranscoder {
public static final TranscodingHints.Key KEY_STROKE_TEXT =
new StringKey();
- /** The user agent dedicated to an <tt>ImageTranscoder</tt>. */
+ /**
+ * The user agent dedicated to an <tt>ImageTranscoder</tt>.
+ */
protected UserAgent userAgent = new ImageTranscoderUserAgent();
/**
@@ -156,21 +159,20 @@ public class PDFTranscoder extends XMLAbstractTranscoder {
TranscoderOutput output) throws TranscoderException {
if (!(document instanceof SVGOMDocument)) {
- throw new TranscoderException(
- Messages.formatMessage("notsvg", null));
+ throw new TranscoderException(Messages.formatMessage("notsvg",
+ null));
}
- SVGDocument svgDoc = (SVGDocument) document;
+ SVGDocument svgDoc = (SVGDocument)document;
SVGSVGElement root = svgDoc.getRootElement();
// initialize the SVG document with the appropriate context
- String parserClassname =
- (String) hints.get(KEY_XML_PARSER_CLASSNAME);
+ String parserClassname = (String)hints.get(KEY_XML_PARSER_CLASSNAME);
DefaultSVGContext svgCtx = new DefaultSVGContext();
svgCtx.setPixelToMM(userAgent.getPixelToMM());
- ((SVGOMDocument) document).setSVGContext(svgCtx);
+ ((SVGOMDocument)document).setSVGContext(svgCtx);
boolean stroke = true;
if (hints.containsKey(KEY_STROKE_TEXT)) {
- stroke = ((Boolean) hints.get(KEY_STROKE_TEXT)).booleanValue();
+ stroke = ((Boolean)hints.get(KEY_STROKE_TEXT)).booleanValue();
}
// build the GVT tree
@@ -187,21 +189,21 @@ public class PDFTranscoder extends XMLAbstractTranscoder {
throw new TranscoderException(ex);
}
// get the 'width' and 'height' attributes of the SVG document
- float docWidth = (float) ctx.getDocumentSize().getWidth();
- float docHeight = (float) ctx.getDocumentSize().getHeight();
+ float docWidth = (float)ctx.getDocumentSize().getWidth();
+ float docHeight = (float)ctx.getDocumentSize().getHeight();
ctx = null;
builder = null;
// compute the image's width and height according the hints
float imgWidth = -1;
if (hints.containsKey(ImageTranscoder.KEY_WIDTH)) {
- imgWidth = ((Float) hints.get(ImageTranscoder.KEY_WIDTH)).
- floatValue();
+ imgWidth =
+ ((Float)hints.get(ImageTranscoder.KEY_WIDTH)).floatValue();
}
float imgHeight = -1;
if (hints.containsKey(ImageTranscoder.KEY_HEIGHT)) {
- imgHeight = ((Float) hints.get(ImageTranscoder.KEY_HEIGHT)).
- floatValue();
+ imgHeight =
+ ((Float)hints.get(ImageTranscoder.KEY_HEIGHT)).floatValue();
}
float width, height;
if (imgWidth > 0 && imgHeight > 0) {
@@ -242,8 +244,7 @@ public class PDFTranscoder extends XMLAbstractTranscoder {
}
// take the AOI into account if any
if (hints.containsKey(ImageTranscoder.KEY_AOI)) {
- Rectangle2D aoi =
- (Rectangle2D) hints.get(ImageTranscoder.KEY_AOI);
+ Rectangle2D aoi = (Rectangle2D)hints.get(ImageTranscoder.KEY_AOI);
// transform the AOI into the image's coordinate system
aoi = Px.createTransformedShape(aoi).getBounds2D();
AffineTransform Mx = new AffineTransform();
@@ -258,11 +259,11 @@ public class PDFTranscoder extends XMLAbstractTranscoder {
Px.preConcatenate(Mx);
}
// prepare the image to be painted
- int w = (int) width;
- int h = (int) height;
+ int w = (int)width;
+ int h = (int)height;
PDFDocumentGraphics2D graphics = new PDFDocumentGraphics2D(stroke,
- output.getOutputStream(), w, h);
+ output.getOutputStream(), w, h);
graphics.setSVGDimension(docWidth, docHeight);
if (!stroke) {
@@ -273,11 +274,9 @@ public class PDFTranscoder extends XMLAbstractTranscoder {
pdfAElementBridge.setPDFGraphics2D(graphics);
if (hints.containsKey(ImageTranscoder.KEY_BACKGROUND_COLOR)) {
- graphics.setBackgroundColor( (Color) hints.get(
- ImageTranscoder.KEY_BACKGROUND_COLOR));
+ graphics.setBackgroundColor((Color)hints.get(ImageTranscoder.KEY_BACKGROUND_COLOR));
}
- graphics.setGraphicContext(
- new org.apache.batik.ext.awt.g2d.GraphicContext());
+ graphics.setGraphicContext(new org.apache.batik.ext.awt.g2d.GraphicContext());
graphics.setRenderingHints(rc.getRenderingHints());
gvtRoot.paint(graphics, rc);
@@ -301,18 +300,18 @@ public class PDFTranscoder extends XMLAbstractTranscoder {
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
FontRenderContext fontRenderContext =
- new FontRenderContext(new AffineTransform(), true,
- true);
+ new FontRenderContext(new AffineTransform(), true, true);
TextPainter textPainter = null;
textPainter = new StrokingTextPainter();
GraphicsNodeRableFactory gnrFactory =
- new ConcreteGraphicsNodeRableFactory();
+ new ConcreteGraphicsNodeRableFactory();
- nodeRenderContext = new GraphicsNodeRenderContext(
- new AffineTransform(), null, hints,
- fontRenderContext, textPainter, gnrFactory);
+ nodeRenderContext =
+ new GraphicsNodeRenderContext(new AffineTransform(), null,
+ hints, fontRenderContext,
+ textPainter, gnrFactory);
}
return nodeRenderContext;
@@ -326,8 +325,8 @@ public class PDFTranscoder extends XMLAbstractTranscoder {
* @param domImpl the DOM Implementation (not used)
* @param parserClassname the XML parser classname
*/
- protected DocumentFactory createDocumentFactory(
- DOMImplementation domImpl, String parserClassname) {
+ protected DocumentFactory createDocumentFactory(DOMImplementation domImpl,
+ String parserClassname) {
return new SAXSVGDocumentFactory(parserClassname);
}
@@ -374,8 +373,7 @@ public class PDFTranscoder extends XMLAbstractTranscoder {
*/
public void displayMessage(String message) {
try {
- getErrorHandler().warning(
- new TranscoderException(message));
+ getErrorHandler().warning(new TranscoderException(message));
} catch (TranscoderException ex) {
throw new RuntimeException();
}
@@ -386,13 +384,11 @@ public class PDFTranscoder extends XMLAbstractTranscoder {
* <tt>TranscodingHints</tt> or 0.3528 if any.
*/
public float getPixelToMM() {
- if (getTranscodingHints().containsKey(
- ImageTranscoder.KEY_PIXEL_TO_MM)) {
- return ( (Float) getTranscodingHints().get(
- ImageTranscoder.KEY_PIXEL_TO_MM)).floatValue();
+ if (getTranscodingHints().containsKey(ImageTranscoder.KEY_PIXEL_TO_MM)) {
+ return ((Float)getTranscodingHints().get(ImageTranscoder.KEY_PIXEL_TO_MM)).floatValue();
} else {
// return 0.3528f; // 72 dpi
- return 0.26458333333333333333333333333333f; // 96dpi
+ return 0.26458333333333333333333333333333f; // 96dpi
}
}
@@ -401,10 +397,8 @@ public class PDFTranscoder extends XMLAbstractTranscoder {
* <tt>TranscodingHints</tt> or "en" (english) if any.
*/
public String getLanguages() {
- if (getTranscodingHints().containsKey(
- ImageTranscoder.KEY_LANGUAGE)) {
- return (String) getTranscodingHints().get(
- ImageTranscoder.KEY_LANGUAGE);
+ if (getTranscodingHints().containsKey(ImageTranscoder.KEY_LANGUAGE)) {
+ return (String)getTranscodingHints().get(ImageTranscoder.KEY_LANGUAGE);
} else {
return "en";
}
@@ -415,18 +409,15 @@ public class PDFTranscoder extends XMLAbstractTranscoder {
* <tt>TranscodingHints</tt> or null if any.
*/
public String getUserStyleSheetURI() {
- return (String) getTranscodingHints().get(
- ImageTranscoder.KEY_USER_STYLESHEET_URI);
+ return (String)getTranscodingHints().get(ImageTranscoder.KEY_USER_STYLESHEET_URI);
}
/**
* Returns the XML parser to use from the TranscodingHints.
*/
public String getXMLParserClassName() {
- if (getTranscodingHints().containsKey(
- KEY_XML_PARSER_CLASSNAME)) {
- return (String) getTranscodingHints().get(
- KEY_XML_PARSER_CLASSNAME);
+ if (getTranscodingHints().containsKey(KEY_XML_PARSER_CLASSNAME)) {
+ return (String)getTranscodingHints().get(KEY_XML_PARSER_CLASSNAME);
} else {
return XMLResourceDescriptor.getXMLParserClassName();
}
@@ -442,17 +433,17 @@ public class PDFTranscoder extends XMLAbstractTranscoder {
/**
* Unsupported operation.
*/
- public void openLink(SVGAElement elt) { }
+ public void openLink(SVGAElement elt) {}
/**
* Unsupported operation.
*/
- public void setSVGCursor(Cursor cursor) { }
+ public void setSVGCursor(Cursor cursor) {}
/**
* Unsupported operation.
*/
- public void runThread(Thread t) { }
+ public void runThread(Thread t) {}
/**
* Unsupported operation.
@@ -484,8 +475,8 @@ public class PDFTranscoder extends XMLAbstractTranscoder {
return false;
}
- public void registerExtension(BridgeExtension be) {
- }
+ public void registerExtension(BridgeExtension be) {}
+
}
protected final static Set FEATURES = new HashSet();
diff --git a/src/org/apache/fop/svg/SVGArea.java b/src/org/apache/fop/svg/SVGArea.java
index ce1e5424a..d4845be84 100644
--- a/src/org/apache/fop/svg/SVGArea.java
+++ b/src/org/apache/fop/svg/SVGArea.java
@@ -1,4 +1,5 @@
-/* $Id$
+/*
+ * $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -30,9 +31,9 @@ public class SVGArea extends Area {
* @param height the height of the area
*/
public SVGArea(FontState fontState, float width, float height) {
- super(fontState, (int) width * 1000, (int) height * 1000);
- currentHeight = (int) height * 1000;
- contentRectangleWidth = (int) width * 1000;
+ super(fontState, (int)width * 1000, (int)height * 1000);
+ currentHeight = (int)height * 1000;
+ contentRectangleWidth = (int)width * 1000;
}
public void setSVGDocument(Document doc) {
@@ -44,7 +45,7 @@ public class SVGArea extends Area {
}
public int getWidth() {
- // return getSVGDocument().getRootElement().getWidth().getBaseVal().getValue();
+ // return getSVGDocument().getRootElement().getWidth().getBaseVal().getValue();
return contentRectangleWidth;
}
@@ -56,4 +57,5 @@ public class SVGArea extends Area {
public void render(Renderer renderer) {
renderer.renderSVGArea(this);
}
+
}
diff --git a/src/org/apache/fop/svg/SVGElement.java b/src/org/apache/fop/svg/SVGElement.java
index ad31bcdc4..91ef47bb0 100644
--- a/src/org/apache/fop/svg/SVGElement.java
+++ b/src/org/apache/fop/svg/SVGElement.java
@@ -1,4 +1,5 @@
-/* $Id$
+/*
+ * $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -48,6 +49,7 @@ public class SVGElement extends Svg {
PropertyList propertyList) throws FOPException {
return new SVGElement(parent, propertyList);
}
+
}
/**
@@ -103,27 +105,29 @@ public class SVGElement extends Svg {
try {
String baseDir = Configuration.getStringValue("baseDir");
((SVGOMDocument)doc).setURLObject(new URL(baseDir));
- } catch (Exception e) {
- }
+ } catch (Exception e) {}
DefaultSVGContext dc = new DefaultSVGContext() {
- public float getPixelToMM() {
- return 0.264583333333333333333f;
- // 72 dpi
- }
- public float getViewportWidth() {
- return 100;
- }
- public float getViewportHeight() {
- return 100;
- }
- };
+ public float getPixelToMM() {
+ return 0.264583333333333333333f;
+ // 72 dpi
+ }
+
+ public float getViewportWidth() {
+ return 100;
+ }
+
+ public float getViewportHeight() {
+ return 100;
+ }
+
+ };
((SVGOMDocument)doc).setSVGContext(dc);
buildTopLevel(doc, svgRoot);
- float width = ((SVGSVGElement) svgRoot).getWidth().getBaseVal().
- getValue();
- float height = ((SVGSVGElement) svgRoot).getHeight().getBaseVal().
- getValue();
+ float width =
+ ((SVGSVGElement)svgRoot).getWidth().getBaseVal().getValue();
+ float height =
+ ((SVGSVGElement)svgRoot).getHeight().getBaseVal().getValue();
SVGArea svg = new SVGArea(fs, width, height);
svg.setSVGDocument(doc);
svg.start();
@@ -132,7 +136,7 @@ public class SVGElement extends Svg {
svg.end();
/* add the SVG area to the containing area */
- ForeignObjectArea foa = (ForeignObjectArea) area;
+ ForeignObjectArea foa = (ForeignObjectArea)area;
foa.setObject(svg);
foa.setIntrinsicWidth(svg.getWidth());
foa.setIntrinsicHeight(svg.getHeight());
@@ -140,4 +144,5 @@ public class SVGElement extends Svg {
/* return status */
return new Status(Status.OK);
}
+
}
diff --git a/src/org/apache/fop/svg/SVGElementMapping.java b/src/org/apache/fop/svg/SVGElementMapping.java
index 3ff03ec5c..c6d876f61 100644
--- a/src/org/apache/fop/svg/SVGElementMapping.java
+++ b/src/org/apache/fop/svg/SVGElementMapping.java
@@ -1,4 +1,5 @@
-/* $Id$
+/*
+ * $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -60,8 +61,7 @@ public class SVGElementMapping implements ElementMapping {
builder.addMapping(uri, "set", Set.maker());
builder.addMapping(uri, "animateMotion", AnimateMotion.maker());
builder.addMapping(uri, "animateColor", AnimateColor.maker());
- builder.addMapping(uri, "animateTransform",
- AnimateTransform.maker());
+ builder.addMapping(uri, "animateTransform", AnimateTransform.maker());
builder.addMapping(uri, "cursor", Cursor.maker());
builder.addMapping(uri, "filter", Filter.maker());
@@ -72,14 +72,14 @@ public class SVGElementMapping implements ElementMapping {
builder.addMapping(uri, "feMergeNode", FeMergeNode.maker());
- builder.addPropertyList(uri,
- SVGPropertyMapping.getGenericMappings());
+ builder.addPropertyList(uri, SVGPropertyMapping.getGenericMappings());
/* Add any element mappings */
for (Enumeration e = SVGPropertyMapping.getElementMappings();
- e.hasMoreElements();) {
- String elem = (String) e.nextElement();
+ e.hasMoreElements(); ) {
+ String elem = (String)e.nextElement();
builder.addElementPropertyList(uri, elem,
SVGPropertyMapping.getElementMapping(elem));
}
}
+
}
diff --git a/src/org/apache/fop/svg/SVGObj.java b/src/org/apache/fop/svg/SVGObj.java
index 3b4c23814..2a215d730 100644
--- a/src/org/apache/fop/svg/SVGObj.java
+++ b/src/org/apache/fop/svg/SVGObj.java
@@ -1,4 +1,5 @@
-/* $Id$
+/*
+ * $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -28,5 +29,6 @@ public abstract class SVGObj extends XMLObj {
public String getNameSpace() {
return "http://www.w3.org/2000/svg";
}
+
}
diff --git a/src/org/apache/fop/svg/SVGStringProperty.java b/src/org/apache/fop/svg/SVGStringProperty.java
index 2937bdbd2..c483773f2 100644
--- a/src/org/apache/fop/svg/SVGStringProperty.java
+++ b/src/org/apache/fop/svg/SVGStringProperty.java
@@ -1,7 +1,8 @@
-/* $Id$
+/*
+ * $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
- * LICENSE file included with these sources."
+ * LICENSE file included with these sources.
*/
package org.apache.fop.svg;
@@ -47,10 +48,10 @@ public class SVGStringProperty extends Property {
*
* @param propertyList the property list the property is a member of
*/
- public Property make(PropertyList propertyList)
- throws FOPException {
+ public Property make(PropertyList propertyList) throws FOPException {
return make(propertyList, null, null);
}
+
}
/**
@@ -62,7 +63,9 @@ public class SVGStringProperty extends Property {
return new SVGStringProperty.Maker();
}
- /** the value */
+ /**
+ * the value
+ */
protected String value;
/**
@@ -84,4 +87,5 @@ public class SVGStringProperty extends Property {
public String getString() {
return this.value;
}
+
}
diff --git a/src/org/apache/fop/svg/SVGUtilities.java b/src/org/apache/fop/svg/SVGUtilities.java
index 051a5ebfd..fe854d271 100644
--- a/src/org/apache/fop/svg/SVGUtilities.java
+++ b/src/org/apache/fop/svg/SVGUtilities.java
@@ -1,4 +1,5 @@
-/* $Id$
+/*
+ * $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -35,8 +36,7 @@ public class SVGUtilities {
public static final Document createSVGDocument(float width,
float height) {
- DOMImplementation impl =
- SVGDOMImplementation.getDOMImplementation();
+ DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
Document doc = impl.createDocument(svgNS, "svg", null);
Element svgRoot = doc.getDocumentElement();
@@ -48,21 +48,24 @@ public class SVGUtilities {
/**
* Get the string width for a particular string given the font.
*/
- public static final float getStringWidth(String str,
- java.awt.Font font) {
- Rectangle2D rect = font.getStringBounds(str, 0, str.length(),
- new FontRenderContext(new AffineTransform(), true, true));
- return (float) rect.getWidth();
+ public static final float getStringWidth(String str, java.awt.Font font) {
+ Rectangle2D rect =
+ font.getStringBounds(str, 0, str.length(),
+ new FontRenderContext(new AffineTransform(),
+ true, true));
+ return (float)rect.getWidth();
}
/**
* Get the string height for a particular string given the font.
*/
public static final float getStringHeight(String str,
- java.awt.Font font) {
- Rectangle2D rect = font.getStringBounds(str, 0, str.length(),
- new FontRenderContext(new AffineTransform(), true, true));
- return (float) rect.getHeight();
+ java.awt.Font font) {
+ Rectangle2D rect =
+ font.getStringBounds(str, 0, str.length(),
+ new FontRenderContext(new AffineTransform(),
+ true, true));
+ return (float)rect.getHeight();
}
/**
@@ -71,14 +74,15 @@ public class SVGUtilities {
public static final Rectangle2D getStringBounds(String str,
java.awt.Font font) {
return font.getStringBounds(str, 0, str.length(),
- new FontRenderContext(new AffineTransform(), true, true));
+ new FontRenderContext(new AffineTransform(),
+ true, true));
}
/**
* Create an SVG Line
*/
- public static final Element createLine(Document doc, float x,
- float y, float x2, float y2) {
+ public static final Element createLine(Document doc, float x, float y,
+ float x2, float y2) {
Element ellipse = doc.createElementNS(svgNS, "line");
ellipse.setAttributeNS(null, "x1", "" + x);
ellipse.setAttributeNS(null, "x2", "" + x2);
@@ -91,7 +95,7 @@ public class SVGUtilities {
* Create an SVG Ellipse
*/
public static final Element createEllipse(Document doc, float cx,
- float cy, float rx, float ry) {
+ float cy, float rx, float ry) {
Element ellipse = doc.createElementNS(svgNS, "ellipse");
ellipse.setAttributeNS(null, "cx", "" + cx);
ellipse.setAttributeNS(null, "rx", "" + rx);
@@ -112,8 +116,8 @@ public class SVGUtilities {
/**
* Create an SVG Text object.
*/
- public static final Element createText(Document doc, float x,
- float y, String str) {
+ public static final Element createText(Document doc, float x, float y,
+ String str) {
Element textGraph = doc.createElementNS(svgNS, "text");
textGraph.setAttributeNS(null, "x", "" + x);
textGraph.setAttributeNS(null, "y", "" + y);
@@ -125,8 +129,8 @@ public class SVGUtilities {
/**
* Create an SVG Rectangle.
*/
- public static final Element createRect(Document doc, float x,
- float y, float width, float height) {
+ public static final Element createRect(Document doc, float x, float y,
+ float width, float height) {
Element border = doc.createElementNS(svgNS, "rect");
border.setAttributeNS(null, "x", "" + x);
border.setAttributeNS(null, "y", "" + y);
@@ -198,4 +202,5 @@ public class SVGUtilities {
return g;
}
+
}
diff --git a/src/org/apache/fop/svg/XMLObj.java b/src/org/apache/fop/svg/XMLObj.java
index ded424966..e9b41669b 100644
--- a/src/org/apache/fop/svg/XMLObj.java
+++ b/src/org/apache/fop/svg/XMLObj.java
@@ -1,4 +1,5 @@
-/* $Id$
+/*
+ * $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -26,6 +27,7 @@ public abstract class XMLObj extends FObj {
protected String tagName = "";
protected String[] props = {};
+
/**
*
* @param parent the parent formatting object
@@ -41,7 +43,7 @@ public abstract class XMLObj extends FObj {
public void addGraphic(Document doc, Element parent) {
Element element = doc.createElementNS(getNameSpace(), tagName);
- // Element element = doc.createElement(tagName);
+ // Element element = doc.createElement(tagName);
for (int count = 0; count < props.length; count++) {
if (this.properties.get(props[count]) != null) {
String rf = this.properties.get(props[count]).getString();
@@ -49,14 +51,15 @@ public abstract class XMLObj extends FObj {
if (props[count].indexOf(":") == -1) {
element.setAttribute(props[count], rf);
} else {
- String pref = props[count].substring(0,
- props[count].indexOf(":"));
+ String pref =
+ props[count].substring(0,
+ props[count].indexOf(":"));
if (pref.equals("xmlns")) {
- ns.put(props[count].substring(
- props[count].indexOf(":") + 1), rf);
+ ns.put(props[count].substring(props[count].indexOf(":")
+ + 1), rf);
}
ns.put("xlink", "http://www.w3.org/1999/xlink");
- element.setAttributeNS((String) ns.get(pref),
+ element.setAttributeNS((String)ns.get(pref),
props[count], rf);
}
}
@@ -67,9 +70,9 @@ public abstract class XMLObj extends FObj {
for (int i = 0; i < numChildren; i++) {
Object child = children.elementAt(i);
if (child instanceof XMLObj) {
- ((XMLObj) child).addGraphic(doc, element);
+ ((XMLObj)child).addGraphic(doc, element);
} else if (child instanceof String) {
- org.w3c.dom.Text text = doc.createTextNode((String) child);
+ org.w3c.dom.Text text = doc.createTextNode((String)child);
element.appendChild(text);
}
}
@@ -84,14 +87,14 @@ public abstract class XMLObj extends FObj {
svgRoot.setAttributeNS(null, props[count], rf);
}
}
- //doc.appendChild(topLevel);
+ // doc.appendChild(topLevel);
int numChildren = this.children.size();
for (int i = 0; i < numChildren; i++) {
Object child = children.elementAt(i);
if (child instanceof XMLObj) {
- ((XMLObj) child).addGraphic(doc, svgRoot);
+ ((XMLObj)child).addGraphic(doc, svgRoot);
} else if (child instanceof String) {
- org.w3c.dom.Text text = doc.createTextNode((String) child);
+ org.w3c.dom.Text text = doc.createTextNode((String)child);
svgRoot.appendChild(text);
}
}
@@ -102,11 +105,11 @@ public abstract class XMLObj extends FObj {
Element svgRoot = null;
try {
- // DOMImplementation impl = javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation();
- // String ns = GraphElementMapping.URI;
- // doc = impl.createDocument(ns, "graph", null);
- doc = javax.xml.parsers.DocumentBuilderFactory.newInstance().
- newDocumentBuilder().newDocument();
+ // DOMImplementation impl = javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation();
+ // String ns = GraphElementMapping.URI;
+ // doc = impl.createDocument(ns, "graph", null);
+ doc =
+ javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
Element el = doc.createElement("graph");
doc.appendChild(el);
@@ -118,6 +121,7 @@ public abstract class XMLObj extends FObj {
}
return doc;
}
+
/**
* layout this formatting object.
*
@@ -135,26 +139,21 @@ public abstract class XMLObj extends FObj {
/**
* These method overrides prevent problems with the different types.
*/
- public void setIsInTableCell() {
- }
+ public void setIsInTableCell() {}
- public void forceStartOffset(int offset) {
- }
+ public void forceStartOffset(int offset) {}
- public void forceWidth(int width) {
- }
+ public void forceWidth(int width) {}
- public void resetMarker() {
- }
+ public void resetMarker() {}
- public void setLinkSet(LinkSet linkSet) {
- }
+ public void setLinkSet(LinkSet linkSet) {}
public Vector getMarkerSnapshot(Vector snapshot) {
return snapshot;
}
- public void rollback(Vector snapshot) {
- }
+ public void rollback(Vector snapshot) {}
+
}