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 ma...@apache.org on 2006/05/03 14:38:17 UTC
svn commit: r399286 - in
/xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp:
AFPFontColor.java AFPRenderer.java modca/AFPDataStream.java
modca/AbstractPageObject.java modca/PresentationTextData.java
modca/PresentationTextObject.java
Author: manuel
Date: Wed May 3 05:38:14 2006
New Revision: 399286
URL: http://svn.apache.org/viewcvs?rev=399286&view=rev
Log:
Removed deprecated renderCharacter method from AFP Renderer and replaced AFPColor class with java.awt.Color in line with the rest of FOP
Removed:
xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/AFPFontColor.java
Modified:
xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/AFPRenderer.java
xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/modca/AFPDataStream.java
xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/modca/AbstractPageObject.java
xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/modca/PresentationTextData.java
xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/modca/PresentationTextObject.java
Modified: xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/AFPRenderer.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/AFPRenderer.java?rev=399286&r1=399285&r2=399286&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/AFPRenderer.java (original)
+++ xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/AFPRenderer.java Wed May 3 05:38:14 2006
@@ -44,7 +44,6 @@
import org.apache.fop.area.RegionReference;
import org.apache.fop.area.RegionViewport;
import org.apache.fop.area.Trait;
-import org.apache.fop.area.inline.Character;
import org.apache.fop.area.inline.Leader;
import org.apache.fop.area.inline.Image;
import org.apache.fop.area.inline.SpaceArea;
@@ -164,7 +163,7 @@
/**
* The current color object
*/
- private AFPFontColor _currentColor = null;
+ private Color _currentColor = null;
/**
* The page font number counter, used to determine the next font reference
@@ -499,7 +498,7 @@
*/
public void startRenderer(OutputStream outputStream) throws IOException {
_currentPageFonts = new HashMap();
- _currentColor = new AFPFontColor(255, 255, 255);
+ _currentColor = new Color(255, 255, 255);
_afpDataStream = new AFPDataStream();
_afpDataStream.setPortraitRotation(_portraitRotation);
_afpDataStream.setLandscapeRotation(_landscapeRotation);
@@ -883,7 +882,7 @@
pts2units(x2),
pts2units(ym1),
pts2units(h3),
- new AFPFontColor(col)
+ col
);
_afpDataStream.createLine(
pts2units(x1),
@@ -891,7 +890,7 @@
pts2units(x2),
pts2units(ym2),
pts2units(h3),
- new AFPFontColor(col)
+ col
);
} else {
float w3 = w / 3;
@@ -903,7 +902,7 @@
pts2units(xm1),
pts2units(y2),
pts2units(w3),
- new AFPFontColor(col)
+ col
);
_afpDataStream.createLine(
pts2units(xm2),
@@ -911,7 +910,7 @@
pts2units(xm2),
pts2units(y2),
pts2units(w3),
- new AFPFontColor(col)
+ col
);
}
break;
@@ -925,7 +924,7 @@
pts2units(x1 + w2),
pts2units(y1),
pts2units(h),
- new AFPFontColor(col)
+ col
);
x1 += 2 * w2;
}
@@ -938,7 +937,7 @@
pts2units(x1),
pts2units(y1 + h2),
pts2units(w),
- new AFPFontColor(col)
+ col
);
y1 += 2 * h2;
}
@@ -953,7 +952,7 @@
pts2units(x1 + h),
pts2units(y1),
pts2units(h),
- new AFPFontColor(col)
+ col
);
x1 += 2 * h;
}
@@ -965,7 +964,7 @@
pts2units(x1),
pts2units(y1 + w),
pts2units(w),
- new AFPFontColor(col)
+ col
);
y1 += 2 * w;
}
@@ -986,7 +985,7 @@
pts2units(x2),
pts2units(ym1),
pts2units(h3),
- new AFPFontColor(uppercol)
+ uppercol
);
_afpDataStream.createLine(
pts2units(x1),
@@ -994,7 +993,7 @@
pts2units(x2),
pts2units(ym1 + h3),
pts2units(h3),
- new AFPFontColor(col)
+ col
);
_afpDataStream.createLine(
pts2units(x1),
@@ -1002,7 +1001,7 @@
pts2units(x2),
pts2units(ym1 + h3 + h3),
pts2units(h3),
- new AFPFontColor(lowercol)
+ lowercol
);
} else {
Color leftcol = lightenColor(col, -colFactor);
@@ -1015,7 +1014,7 @@
pts2units(xm1),
pts2units(y2),
pts2units(w3),
- new AFPFontColor(leftcol)
+ leftcol
);
_afpDataStream.createLine(
pts2units(xm1 + w3),
@@ -1023,7 +1022,7 @@
pts2units(xm1 + w3),
pts2units(y2),
pts2units(w3),
- new AFPFontColor(col)
+ col
);
_afpDataStream.createLine(
pts2units(xm1 + w3 + w3),
@@ -1031,7 +1030,7 @@
pts2units(xm1 + w3 + w3),
pts2units(y2),
pts2units(w3),
- new AFPFontColor(rightcol)
+ rightcol
);
}
break;
@@ -1047,7 +1046,8 @@
pts2units(horz ? x2 : x1),
pts2units(horz ? y1 : y2),
pts2units(Math.abs(horz ? (y2 - y1) : (x2 - x1))),
- new AFPFontColor(col));
+ col
+ );
}
}
@@ -1194,7 +1194,7 @@
*/
public void updateColor(Color col, boolean fill) {
if (fill) {
- _currentColor = new AFPFontColor(col);
+ _currentColor = col;
}
}
@@ -1243,90 +1243,6 @@
}
/**
- * @see org.apache.fop.render.AbstractRenderer#renderCharacter(Character)
- */
- public void renderCharacter(Character ch) {
- renderInlineAreaBackAndBorders(ch);
-
- String name = getInternalFontNameForArea(ch);
- _currentFontSize = ((Integer) ch.getTrait(Trait.FONT_SIZE)).intValue();
- AFPFont tf = (AFPFont) fontInfo.getFonts().get(name);
- _currentFontFamily = name;
-
- Color col = (Color) ch.getTrait(Trait.COLOR);
-
- int vsci = mpts2units(tf.getWidth(' ', _currentFontSize) / 1000
- + ch.getTextWordSpaceAdjust()
- + ch.getTextLetterSpaceAdjust());
-
- // word.getOffset() = only height of text itself
- // currentBlockIPPosition: 0 for beginning of line; nonzero
- // where previous line area failed to take up entire allocated space
- int rx = currentIPPosition + ch.getBorderAndPaddingWidthStart();
- int bl = currentBPPosition + ch.getOffset() + ch.getBaselineOffset();
-
- // Set letterSpacing
- //float ls = fs.getLetterSpacing() / this.currentFontSize;
-
- String worddata = ch.getChar();
-
- // Create an AFPFontAttributes object from the current font details
- AFPFontAttributes afpFontAttributes =
- new AFPFontAttributes(name, tf, _currentFontSize);
-
- if (!_currentPageFonts.containsKey(afpFontAttributes.getFontKey())) {
- // Font not found on current page, so add the new one
- _pageFontCounter++;
- afpFontAttributes.setFontReference(_pageFontCounter);
- _currentPageFonts.put(
- afpFontAttributes.getFontKey(),
- afpFontAttributes);
-
- } else {
- // Use the previously stored font attributes
- afpFontAttributes =
- (AFPFontAttributes) _currentPageFonts.get(afpFontAttributes.getFontKey());
-
- }
-
- // Try and get the encoding to use for the font
- String encoding = null;
-
- try {
- encoding = tf.getCharacterSet(_currentFontSize).getEncoding();
- } catch (Throwable ex) {
- encoding = AFPConstants.EBCIDIC_ENCODING;
- log.warn(
- "renderTextArea():: Error getting encoding for font "
- + " - using default encoding "
- + encoding);
- }
-
- try {
- _afpDataStream.createText(
- afpFontAttributes.getFontReference(),
- mpts2units(rx),
- mpts2units(bl),
- new AFPFontColor(col),
- vsci,
- mpts2units(ch.getTextLetterSpaceAdjust()),
- worddata.getBytes(encoding));
-
- } catch (UnsupportedEncodingException usee) {
- log.error(
- "renderWordArea:: Font "
- + afpFontAttributes.getFontKey()
- + " caused UnsupportedEncodingException");
-
- }
-
- super.renderCharacter(ch);
-
- renderTextDecoration(tf, _currentFontSize, ch, bl, rx);
-
- }
-
- /**
* @see org.apache.fop.render.AbstractRenderer#renderText(TextArea)
*/
public void renderText(TextArea text) {
@@ -1390,7 +1306,7 @@
afpFontAttributes.getFontReference(),
mpts2units(rx),
mpts2units(bl),
- new AFPFontColor(col),
+ col,
vsci,
mpts2units(text.getTextLetterSpaceAdjust()),
worddata.getBytes(encoding));
Modified: xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/modca/AFPDataStream.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/modca/AFPDataStream.java?rev=399286&r1=399285&r2=399286&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/modca/AFPDataStream.java (original)
+++ xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/modca/AFPDataStream.java Wed May 3 05:38:14 2006
@@ -18,12 +18,12 @@
package org.apache.fop.render.afp.modca;
+import java.awt.Color;
import java.io.IOException;
import java.io.OutputStream;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.fop.render.afp.AFPFontColor;
import org.apache.fop.render.afp.fonts.AFPFont;
import org.apache.fop.render.afp.tools.StringUtils;
@@ -347,7 +347,7 @@
* @param data
* the text data to create
*/
- public void createText(int fontNumber, int x, int y, AFPFontColor col, int vsci, int ica, byte[] data) {
+ public void createText(int fontNumber, int x, int y, Color col, int vsci, int ica, byte[] data) {
_currentPage.createText(fontNumber, x + _xOffset, y + _yOffset, _rotation, col, vsci, ica, data);
@@ -419,7 +419,7 @@
* @param col
* The text color.
*/
- public void createLine(int x1, int y1, int x2, int y2, int thickness, AFPFontColor col) {
+ public void createLine(int x1, int y1, int x2, int y2, int thickness, Color col) {
_currentPage.createLine(x1 + _xOffset, y1 + _yOffset, x2 + _xOffset, y2 + _yOffset, thickness, _rotation, col);
Modified: xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/modca/AbstractPageObject.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/modca/AbstractPageObject.java?rev=399286&r1=399285&r2=399286&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/modca/AbstractPageObject.java (original)
+++ xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/modca/AbstractPageObject.java Wed May 3 05:38:14 2006
@@ -17,11 +17,12 @@
/* $Id$ */
package org.apache.fop.render.afp.modca;
+
+import java.awt.Color;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
-import org.apache.fop.render.afp.AFPFontColor;
import org.apache.fop.render.afp.fonts.AFPFont;
import org.apache.fop.render.afp.tools.StringUtils;
@@ -179,7 +180,7 @@
* @param col
* The text color.
*/
- public void createLine(int x1, int y1, int x2, int y2, int thickness, int rotation, AFPFontColor col) {
+ public void createLine(int x1, int y1, int x2, int y2, int thickness, int rotation, Color col) {
if (_presentationTextObject == null) {
_presentationTextObject = new PresentationTextObject();
@@ -210,7 +211,7 @@
* @param data
* the text data to create
*/
- public void createText(int fontNumber, int x, int y, int rotation, AFPFontColor col, int vsci, int ica, byte[] data) {
+ public void createText(int fontNumber, int x, int y, int rotation, Color col, int vsci, int ica, byte[] data) {
if (_presentationTextObject == null) {
_presentationTextObject = new PresentationTextObject();
Modified: xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/modca/PresentationTextData.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/modca/PresentationTextData.java?rev=399286&r1=399285&r2=399286&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/modca/PresentationTextData.java (original)
+++ xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/modca/PresentationTextData.java Wed May 3 05:38:14 2006
@@ -18,10 +18,10 @@
package org.apache.fop.render.afp.modca;
+import java.awt.Color;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
-import org.apache.fop.render.afp.AFPFontColor;
import org.apache.fop.render.afp.tools.BinaryUtils;
@@ -80,7 +80,7 @@
/**
* The current color
*/
- private AFPFontColor _currentColor = new AFPFontColor(0, 0, 0);
+ private Color _currentColor = new Color(0, 0, 0);
/**
* The current variable space increment
@@ -302,7 +302,7 @@
* @throws MaximumSizeExceededException
*/
public void createTextData(int fontNumber, int x, int y, int orientation,
- AFPFontColor col, int vsci, int ica, byte[] data)
+ Color col, int vsci, int ica, byte[] data)
throws MaximumSizeExceededException {
ByteArrayOutputStream afpdata = new ByteArrayOutputStream();
@@ -340,7 +340,7 @@
// Avoid unnecessary specification of the text color
if (!col.equals(_currentColor)) {
setExtendedTextColor(col, afpdata);
- _currentColor.setTo(col);
+ _currentColor = col;
}
setCodedFont(BinaryUtils.convert(fontNumber)[0], afpdata);
@@ -380,7 +380,7 @@
* The text color.
*/
public void createLineData(int x1, int y1, int x2, int y2, int thickness,
- int orientation, AFPFontColor col) throws MaximumSizeExceededException {
+ int orientation, Color col) throws MaximumSizeExceededException {
ByteArrayOutputStream afpdata = new ByteArrayOutputStream();
@@ -401,7 +401,7 @@
if (!col.equals(_currentColor)) {
setExtendedTextColor(col, afpdata);
- _currentColor.setTo(col);
+ _currentColor = col;
}
if (y1 == y2) {
@@ -484,7 +484,7 @@
* @param afpdata
* The output stream to which data should be written.
*/
- private void setExtendedTextColor(AFPFontColor col,
+ private void setExtendedTextColor(Color col,
ByteArrayOutputStream afpdata) {
afpdata.write(new byte[] {
Modified: xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/modca/PresentationTextObject.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/modca/PresentationTextObject.java?rev=399286&r1=399285&r2=399286&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/modca/PresentationTextObject.java (original)
+++ xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/modca/PresentationTextObject.java Wed May 3 05:38:14 2006
@@ -17,11 +17,12 @@
/* $Id$ */
package org.apache.fop.render.afp.modca;
+
+import java.awt.Color;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
-import org.apache.fop.render.afp.AFPFontColor;
/**
* The Presentation Text object is the data object used in document processing
@@ -87,7 +88,7 @@
* @param data
* The text data to be created.
*/
- public void createTextData(int fontNumber, int x, int y, AFPFontColor col, int vsci, int ica, byte[] data) {
+ public void createTextData(int fontNumber, int x, int y, Color col, int vsci, int ica, byte[] data) {
// Use a default orientation of zero
createTextData(fontNumber, x, y, 0, col, vsci, ica, data);
@@ -115,7 +116,7 @@
* The text data to be created.
*/
public void createTextData(int fontNumber, int x, int y, int orientation,
- AFPFontColor col, int vsci, int ica, byte[] data) {
+ Color col, int vsci, int ica, byte[] data) {
if (currentPresentationTextData == null) {
startPresentationTextData();
@@ -151,7 +152,7 @@
* @param col
* The text color.
*/
- public void createLineData(int x1, int y1, int x2, int y2, int thickness, AFPFontColor col) {
+ public void createLineData(int x1, int y1, int x2, int y2, int thickness, Color col) {
// Default orientation
createLineData(x1, y1, x2, y2, thickness, 0, col);
}
@@ -176,7 +177,7 @@
* The text color.
*/
public void createLineData(int x1, int y1, int x2, int y2, int thickness,
- int orientation, AFPFontColor col) {
+ int orientation, Color col) {
if (currentPresentationTextData == null) {
startPresentationTextData();
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org