aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/fop/render')
-rw-r--r--src/java/org/apache/fop/render/AbstractRendererConfigurator.java12
-rw-r--r--src/java/org/apache/fop/render/PrintRenderer.java20
-rw-r--r--src/java/org/apache/fop/render/PrintRendererConfigurator.java54
-rw-r--r--src/java/org/apache/fop/render/afp/AFPRenderer.java28
-rw-r--r--src/java/org/apache/fop/render/java2d/Base14FontCollection.java8
-rw-r--r--src/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java4
-rw-r--r--src/java/org/apache/fop/render/java2d/InstalledFontCollection.java4
-rw-r--r--src/java/org/apache/fop/render/java2d/Java2DRenderer.java102
-rw-r--r--src/java/org/apache/fop/render/pcl/PCLRenderer.java260
-rw-r--r--src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java22
-rw-r--r--src/java/org/apache/fop/render/ps/NativeTextHandler.java32
11 files changed, 273 insertions, 273 deletions
diff --git a/src/java/org/apache/fop/render/AbstractRendererConfigurator.java b/src/java/org/apache/fop/render/AbstractRendererConfigurator.java
index bce5abfbd..982b23f05 100644
--- a/src/java/org/apache/fop/render/AbstractRendererConfigurator.java
+++ b/src/java/org/apache/fop/render/AbstractRendererConfigurator.java
@@ -36,7 +36,7 @@ public abstract class AbstractRendererConfigurator {
/** fop factory configuration */
protected FOUserAgent userAgent = null;
-
+
/**
* Default constructor
* @param userAgent user agent
@@ -45,7 +45,7 @@ public abstract class AbstractRendererConfigurator {
super();
this.userAgent = userAgent;
}
-
+
/**
* Returns the configuration subtree for a specific renderer.
* @param renderer the renderer
@@ -59,7 +59,7 @@ public abstract class AbstractRendererConfigurator {
}
return null;
}
-
+
return getRendererConfig(mimeType);
}
@@ -74,11 +74,11 @@ public abstract class AbstractRendererConfigurator {
if (log.isDebugEnabled()) {
log.debug("userconfig is null");
}
- return null;
+ return null;
}
-
+
Configuration userRendererConfig = null;
-
+
Configuration[] cfgs
= cfg.getChild("renderers").getChildren("renderer");
for (int i = 0; i < cfgs.length; ++i) {
diff --git a/src/java/org/apache/fop/render/PrintRenderer.java b/src/java/org/apache/fop/render/PrintRenderer.java
index 23f8a1f62..35630d628 100644
--- a/src/java/org/apache/fop/render/PrintRenderer.java
+++ b/src/java/org/apache/fop/render/PrintRenderer.java
@@ -45,7 +45,7 @@ public abstract class PrintRenderer extends AbstractRenderer {
/** list of fonts */
protected List/*<EmbedFontInfo>*/ embedFontInfoList = null;
-
+
/**
* Adds a font list to current list of fonts
* @param fontList a font info list
@@ -54,10 +54,10 @@ public abstract class PrintRenderer extends AbstractRenderer {
if (embedFontInfoList == null) {
setFontList(fontList);
} else {
- fontList.addAll(fontList);
+ embedFontInfoList.addAll(fontList);
}
}
-
+
/**
* @param embedFontInfoList list of available fonts
*/
@@ -91,7 +91,7 @@ public abstract class PrintRenderer extends AbstractRenderer {
FontTriplet triplet = (FontTriplet)area.getTrait(Trait.FONT);
return fontInfo.getInternalFontKey(triplet);
}
-
+
/**
* Returns a Font object constructed based on the font traits in an area
* @param area the area from which to retrieve the font triplet information
@@ -102,7 +102,7 @@ public abstract class PrintRenderer extends AbstractRenderer {
int size = ((Integer)area.getTrait(Trait.FONT_SIZE)).intValue();
return fontInfo.getFontInstance(triplet, size);
}
-
+
/**
* Lightens up a color for groove, ridge, inset and outset border effects.
* @param col the color to lighten up
@@ -135,7 +135,7 @@ public abstract class PrintRenderer extends AbstractRenderer {
* @param foreignAttributes a Map or foreign attributes, may be null
* @return the RendererContext
*/
- protected RendererContext createRendererContext(int x, int y, int width, int height,
+ protected RendererContext createRendererContext(int x, int y, int width, int height,
Map foreignAttributes) {
RendererContext context;
context = new RendererContext(this, getMimeType());
@@ -149,7 +149,7 @@ public abstract class PrintRenderer extends AbstractRenderer {
new Integer(x));
context.setProperty(RendererContextConstants.YPOS,
new Integer(y));
- context.setProperty(RendererContextConstants.PAGE_VIEWPORT,
+ context.setProperty(RendererContextConstants.PAGE_VIEWPORT,
getCurrentPageViewport());
if (foreignAttributes != null) {
context.setProperty(RendererContextConstants.FOREIGN_ATTRIBUTES, foreignAttributes);
@@ -165,12 +165,12 @@ public abstract class PrintRenderer extends AbstractRenderer {
* @param foreignAttributes the foreign attributes containing rendering hints, or null
*/
public void renderDocument(Document doc, String ns, Rectangle2D pos, Map foreignAttributes) {
- int x = currentIPPosition + (int) pos.getX();
+ int x = currentIPPosition + (int) pos.getX();
int y = currentBPPosition + (int) pos.getY();
int width = (int)pos.getWidth();
int height = (int)pos.getHeight();
RendererContext context = createRendererContext(x, y, width, height, foreignAttributes);
-
+
renderXML(context, doc, ns);
}
@@ -185,7 +185,7 @@ public abstract class PrintRenderer extends AbstractRenderer {
}
return this.fontResolver;
}
-
+
/**
* @return the font info
*/
diff --git a/src/java/org/apache/fop/render/PrintRendererConfigurator.java b/src/java/org/apache/fop/render/PrintRendererConfigurator.java
index 50d06932d..6849f867f 100644
--- a/src/java/org/apache/fop/render/PrintRendererConfigurator.java
+++ b/src/java/org/apache/fop/render/PrintRendererConfigurator.java
@@ -55,7 +55,7 @@ import org.apache.fop.util.LogUtil;
/**
* Base Print renderer configurator (mostly handles font configuration)
*/
-public class PrintRendererConfigurator extends AbstractRendererConfigurator
+public class PrintRendererConfigurator extends AbstractRendererConfigurator
implements RendererConfigurator {
/** logger instance */
@@ -94,9 +94,9 @@ public class PrintRendererConfigurator extends AbstractRendererConfigurator
boolean strict = factory.validateUserConfigStrictly();
FontCache fontCache = fontManager.getFontCache();
- List/*<EmbedFontInfo>*/ embedFontInfoList = buildFontListFromConfiguration(cfg,
+ List/*<EmbedFontInfo>*/ embedFontInfoList = buildFontListFromConfiguration(cfg,
fontResolver, strict, fontManager);
-
+
if (fontCache != null && fontCache.hasChanged()) {
fontCache.save();
}
@@ -113,13 +113,13 @@ public class PrintRendererConfigurator extends AbstractRendererConfigurator
* @return a List of EmbedFontInfo objects.
* @throws FOPException If an error occurs while processing the configuration
*/
- public static List/*<EmbedFontInfo>*/ buildFontListFromConfiguration(Configuration cfg,
- FontResolver fontResolver,
+ public static List/*<EmbedFontInfo>*/ buildFontListFromConfiguration(Configuration cfg,
+ FontResolver fontResolver,
boolean strict, FontManager fontManager) throws FOPException {
FontCache fontCache = fontManager.getFontCache();
String fontBaseURL = fontManager.getFontBaseURL();
List/*<EmbedFontInfo>*/ fontInfoList
- = new java.util.ArrayList/*<EmbedFontInfo>*/();
+ = new java.util.ArrayList/*<EmbedFontInfo>*/();
Configuration fonts = cfg.getChild("fonts", false);
if (fonts != null) {
@@ -128,7 +128,7 @@ public class PrintRendererConfigurator extends AbstractRendererConfigurator
log.debug("Starting font configuration...");
start = System.currentTimeMillis();
}
-
+
// native o/s search (autodetect) configuration
boolean autodetectFonts = (fonts.getChild("auto-detect", false) != null);
if (autodetectFonts) {
@@ -203,7 +203,7 @@ public class PrintRendererConfigurator extends AbstractRendererConfigurator
LogUtil.handleException(log, e, strict);
}
}
-
+
// font file (singular) configuration
Configuration[] font = fonts.getChildren("font");
for (int i = 0; i < font.length; i++) {
@@ -216,9 +216,9 @@ public class PrintRendererConfigurator extends AbstractRendererConfigurator
// Update referenced fonts (fonts which are not to be embedded)
updateReferencedFonts(fontInfoList, fontManager.getReferencedFontsMatcher());
-
+
if (log.isDebugEnabled()) {
- log.debug("Finished font configuration in "
+ log.debug("Finished font configuration in "
+ (System.currentTimeMillis() - start) + "ms");
}
}
@@ -243,7 +243,7 @@ public class PrintRendererConfigurator extends AbstractRendererConfigurator
}
}
-
+
/**
* Iterates over font file list adding font info to list
* @param fontFileList font file list
@@ -258,7 +258,7 @@ public class PrintRendererConfigurator extends AbstractRendererConfigurator
// parse font to ascertain font info
FontInfoFinder finder = new FontInfoFinder();
//EmbedFontInfo fontInfo = finder.find(fontUrl, resolver, fontCache);
-
+
//List<EmbedFontInfo> embedFontInfoList = finder.find(fontUrl, resolver, fontCache);
EmbedFontInfo[] embedFontInfos = finder.find(fontUrl, resolver, fontCache);
@@ -299,14 +299,14 @@ public class PrintRendererConfigurator extends AbstractRendererConfigurator
LogUtil.handleError(log, "font-triplet without name", strict);
return null;
}
-
+
String weightStr = tripletCfg.getAttribute("weight");
if (weightStr == null) {
LogUtil.handleError(log, "font-triplet without weight", strict);
return null;
}
int weight = FontUtil.parseCSS2FontWeight(FontUtil.stripWhiteSpace(weightStr));
-
+
String style = tripletCfg.getAttribute("style");
if (style == null) {
LogUtil.handleError(log, "font-triplet without style", strict);
@@ -320,7 +320,7 @@ public class PrintRendererConfigurator extends AbstractRendererConfigurator
}
return null;
}
-
+
/**
* Returns a font info from a font node Configuration definition
*
@@ -337,7 +337,7 @@ public class PrintRendererConfigurator extends AbstractRendererConfigurator
String metricsUrl = fontCfg.getAttribute("metrics-url", null);
String embedUrl = fontCfg.getAttribute("embed-url", null);
String subFont = fontCfg.getAttribute("sub-font", null);
-
+
if (metricsUrl == null && embedUrl == null) {
LogUtil.handleError(log,
"Font configuration without metric-url or embed-url attribute",
@@ -366,13 +366,13 @@ public class PrintRendererConfigurator extends AbstractRendererConfigurator
}
}
}
-
+
Configuration[] tripletCfg = fontCfg.getChildren("font-triplet");
-
+
// no font triplet info
if (tripletCfg.length == 0) {
LogUtil.handleError(log, "font without font-triplet", strict);
-
+
File fontFile = FontCache.getFileFromUrls(new String[] {embedUrl, metricsUrl});
URL fontUrl;
try {
@@ -384,28 +384,28 @@ public class PrintRendererConfigurator extends AbstractRendererConfigurator
}
if (fontFile != null) {
FontInfoFinder finder = new FontInfoFinder();
- EmbedFontInfo[] infos = finder.find(fontUrl, fontResolver, fontCache);
+ EmbedFontInfo[] infos = finder.find(fontUrl, fontResolver, fontCache);
return infos[0]; //When subFont is set, only one font is returned
} else {
return null;
}
}
-
+
List/*<FontTriplet>*/ tripletList = new java.util.ArrayList/*<FontTriplet>*/();
for (int j = 0; j < tripletCfg.length; j++) {
FontTriplet fontTriplet = getFontTripletFromConfiguration(tripletCfg[j], strict);
tripletList.add(fontTriplet);
}
-
+
boolean useKerning = fontCfg.getAttributeAsBoolean("kerning", true);
EmbedFontInfo embedFontInfo
- = new EmbedFontInfo(metricsUrl, useKerning, tripletList, embedUrl, subFont);
+ = new EmbedFontInfo(metricsUrl, useKerning, tripletList, embedUrl, subFont);
if (fontCache != null) {
if (!fontCache.containsFont(embedFontInfo)) {
- fontCache.addFont(embedFontInfo);
+ fontCache.addFont(embedFontInfo);
}
}
-
+
if (log.isDebugEnabled()) {
String embedFile = embedFontInfo.getEmbedFile();
log.debug("Adding font " + (embedFile != null ? embedFile + ", " : "")
@@ -417,8 +417,8 @@ public class PrintRendererConfigurator extends AbstractRendererConfigurator
+ triplet.getStyle() + ", "
+ triplet.getWeight());
}
- }
+ }
return embedFontInfo;
}
-
+
}
diff --git a/src/java/org/apache/fop/render/afp/AFPRenderer.java b/src/java/org/apache/fop/render/afp/AFPRenderer.java
index 14eb33510..626ca47da 100644
--- a/src/java/org/apache/fop/render/afp/AFPRenderer.java
+++ b/src/java/org/apache/fop/render/afp/AFPRenderer.java
@@ -502,7 +502,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
AffineTransform positionTransform = new AffineTransform();
positionTransform.translate(bv.getXOffset(), bv.getYOffset());
-
+
//"left/"top" (bv.getX/YOffset()) specify the position of the content rectangle
positionTransform.translate(-borderPaddingStart, -borderPaddingBefore);
@@ -511,7 +511,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
//saveGraphicsState();
//Viewport position
//concatenateTransformationMatrix(mptToPt(positionTransform));
-
+
//Background and borders
float bpwidth = (borderPaddingStart + bv.getBorderAndPaddingWidthEnd()) / 1000f;
float bpheight = (borderPaddingBefore + bv.getBorderAndPaddingWidthAfter()) / 1000f;
@@ -542,7 +542,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
//concatenateTransformationMatrix(mptToPt(contentTransform));
contentRect = new Rectangle2D.Double(0, 0, 1000 * width, 1000 * height);
pushViewPortPos(new ViewPortPos(contentRect, new CTM(contentTransform)));
-
+
currentIPPosition = 0;
currentBPPosition = 0;
renderBlocks(bv, children);
@@ -600,7 +600,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
//Not used here since AFPRenderer defines its own renderBlockViewport() method.
throw new UnsupportedOperationException("NYI");
}
-
+
/**
* {@inheritDoc}
*/
@@ -930,7 +930,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
private static final ImageFlavor[] FLAVORS = new ImageFlavor[]
{ImageFlavor.RAW_CCITTFAX,
ImageFlavor.GRAPHICS2D,
- ImageFlavor.BUFFERED_IMAGE,
+ ImageFlavor.BUFFERED_IMAGE,
ImageFlavor.RENDERED_IMAGE,
ImageFlavor.XML_DOM};
@@ -957,12 +957,12 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
try {
ImageSessionContext sessionContext = getUserAgent().getImageSessionContext();
info = manager.getImageInfo(uri, sessionContext);
-
+
//Only now fully load/prepare the image
Map hints = ImageUtil.getDefaultHints(sessionContext);
org.apache.xmlgraphics.image.loader.Image img = manager.getImage(
info, FLAVORS, hints, sessionContext);
-
+
//...and process the image
if (img instanceof ImageGraphics2D) {
ImageGraphics2D imageG2D = (ImageGraphics2D)img;
@@ -1066,7 +1066,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
IOUtils.closeQuietly(in);
}
}
-
+
/*
ImageFactory fact = userAgent.getFactory().getImageFactory();
FopImage fopimage = fact.getImage(url, userAgent);
@@ -1139,7 +1139,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
if (!fopimage.load(FopImage.BITMAP)) {
return;
}
- convertToGrayScaleImage(io, fopimage.getBitmaps(),
+ convertToGrayScaleImage(io, fopimage.getBitmaps(),
fopimage.getWidth(), fopimage.getHeight());
}
} else {
@@ -1474,9 +1474,9 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
*/
// UNUSED
// public void setOptions(Map options) {
-//
+//
// this.afpOptions = options;
-//
+//
// }
/**
* Determines the orientation from the string representation, this method
@@ -1543,7 +1543,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
/**
* Sets the rotation to be used for landsacpe pages, valid values are 0, 90,
* 180, 270 (default).
- *
+ *
* @param rotation
* The rotation in degrees.
*/
@@ -1714,7 +1714,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
io.setImageIDESize((byte) bitsPerPixel);
io.setImageData(bw);
}
-
+
private final class ViewPortPos {
private int x = 0;
@@ -1882,7 +1882,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
}
this.resolution = resolution;
}
-
+
/**
* Returns the output/device resolution.
* @return the resolution in dpi
diff --git a/src/java/org/apache/fop/render/java2d/Base14FontCollection.java b/src/java/org/apache/fop/render/java2d/Base14FontCollection.java
index f97a68191..ca4a4bce3 100644
--- a/src/java/org/apache/fop/render/java2d/Base14FontCollection.java
+++ b/src/java/org/apache/fop/render/java2d/Base14FontCollection.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-/* $Id: $ */
+/* $Id$ */
package org.apache.fop.render.java2d;
@@ -31,7 +31,7 @@ import org.apache.fop.fonts.FontInfo;
public class Base14FontCollection implements FontCollection {
private Graphics2D graphics2d = null;
-
+
/**
* Main constructor
* @param graphics2d a graphics 2D
@@ -39,7 +39,7 @@ public class Base14FontCollection implements FontCollection {
public Base14FontCollection(Graphics2D graphics2d) {
this.graphics2d = graphics2d;
}
-
+
/**
* {@inheritDoc}
*/
@@ -175,7 +175,7 @@ public class Base14FontCollection implements FontCollection {
fontInfo.addFontProperties("F8", "Times Roman", Font.STYLE_ITALIC, Font.WEIGHT_BOLD);
fontInfo.addFontProperties("F9", "Computer-Modern-Typewriter",
"normal", Font.WEIGHT_NORMAL);
-
+
return 15;
}
}
diff --git a/src/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java b/src/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java
index 4981905fa..843ab8413 100644
--- a/src/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java
+++ b/src/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-/* $Id: $ */
+/* $Id$ */
package org.apache.fop.render.java2d;
@@ -54,7 +54,7 @@ public class ConfiguredFontCollection implements FontCollection {
public ConfiguredFontCollection(PrintRenderer renderer) {
this.renderer = renderer;
}
-
+
/**
* {@inheritDoc}
*/
diff --git a/src/java/org/apache/fop/render/java2d/InstalledFontCollection.java b/src/java/org/apache/fop/render/java2d/InstalledFontCollection.java
index 4cdd30c41..4eac922e8 100644
--- a/src/java/org/apache/fop/render/java2d/InstalledFontCollection.java
+++ b/src/java/org/apache/fop/render/java2d/InstalledFontCollection.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-/* $Id: $ */
+/* $Id$ */
package org.apache.fop.render.java2d;
@@ -67,7 +67,7 @@ public class InstalledFontCollection implements FontCollection {
public InstalledFontCollection(Graphics2D graphics2D) {
this.graphics2D = graphics2D;
}
-
+
/**
* {@inheritDoc}
*/
diff --git a/src/java/org/apache/fop/render/java2d/Java2DRenderer.java b/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
index eea165525..e39ae5831 100644
--- a/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
+++ b/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
@@ -129,17 +129,17 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
/** false: paints a non-transparent white background, true: for a transparent background */
protected boolean transparentPageBackground = false;
-
+
/** The current state, holds a Graphics2D and its context */
protected Java2DGraphicsState state;
-
+
private Stack stateStack = new Stack();
/** true if the renderer has finished rendering all the pages */
private boolean renderingDone;
private GeneralPath currentPath = null;
-
+
/** Default constructor */
public Java2DRenderer() {
}
@@ -150,7 +150,7 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
public void setUserAgent(FOUserAgent foUserAgent) {
super.setUserAgent(foUserAgent);
userAgent.setRendererOverride(this); // for document regeneration
-
+
String s = (String)userAgent.getRendererOptions().get(JAVA2D_TRANSPARENT_PAGE_BACKGROUND);
if (s != null) {
this.transparentPageBackground = "true".equalsIgnoreCase(s);
@@ -173,9 +173,9 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
BufferedImage.TYPE_INT_RGB);
Graphics2D graphics2D = fontImage.createGraphics();
//The next line is important to get accurate font metrics!
- graphics2D.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
+ graphics2D.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
-
+
userAgent.getFactory().getFontManager().setupRenderer(this, graphics2D);
}
@@ -218,7 +218,7 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
public boolean isRenderingDone() {
return this.renderingDone;
}
-
+
/**
* @return The 0-based current page number
*/
@@ -279,7 +279,7 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
assert pageViewport.getPageIndex() >= 0;
pageViewportList.add(pageViewport);
}
-
+
/**
* Generates a desired page from the renderer's page viewport list.
*
@@ -300,18 +300,18 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
+ " (pageWidth " + pageWidth + ", pageHeight "
+ pageHeight + ")");
- double scaleX = scaleFactor
- * (25.4 / FopFactoryConfigurator.DEFAULT_TARGET_RESOLUTION)
+ double scaleX = scaleFactor
+ * (25.4 / FopFactoryConfigurator.DEFAULT_TARGET_RESOLUTION)
/ userAgent.getTargetPixelUnitToMillimeter();
double scaleY = scaleFactor
* (25.4 / FopFactoryConfigurator.DEFAULT_TARGET_RESOLUTION)
/ userAgent.getTargetPixelUnitToMillimeter();
int bitmapWidth = (int) ((pageWidth * scaleX) + 0.5);
int bitmapHeight = (int) ((pageHeight * scaleY) + 0.5);
-
-
+
+
BufferedImage currentPageImage = getBufferedImage(bitmapWidth, bitmapHeight);
-
+
Graphics2D graphics = currentPageImage.createGraphics();
graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
@@ -374,7 +374,7 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
return new BufferedImage(
bitmapWidth, bitmapHeight, BufferedImage.TYPE_INT_ARGB);
}
-
+
/**
* Returns a page viewport.
* @param pageIndex the page index (zero-based)
@@ -414,21 +414,21 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
state.dispose();
state = (Java2DGraphicsState)stateStack.pop();
}
-
+
/** {@inheritDoc} */
protected void concatenateTransformationMatrix(AffineTransform at) {
state.transform(at);
}
-
+
/** {@inheritDoc} */
protected void startVParea(CTM ctm, Rectangle2D clippingRect) {
saveGraphicsState();
if (clippingRect != null) {
- clipRect((float)clippingRect.getX() / 1000f,
- (float)clippingRect.getY() / 1000f,
- (float)clippingRect.getWidth() / 1000f,
+ clipRect((float)clippingRect.getX() / 1000f,
+ (float)clippingRect.getY() / 1000f,
+ (float)clippingRect.getWidth() / 1000f,
(float)clippingRect.getHeight() / 1000f);
}
@@ -465,7 +465,7 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
*/
protected void restoreStateStackAfterBreakOut(List breakOutList) {
log.debug("Block.FIXED --> restoring context after break-out");
-
+
Iterator i = breakOutList.iterator();
while (i.hasNext()) {
Java2DGraphicsState s = (Java2DGraphicsState)i.next();
@@ -475,7 +475,7 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}
*/
protected void updateColor(Color col, boolean fill) {
state.updateColor(col);
@@ -500,7 +500,7 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}
*/
protected void lineTo(float x, float y) {
if (currentPath == null) {
@@ -510,7 +510,7 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}
*/
protected void moveTo(float x, float y) {
if (currentPath == null) {
@@ -520,26 +520,26 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}
*/
protected void clipRect(float x, float y, float width, float height) {
state.updateClip(new Rectangle2D.Float(x, y, width, height));
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}
*/
protected void fillRect(float x, float y, float width, float height) {
state.getGraph().fill(new Rectangle2D.Float(x, y, width, height));
}
-
+
/**
- * {@inheritDoc}
+ * {@inheritDoc}
*/
- protected void drawBorderLine(float x1, float y1, float x2, float y2,
+ protected void drawBorderLine(float x1, float y1, float x2, float y2,
boolean horz, boolean startOrBefore, int style, Color col) {
Graphics2D g2d = state.getGraph();
- drawBorderLine(new Rectangle2D.Float(x1, y1, x2 - x1, y2 - y1),
+ drawBorderLine(new Rectangle2D.Float(x1, y1, x2 - x1, y2 - y1),
horz, startOrBefore, style, col, g2d);
}
@@ -547,13 +547,13 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
* Draw a border segment of an XSL-FO style border.
* @param lineRect the line defined by its bounding rectangle
* @param horz true for horizontal border segments, false for vertical border segments
- * @param startOrBefore true for border segments on the start or before edge,
+ * @param startOrBefore true for border segments on the start or before edge,
* false for end or after.
* @param style the border style (one of Constants.EN_DASHED etc.)
* @param col the color for the border segment
* @param g2d the Graphics2D instance to paint to
*/
- public static void drawBorderLine(Rectangle2D.Float lineRect,
+ public static void drawBorderLine(Rectangle2D.Float lineRect,
boolean horz, boolean startOrBefore, int style, Color col, Graphics2D g2d) {
float x1 = lineRect.x;
float y1 = lineRect.y;
@@ -566,7 +566,7 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
return;
}
switch (style) {
- case Constants.EN_DASHED:
+ case Constants.EN_DASHED:
g2d.setColor(col);
if (horz) {
float unit = Math.abs(2 * h);
@@ -576,7 +576,7 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
}
unit = w / rep;
float ym = y1 + (h / 2);
- BasicStroke s = new BasicStroke(h, BasicStroke.CAP_BUTT,
+ BasicStroke s = new BasicStroke(h, BasicStroke.CAP_BUTT,
BasicStroke.JOIN_MITER, 10.0f, new float[] {unit}, 0);
g2d.setStroke(s);
g2d.draw(new Line2D.Float(x1, ym, x2, ym));
@@ -588,7 +588,7 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
}
unit = h / rep;
float xm = x1 + (w / 2);
- BasicStroke s = new BasicStroke(w, BasicStroke.CAP_BUTT,
+ BasicStroke s = new BasicStroke(w, BasicStroke.CAP_BUTT,
BasicStroke.JOIN_MITER, 10.0f, new float[] {unit}, 0);
g2d.setStroke(s);
g2d.draw(new Line2D.Float(xm, y1, xm, y2));
@@ -604,7 +604,7 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
}
unit = w / rep;
float ym = y1 + (h / 2);
- BasicStroke s = new BasicStroke(h, BasicStroke.CAP_ROUND,
+ BasicStroke s = new BasicStroke(h, BasicStroke.CAP_ROUND,
BasicStroke.JOIN_MITER, 10.0f, new float[] {0, unit}, 0);
g2d.setStroke(s);
g2d.draw(new Line2D.Float(x1, ym, x2, ym));
@@ -616,7 +616,7 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
}
unit = h / rep;
float xm = x1 + (w / 2);
- BasicStroke s = new BasicStroke(w, BasicStroke.CAP_ROUND,
+ BasicStroke s = new BasicStroke(w, BasicStroke.CAP_ROUND,
BasicStroke.JOIN_MITER, 10.0f, new float[] {0, unit}, 0);
g2d.setStroke(s);
g2d.draw(new Line2D.Float(xm, y1, xm, y2));
@@ -722,7 +722,7 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
state.transform(at);
renderText(text, state.getGraph(), font);
restoreGraphicsState();
-
+
currentIPPosition = saveIP + text.getAllocIPD();
//super.renderText(text);
@@ -755,8 +755,8 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
int[] letterAdjust = word.getLetterAdjustArray();
GlyphVector gv = g2d.getFont().createGlyphVector(g2d.getFontRenderContext(), s);
double additionalWidth = 0.0;
- if (letterAdjust == null
- && text.getTextLetterSpaceAdjust() == 0
+ if (letterAdjust == null
+ && text.getTextLetterSpaceAdjust() == 0
&& text.getTextWordSpaceAdjust() == 0) {
//nop
} else {
@@ -776,8 +776,8 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
SpaceArea space = (SpaceArea)child;
String s = space.getSpace();
char sp = s.charAt(0);
- int tws = (space.isAdjustable()
- ? text.getTextWordSpaceAdjust()
+ int tws = (space.isAdjustable()
+ ? text.getTextWordSpaceAdjust()
+ 2 * text.getTextLetterSpaceAdjust()
: 0);
@@ -787,8 +787,8 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
}
}
}
-
- private static int[] getGlyphOffsets(String s, Font font, TextArea text,
+
+ private static int[] getGlyphOffsets(String s, Font font, TextArea text,
int[] letterAdjust) {
int textLen = s.length();
int[] offsets = new int[textLen];
@@ -804,11 +804,11 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
}
int cw = font.getWidth(mapped);
int ladj = (letterAdjust != null && i < textLen - 1 ? letterAdjust[i + 1] : 0);
- int tls = (i < textLen - 1 ? text.getTextLetterSpaceAdjust() : 0);
+ int tls = (i < textLen - 1 ? text.getTextLetterSpaceAdjust() : 0);
offsets[i] = cw + ladj + tls + wordSpace;
}
return offsets;
- }
+ }
/**
* Render leader area. This renders a leader area which is an area with a
@@ -824,7 +824,7 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
float startx = (currentIPPosition + area.getBorderAndPaddingWidthStart()) / 1000f;
float starty = ((currentBPPosition + area.getOffset()) / 1000f);
- float endx = (currentIPPosition + area.getBorderAndPaddingWidthStart()
+ float endx = (currentIPPosition + area.getBorderAndPaddingWidthStart()
+ area.getIPD()) / 1000f;
Color col = (Color) area.getTrait(Trait.COLOR);
@@ -839,7 +839,7 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
case EN_SOLID:
case EN_DASHED:
case EN_DOUBLE:
- drawBorderLine(startx, starty, endx, starty + ruleThickness,
+ drawBorderLine(startx, starty, endx, starty + ruleThickness,
true, true, style, col);
break;
case EN_DOTTED:
@@ -905,7 +905,7 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
int x = currentIPPosition + (int)Math.round(pos.getX());
int y = currentBPPosition + (int)Math.round(pos.getY());
uri = URISpecification.getURL(uri);
-
+
ImageManager manager = getUserAgent().getFactory().getImageManager();
ImageInfo info = null;
try {
@@ -913,8 +913,8 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
info = manager.getImageInfo(uri, sessionContext);
final ImageFlavor[] flavors = new ImageFlavor[]
{ImageFlavor.GRAPHICS2D,
- ImageFlavor.BUFFERED_IMAGE,
- ImageFlavor.RENDERED_IMAGE,
+ ImageFlavor.BUFFERED_IMAGE,
+ ImageFlavor.RENDERED_IMAGE,
ImageFlavor.XML_DOM};
Map hints = ImageUtil.getDefaultHints(sessionContext);
org.apache.xmlgraphics.image.loader.Image img = manager.getImage(
@@ -958,7 +958,7 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
}
/** {@inheritDoc} */
- protected RendererContext createRendererContext(int x, int y, int width, int height,
+ protected RendererContext createRendererContext(int x, int y, int width, int height,
Map foreignAttributes) {
RendererContext context = super.createRendererContext(
x, y, width, height, foreignAttributes);
diff --git a/src/java/org/apache/fop/render/pcl/PCLRenderer.java b/src/java/org/apache/fop/render/pcl/PCLRenderer.java
index 5ffef15ba..007ce4828 100644
--- a/src/java/org/apache/fop/render/pcl/PCLRenderer.java
+++ b/src/java/org/apache/fop/render/pcl/PCLRenderer.java
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.fop.render.pcl;
//Java
@@ -111,14 +111,14 @@ public class PCLRenderer extends PrintRenderer {
/** The MIME type for PCL */
public static final String MIME_TYPE = MimeConstants.MIME_PCL_ALT;
- private static final QName CONV_MODE
+ private static final QName CONV_MODE
= new QName(ExtensionElementMapping.URI, null, "conversion-mode");
- private static final QName SRC_TRANSPARENCY
+ private static final QName SRC_TRANSPARENCY
= new QName(ExtensionElementMapping.URI, null, "source-transparency");
-
+
/** The OutputStream to write the PCL stream to */
protected OutputStream out;
-
+
/** The PCL generator */
protected PCLGenerator gen;
private boolean ioTrouble = false;
@@ -130,13 +130,13 @@ public class PCLRenderer extends PrintRenderer {
private int currentPrintDirection = 0;
private GeneralPath currentPath = null;
private java.awt.Color currentFillColor = null;
-
+
/**
* Controls whether appearance is more important than speed. False can cause some FO feature
- * to be ignored (like the advanced borders).
+ * to be ignored (like the advanced borders).
*/
private boolean qualityBeforeSpeed = false;
-
+
/**
* Controls whether all text should be painted as text. This is a fallback setting in case
* the mixture of native and bitmapped text does not provide the necessary quality.
@@ -149,17 +149,17 @@ public class PCLRenderer extends PrintRenderer {
* this to true will increase memory consumption.
*/
private boolean useColorCanvas = false;
-
+
/**
- * Controls whether the generation of PJL commands gets disabled.
+ * Controls whether the generation of PJL commands gets disabled.
*/
private boolean disabledPJL = false;
-
+
/** contains the pageWith of the last printed page */
private long pageWidth = 0;
/** contains the pageHeight of the last printed page */
private long pageHeight = 0;
-
+
/**
* Create the PCL renderer
*/
@@ -182,7 +182,7 @@ public class PCLRenderer extends PrintRenderer {
public void setPJLDisabled(boolean disable) {
this.disabledPJL = disable;
}
-
+
/**
* Indicates whether PJL generation is disabled.
* @return true if PJL generation is disabled.
@@ -190,7 +190,7 @@ public class PCLRenderer extends PrintRenderer {
public boolean isPJLDisabled() {
return this.disabledPJL;
}
-
+
/**
* {@inheritDoc}
*/
@@ -203,9 +203,9 @@ public class PCLRenderer extends PrintRenderer {
BufferedImage.TYPE_INT_RGB);
Graphics2D graphics2D = fontImage.createGraphics();
//The next line is important to get accurate font metrics!
- graphics2D.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
+ graphics2D.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
-
+
userAgent.getFactory().getFontManager().setupRenderer(this, graphics2D);
}
@@ -231,7 +231,7 @@ public class PCLRenderer extends PrintRenderer {
public GraphicContext getGraphicContext() {
return this.graphicContext;
}
-
+
/** @return the target resolution */
protected int getResolution() {
int resolution = (int)Math.round(userAgent.getTargetResolution());
@@ -241,7 +241,7 @@ public class PCLRenderer extends PrintRenderer {
return 600;
}
}
-
+
/**
* Sets the current font (NOTE: Hard-coded font mappings ATM!)
* @param name the font name (internal F* names for now)
@@ -317,25 +317,25 @@ public class PCLRenderer extends PrintRenderer {
case 9: // F9 = Courier
gen.writeCommand("(0N");
- gen.writeCommand("(s0p" + gen.formatDouble2(120.01f / (size / 1000.00f))
+ gen.writeCommand("(s0p" + gen.formatDouble2(120.01f / (size / 1000.00f))
+ "h0s0b4099T");
break;
case 10: // F10 = Courier Oblique
gen.writeCommand("(0N");
- gen.writeCommand("(s0p" + gen.formatDouble2(120.01f / (size / 1000.00f))
+ gen.writeCommand("(s0p" + gen.formatDouble2(120.01f / (size / 1000.00f))
+ "h1s0b4099T");
break;
case 11: // F11 = Courier Bold
gen.writeCommand("(0N");
- gen.writeCommand("(s0p" + gen.formatDouble2(120.01f / (size / 1000.00f))
+ gen.writeCommand("(s0p" + gen.formatDouble2(120.01f / (size / 1000.00f))
+ "h0s3b4099T");
break;
case 12: // F12 = Courier Bold Oblique
gen.writeCommand("(0N");
- gen.writeCommand("(s0p" + gen.formatDouble2(120.01f / (size / 1000.00f))
+ gen.writeCommand("(s0p" + gen.formatDouble2(120.01f / (size / 1000.00f))
+ "h1s3b4099T");
break;
case 13: // F13 = Symbol
@@ -400,52 +400,52 @@ public class PCLRenderer extends PrintRenderer {
*/
public void renderPage(PageViewport page) throws IOException, FOPException {
saveGraphicsState();
-
+
//Paper source
String paperSource = page.getForeignAttributeValue(
new QName(PCLElementMapping.NAMESPACE, null, "paper-source"));
if (paperSource != null) {
gen.selectPaperSource(Integer.parseInt(paperSource));
}
-
+
//Page size
final long pagewidth = Math.round(page.getViewArea().getWidth());
final long pageheight = Math.round(page.getViewArea().getHeight());
selectPageFormat(pagewidth, pageheight);
-
+
super.renderPage(page);
-
+
//Eject page
gen.formFeed();
restoreGraphicsState();
}
private void selectPageFormat(long pagewidth, long pageheight) throws IOException {
- //Only set the page format if it changes (otherwise duplex printing won't work)
+ //Only set the page format if it changes (otherwise duplex printing won't work)
if ((pagewidth != this.pageWidth) || (pageheight != this.pageHeight)) {
this.pageWidth = pagewidth;
this.pageHeight = pageheight;
-
+
this.currentPageDefinition = PCLPageDefinition.getPageDefinition(
pagewidth, pageheight, 1000);
-
+
if (this.currentPageDefinition == null) {
this.currentPageDefinition = PCLPageDefinition.getDefaultPageDefinition();
- log.warn("Paper type could not be determined. Falling back to: "
+ log.warn("Paper type could not be determined. Falling back to: "
+ this.currentPageDefinition.getName());
}
if (log.isDebugEnabled()) {
log.debug("page size: " + currentPageDefinition.getPhysicalPageSize());
log.debug("logical page: " + currentPageDefinition.getLogicalPageRect());
}
-
+
if (this.currentPageDefinition.isLandscapeFormat()) {
gen.writeCommand("&l1O"); //Landscape Orientation
} else {
gen.writeCommand("&l0O"); //Portrait Orientation
}
gen.selectPageSize(this.currentPageDefinition.getSelector());
-
+
gen.clearHorizontalMargins();
gen.setTopMargin(0);
}
@@ -461,7 +461,7 @@ public class PCLRenderer extends PrintRenderer {
protected void restoreGraphicsState() {
graphicContext = (GraphicContext)graphicContextStack.pop();
}
-
+
/**
* Clip an area. write a clipping operation given coordinates in the current
* transform. Coordinates are in points.
@@ -478,7 +478,7 @@ public class PCLRenderer extends PrintRenderer {
private Point2D transformedPoint(float x, float y) {
return transformedPoint(Math.round(x), Math.round(y));
}
-
+
private Point2D transformedPoint(int x, int y) {
AffineTransform at = graphicContext.getTransform();
if (log.isTraceEnabled()) {
@@ -488,7 +488,7 @@ public class PCLRenderer extends PrintRenderer {
Point2D.Float transPoint = new Point2D.Float();
at.transform(orgPoint, transPoint);
//At this point we have the absolute position in FOP's coordinate system
-
+
//Now get PCL coordinates taking the current print direction and the logical page
//into account.
Dimension pageSize = currentPageDefinition.getPhysicalPageSize();
@@ -527,18 +527,18 @@ public class PCLRenderer extends PrintRenderer {
}
return transPoint;
}
-
+
private void changePrintDirection() {
AffineTransform at = graphicContext.getTransform();
int newDir;
try {
- if (at.getScaleX() == 0 && at.getScaleY() == 0
+ if (at.getScaleX() == 0 && at.getScaleY() == 0
&& at.getShearX() == 1 && at.getShearY() == -1) {
newDir = 90;
- } else if (at.getScaleX() == -1 && at.getScaleY() == -1
+ } else if (at.getScaleX() == -1 && at.getScaleY() == -1
&& at.getShearX() == 0 && at.getShearY() == 0) {
newDir = 180;
- } else if (at.getScaleX() == 0 && at.getScaleY() == 0
+ } else if (at.getScaleX() == 0 && at.getScaleY() == 0
&& at.getShearX() == -1 && at.getShearY() == 1) {
newDir = 270;
} else {
@@ -588,7 +588,7 @@ public class PCLRenderer extends PrintRenderer {
protected void handleBlockTraits(Block block) {
int borderPaddingStart = block.getBorderAndPaddingWidthStart();
int borderPaddingBefore = block.getBorderAndPaddingWidthBefore();
-
+
float startx = currentIPPosition / 1000f;
float starty = currentBPPosition / 1000f;
float width = block.getIPD() / 1000f;
@@ -628,7 +628,7 @@ public class PCLRenderer extends PrintRenderer {
*/
protected void renderText(final TextArea text) {
renderInlineAreaBackAndBorders(text);
-
+
String fontname = getInternalFontNameForArea(text);
final int fontsize = text.getTraitAsInteger(Trait.FONT_SIZE);
@@ -640,9 +640,9 @@ public class PCLRenderer extends PrintRenderer {
try {
final Color col = (Color)text.getTrait(Trait.COLOR);
- boolean pclFont = allTextAsBitmaps
+ boolean pclFont = allTextAsBitmaps
? false
- : setFont(fontname, fontsize, text.getText());
+ : setFont(fontname, fontsize, text.getText());
if (pclFont) {
//this.currentFill = col;
if (col != null) {
@@ -650,7 +650,7 @@ public class PCLRenderer extends PrintRenderer {
gen.setTransparencyMode(true, false);
gen.selectGrayscale(col);
}
-
+
saveGraphicsState();
graphicContext.translate(rx, bl);
setCursorPos(0, 0);
@@ -667,25 +667,25 @@ public class PCLRenderer extends PrintRenderer {
//Use Java2D to paint different fonts via bitmap
final Font font = getFontFromArea(text);
final int baseline = text.getBaselineOffset();
-
+
//for cursive fonts, so the text isn't clipped
int extraWidth = font.getFontSize() / 3;
final FontMetricsMapper mapper = (FontMetricsMapper)fontInfo.getMetricsFor(
font.getFontName());
int maxAscent = mapper.getMaxAscent(font.getFontSize()) / 1000;
final int additionalBPD = maxAscent - baseline;
-
+
Graphics2DAdapter g2a = getGraphics2DAdapter();
final Rectangle paintRect = new Rectangle(
rx, currentBPPosition + text.getOffset() - additionalBPD,
text.getIPD() + extraWidth, text.getBPD() + additionalBPD);
- RendererContext rc = createRendererContext(paintRect.x, paintRect.y,
+ RendererContext rc = createRendererContext(paintRect.x, paintRect.y,
paintRect.width, paintRect.height, null);
Map atts = new java.util.HashMap();
atts.put(CONV_MODE, "bitmap");
atts.put(SRC_TRANSPARENCY, "true");
rc.setProperty(RendererContextConstants.FOREIGN_ATTRIBUTES, atts);
-
+
Graphics2DImagePainter painter = new Graphics2DImagePainter() {
public void paint(Graphics2D g2d, Rectangle2D area) {
@@ -696,17 +696,17 @@ public class PCLRenderer extends PrintRenderer {
Java2DRenderer.renderText(text, g2d, font);
renderTextDecoration(g2d, mapper, fontsize, text, 0, 0);
}
-
+
public Dimension getImageSize() {
return paintRect.getSize();
}
-
+
};
- g2a.paintImage(painter, rc,
+ g2a.paintImage(painter, rc,
paintRect.x, paintRect.y, paintRect.width, paintRect.height);
currentIPPosition = saveIP + text.getAllocIPD();
}
-
+
} catch (IOException ioe) {
handleIOTrouble(ioe);
}
@@ -721,11 +721,11 @@ public class PCLRenderer extends PrintRenderer {
* @param baseline position of the baseline
* @param startx start IPD
*/
- private static void renderTextDecoration(Graphics2D g2d,
- FontMetrics fm, int fontsize, InlineArea inline,
+ private static void renderTextDecoration(Graphics2D g2d,
+ FontMetrics fm, int fontsize, InlineArea inline,
int baseline, int startx) {
- boolean hasTextDeco = inline.hasUnderline()
- || inline.hasOverline()
+ boolean hasTextDeco = inline.hasUnderline()
+ || inline.hasOverline()
|| inline.hasLineThrough();
if (hasTextDeco) {
float descender = fm.getDescender(fontsize) / 1000f;
@@ -737,7 +737,7 @@ public class PCLRenderer extends PrintRenderer {
g2d.setColor(ct);
float y = baseline - descender / 2f;
g2d.setStroke(new BasicStroke(lineWidth));
- g2d.draw(new Line2D.Float(startx / 1000f, y / 1000f,
+ g2d.draw(new Line2D.Float(startx / 1000f, y / 1000f,
endx, y / 1000f));
}
if (inline.hasOverline()) {
@@ -745,7 +745,7 @@ public class PCLRenderer extends PrintRenderer {
g2d.setColor(ct);
float y = (float)(baseline - (1.1 * capHeight));
g2d.setStroke(new BasicStroke(lineWidth));
- g2d.draw(new Line2D.Float(startx / 1000f, y / 1000f,
+ g2d.draw(new Line2D.Float(startx / 1000f, y / 1000f,
endx, y / 1000f));
}
if (inline.hasLineThrough()) {
@@ -753,12 +753,12 @@ public class PCLRenderer extends PrintRenderer {
g2d.setColor(ct);
float y = (float)(baseline - (0.45 * capHeight));
g2d.setStroke(new BasicStroke(lineWidth));
- g2d.draw(new Line2D.Float(startx / 1000f, y / 1000f,
+ g2d.draw(new Line2D.Float(startx / 1000f, y / 1000f,
endx, y / 1000f));
}
}
}
-
+
/**
* Sets the current cursor position. The coordinates are transformed to the absolute position
* on the logical PCL page and then passed on to the PCLGenerator.
@@ -784,7 +784,7 @@ public class PCLRenderer extends PrintRenderer {
}
/**
- * Closes the current subpath by appending a straight line segment from
+ * Closes the current subpath by appending a straight line segment from
* the current point to the starting point of the subpath.
*/
protected void closePath() {
@@ -792,8 +792,8 @@ public class PCLRenderer extends PrintRenderer {
}
/**
- * Appends a straight line segment from the current point to (x, y). The
- * new current point is (x, y).
+ * Appends a straight line segment from the current point to (x, y). The
+ * new current point is (x, y).
* @param x x coordinate
* @param y y coordinate
*/
@@ -805,7 +805,7 @@ public class PCLRenderer extends PrintRenderer {
}
/**
- * Moves the current point to (x, y), omitting any connecting line segment.
+ * Moves the current point to (x, y), omitting any connecting line segment.
* @param x x coordinate
* @param y y coordinate
*/
@@ -815,7 +815,7 @@ public class PCLRenderer extends PrintRenderer {
}
currentPath.moveTo(x, y);
}
-
+
/**
* Fill a rectangular area.
* @param x the x coordinate (in pt)
@@ -826,13 +826,13 @@ public class PCLRenderer extends PrintRenderer {
protected void fillRect(float x, float y, float width, float height) {
try {
setCursorPos(x * 1000, y * 1000);
- gen.fillRect((int)(width * 1000), (int)(height * 1000),
+ gen.fillRect((int)(width * 1000), (int)(height * 1000),
this.currentFillColor);
} catch (IOException ioe) {
handleIOTrouble(ioe);
}
}
-
+
/**
* Sets the new current fill color.
* @param color the color
@@ -866,9 +866,9 @@ public class PCLRenderer extends PrintRenderer {
String s = space.getSpace();
char sp = s.charAt(0);
Font font = getFontFromArea(textArea);
-
- int tws = (space.isAdjustable()
- ? textArea.getTextWordSpaceAdjust()
+
+ int tws = (space.isAdjustable()
+ ? textArea.getTextWordSpaceAdjust()
+ 2 * textArea.getTextLetterSpaceAdjust()
: 0);
@@ -893,10 +893,10 @@ public class PCLRenderer extends PrintRenderer {
float y = (currentBPPosition + viewport.getOffset()) / 1000f;
float width = viewport.getIPD() / 1000f;
float height = viewport.getBPD() / 1000f;
- // TODO: Calculate the border rect correctly.
+ // TODO: Calculate the border rect correctly.
float borderPaddingStart = viewport.getBorderAndPaddingWidthStart() / 1000f;
float borderPaddingBefore = viewport.getBorderAndPaddingWidthBefore() / 1000f;
- float bpwidth = borderPaddingStart
+ float bpwidth = borderPaddingStart
+ (viewport.getBorderAndPaddingWidthEnd() / 1000f);
float bpheight = borderPaddingBefore
+ (viewport.getBorderAndPaddingWidthAfter() / 1000f);
@@ -931,7 +931,7 @@ public class PCLRenderer extends PrintRenderer {
//This is the content-rect
float width = (float)bv.getIPD() / 1000f;
float height = (float)bv.getBPD() / 1000f;
-
+
if (bv.getPositioning() == Block.ABSOLUTE
|| bv.getPositioning() == Block.FIXED) {
@@ -943,17 +943,17 @@ public class PCLRenderer extends PrintRenderer {
if (bv.getPositioning() == Block.FIXED) {
breakOutList = breakOutOfStateStack();
}
-
+
AffineTransform positionTransform = new AffineTransform();
positionTransform.translate(bv.getXOffset(), bv.getYOffset());
-
+
//"left/"top" (bv.getX/YOffset()) specify the position of the content rectangle
positionTransform.translate(-borderPaddingStart, -borderPaddingBefore);
saveGraphicsState();
//Viewport position
concatenateTransformationMatrix(mptToPt(positionTransform));
-
+
//Background and borders
float bpwidth = (borderPaddingStart + bv.getBorderAndPaddingWidthEnd()) / 1000f;
float bpheight = (borderPaddingBefore + bv.getBorderAndPaddingWidthAfter()) / 1000f;
@@ -963,7 +963,7 @@ public class PCLRenderer extends PrintRenderer {
AffineTransform contentRectTransform = new AffineTransform();
contentRectTransform.translate(borderPaddingStart, borderPaddingBefore);
concatenateTransformationMatrix(mptToPt(contentRectTransform));
-
+
//Clipping
if (bv.getClip()) {
clipRect(0f, 0f, width, height);
@@ -973,7 +973,7 @@ public class PCLRenderer extends PrintRenderer {
//Set up coordinate system for content rectangle
AffineTransform contentTransform = ctm.toAffineTransform();
concatenateTransformationMatrix(mptToPt(contentTransform));
-
+
currentIPPosition = 0;
currentBPPosition = 0;
renderBlocks(bv, children);
@@ -984,7 +984,7 @@ public class PCLRenderer extends PrintRenderer {
if (breakOutList != null) {
restoreStateStackAfterBreakOut(breakOutList);
}
-
+
currentIPPosition = saveIP;
currentBPPosition = saveBP;
} else {
@@ -999,16 +999,16 @@ public class PCLRenderer extends PrintRenderer {
CTM tempctm = new CTM(containingIPPosition, currentBPPosition);
ctm = tempctm.multiply(ctm);
-
+
//Now adjust for border/padding
currentBPPosition += borderPaddingBefore;
Rectangle2D clippingRect = null;
if (bv.getClip()) {
- clippingRect = new Rectangle(currentIPPosition, currentBPPosition,
+ clippingRect = new Rectangle(currentIPPosition, currentBPPosition,
bv.getIPD(), bv.getBPD());
}
-
+
startVParea(ctm, clippingRect);
currentIPPosition = 0;
currentBPPosition = 0;
@@ -1017,7 +1017,7 @@ public class PCLRenderer extends PrintRenderer {
currentIPPosition = saveIP;
currentBPPosition = saveBP;
-
+
currentBPPosition += (int)(bv.getAllocBPD());
}
//currentFontName = saveFontName;
@@ -1034,7 +1034,7 @@ public class PCLRenderer extends PrintRenderer {
changePrintDirection();
}
}
-
+
private List breakOutOfStateStack() {
log.debug("Block.FIXED --> break out");
List breakOutList = new java.util.ArrayList();
@@ -1054,7 +1054,7 @@ public class PCLRenderer extends PrintRenderer {
}
/** {@inheritDoc} */
- protected RendererContext createRendererContext(int x, int y, int width, int height,
+ protected RendererContext createRendererContext(int x, int y, int width, int height,
Map foreignAttributes) {
RendererContext context = super.createRendererContext(
x, y, width, height, foreignAttributes);
@@ -1070,7 +1070,7 @@ public class PCLRenderer extends PrintRenderer {
private static final ImageFlavor[] FLAVORS = new ImageFlavor[]
{ImageFlavor.GRAPHICS2D,
- ImageFlavor.BUFFERED_IMAGE,
+ ImageFlavor.BUFFERED_IMAGE,
ImageFlavor.RENDERED_IMAGE,
ImageFlavor.XML_DOM};
/**
@@ -1089,18 +1089,18 @@ public class PCLRenderer extends PrintRenderer {
Point origin = new Point(currentIPPosition, currentBPPosition);
int x = origin.x + posInt.x;
int y = origin.y + posInt.y;
-
+
ImageManager manager = getUserAgent().getFactory().getImageManager();
ImageInfo info = null;
try {
ImageSessionContext sessionContext = getUserAgent().getImageSessionContext();
info = manager.getImageInfo(uri, sessionContext);
-
+
//Only now fully load/prepare the image
Map hints = ImageUtil.getDefaultHints(sessionContext);
org.apache.xmlgraphics.image.loader.Image img = manager.getImage(
info, FLAVORS, hints, sessionContext);
-
+
//...and process the image
if (img instanceof ImageGraphics2D) {
ImageGraphics2D imageG2D = (ImageGraphics2D)img;
@@ -1113,8 +1113,8 @@ public class PCLRenderer extends PrintRenderer {
ImageRendered imgRend = (ImageRendered)img;
RenderedImage ri = imgRend.getRenderedImage();
setCursorPos(x, y);
- gen.paintBitmap(ri,
- new Dimension(posInt.width, posInt.height),
+ gen.paintBitmap(ri,
+ new Dimension(posInt.width, posInt.height),
false);
} else if (img instanceof ImageXMLDOM) {
ImageXMLDOM imgXML = (ImageXMLDOM)img;
@@ -1160,18 +1160,18 @@ public class PCLRenderer extends PrintRenderer {
float height = area.getBPD() / 1000f;
float borderPaddingStart = area.getBorderAndPaddingWidthStart() / 1000f;
float borderPaddingBefore = area.getBorderAndPaddingWidthBefore() / 1000f;
- float bpwidth = borderPaddingStart
+ float bpwidth = borderPaddingStart
+ (area.getBorderAndPaddingWidthEnd() / 1000f);
float bpheight = borderPaddingBefore
+ (area.getBorderAndPaddingWidthAfter() / 1000f);
-
+
if (height != 0.0f || bpheight != 0.0f && bpwidth != 0.0f) {
drawBackAndBorders(area, x, y - borderPaddingBefore
, width + bpwidth
, height + bpheight);
}
}
-
+
/**
* Draw the background and borders. This draws the background and border
* traits for an area given the position.
@@ -1188,18 +1188,18 @@ public class PCLRenderer extends PrintRenderer {
BorderProps bpsAfter = (BorderProps) area.getTrait(Trait.BORDER_AFTER);
BorderProps bpsStart = (BorderProps) area.getTrait(Trait.BORDER_START);
BorderProps bpsEnd = (BorderProps) area.getTrait(Trait.BORDER_END);
-
+
// draw background
Trait.Background back;
back = (Trait.Background) area.getTrait(Trait.BACKGROUND);
if (back != null) {
-
+
// Calculate padding rectangle
float sx = startx;
float sy = starty;
float paddRectWidth = width;
float paddRectHeight = height;
-
+
if (bpsStart != null) {
sx += bpsStart.width / 1000f;
paddRectWidth -= bpsStart.width / 1000f;
@@ -1214,15 +1214,15 @@ public class PCLRenderer extends PrintRenderer {
if (bpsAfter != null) {
paddRectHeight -= bpsAfter.width / 1000f;
}
-
+
if (back.getColor() != null) {
updateFillColor(back.getColor());
fillRect(sx, sy, paddRectWidth, paddRectHeight);
}
-
+
// background image
if (back.getImageInfo() != null) {
- ImageSize imageSize = back.getImageInfo().getSize();
+ ImageSize imageSize = back.getImageInfo().getSize();
saveGraphicsState();
clipRect(sx, sy, paddRectWidth, paddRectHeight);
int horzCount = (int) ((paddRectWidth * 1000 / imageSize.getWidthMpt()) + 1.0f);
@@ -1250,7 +1250,7 @@ public class PCLRenderer extends PrintRenderer {
Rectangle2D pos;
// Image positions are relative to the currentIP/BP
pos = new Rectangle2D.Float(
- sx - currentIPPosition
+ sx - currentIPPosition
+ (x * imageSize.getWidthMpt()),
sy - currentBPPosition
+ (y * imageSize.getHeightMpt()),
@@ -1262,7 +1262,7 @@ public class PCLRenderer extends PrintRenderer {
restoreGraphicsState();
}
}
-
+
Rectangle2D.Float borderRect = new Rectangle2D.Float(startx, starty, width, height);
drawBorders(borderRect, bpsBefore, bpsAfter, bpsStart, bpsEnd);
}
@@ -1275,8 +1275,8 @@ public class PCLRenderer extends PrintRenderer {
* @param bpsStart the border specification on the start side
* @param bpsEnd the border specification on the end side
*/
- protected void drawBorders(Rectangle2D.Float borderRect,
- final BorderProps bpsBefore, final BorderProps bpsAfter,
+ protected void drawBorders(Rectangle2D.Float borderRect,
+ final BorderProps bpsBefore, final BorderProps bpsAfter,
final BorderProps bpsStart, final BorderProps bpsEnd) {
if (bpsBefore == null && bpsAfter == null && bpsStart == null && bpsEnd == null) {
return; //no borders to paint
@@ -1287,7 +1287,7 @@ public class PCLRenderer extends PrintRenderer {
drawFastBorders(borderRect, bpsBefore, bpsAfter, bpsStart, bpsEnd);
}
}
-
+
/**
* Draws borders. Borders are drawn as shaded rectangles with no clipping.
* @param borderRect the border rectangle
@@ -1296,8 +1296,8 @@ public class PCLRenderer extends PrintRenderer {
* @param bpsStart the border specification on the start side
* @param bpsEnd the border specification on the end side
*/
- protected void drawFastBorders(Rectangle2D.Float borderRect,
- final BorderProps bpsBefore, final BorderProps bpsAfter,
+ protected void drawFastBorders(Rectangle2D.Float borderRect,
+ final BorderProps bpsBefore, final BorderProps bpsAfter,
final BorderProps bpsStart, final BorderProps bpsEnd) {
float startx = borderRect.x;
float starty = borderRect.y;
@@ -1311,7 +1311,7 @@ public class PCLRenderer extends PrintRenderer {
if (bpsAfter != null) {
float borderWidth = bpsAfter.width / 1000f;
updateFillColor(bpsAfter.color);
- fillRect(startx, (starty + height - borderWidth),
+ fillRect(startx, (starty + height - borderWidth),
width, borderWidth);
}
if (bpsStart != null) {
@@ -1325,7 +1325,7 @@ public class PCLRenderer extends PrintRenderer {
fillRect((startx + width - borderWidth), starty, borderWidth, height);
}
}
-
+
/**
* Draws borders. Borders are drawn in-memory and painted as a bitmap.
* @param borderRect the border rectangle
@@ -1334,8 +1334,8 @@ public class PCLRenderer extends PrintRenderer {
* @param bpsStart the border specification on the start side
* @param bpsEnd the border specification on the end side
*/
- protected void drawQualityBorders(Rectangle2D.Float borderRect,
- final BorderProps bpsBefore, final BorderProps bpsAfter,
+ protected void drawQualityBorders(Rectangle2D.Float borderRect,
+ final BorderProps bpsBefore, final BorderProps bpsAfter,
final BorderProps bpsStart, final BorderProps bpsEnd) {
Graphics2DAdapter g2a = getGraphics2DAdapter();
final Rectangle.Float effBorderRect = new Rectangle2D.Float(
@@ -1345,7 +1345,7 @@ public class PCLRenderer extends PrintRenderer {
borderRect.height);
final Rectangle paintRect = new Rectangle(
(int)Math.round(borderRect.x * 1000f),
- (int)Math.round(borderRect.y * 1000f),
+ (int)Math.round(borderRect.y * 1000f),
(int)Math.floor(borderRect.width * 1000f) + 1,
(int)Math.floor(borderRect.height * 1000f) + 1);
//Add one pixel wide safety margin around the paint area
@@ -1356,14 +1356,14 @@ public class PCLRenderer extends PrintRenderer {
paintRect.y += yoffset;
paintRect.width += 2 * pixelWidth;
paintRect.height += 2 * pixelWidth;
-
- RendererContext rc = createRendererContext(paintRect.x, paintRect.y,
+
+ RendererContext rc = createRendererContext(paintRect.x, paintRect.y,
paintRect.width, paintRect.height, null);
Map atts = new java.util.HashMap();
atts.put(CONV_MODE, "bitmap");
atts.put(SRC_TRANSPARENCY, "true");
rc.setProperty(RendererContextConstants.FOREIGN_ATTRIBUTES, atts);
-
+
Graphics2DImagePainter painter = new Graphics2DImagePainter() {
public void paint(Graphics2D g2d, Rectangle2D area) {
@@ -1374,7 +1374,7 @@ public class PCLRenderer extends PrintRenderer {
float width = effBorderRect.width;
float height = effBorderRect.height;
boolean[] b = new boolean[] {
- (bpsBefore != null), (bpsEnd != null),
+ (bpsBefore != null), (bpsEnd != null),
(bpsAfter != null), (bpsStart != null)};
if (!b[0] && !b[1] && !b[2] && !b[3]) {
return;
@@ -1385,9 +1385,9 @@ public class PCLRenderer extends PrintRenderer {
(b[2] ? bpsAfter.width / 1000f : 0.0f),
(b[3] ? bpsStart.width / 1000f : 0.0f)};
float[] clipw = new float[] {
- BorderProps.getClippedWidth(bpsBefore) / 1000f,
- BorderProps.getClippedWidth(bpsEnd) / 1000f,
- BorderProps.getClippedWidth(bpsAfter) / 1000f,
+ BorderProps.getClippedWidth(bpsBefore) / 1000f,
+ BorderProps.getClippedWidth(bpsEnd) / 1000f,
+ BorderProps.getClippedWidth(bpsAfter) / 1000f,
BorderProps.getClippedWidth(bpsStart) / 1000f};
starty += clipw[0];
height -= clipw[0];
@@ -1395,7 +1395,7 @@ public class PCLRenderer extends PrintRenderer {
startx += clipw[3];
width -= clipw[3];
width -= clipw[1];
-
+
boolean[] slant = new boolean[] {
(b[3] && b[0]), (b[0] && b[1]), (b[1] && b[2]), (b[2] && b[3])};
if (bpsBefore != null) {
@@ -1433,7 +1433,7 @@ public class PCLRenderer extends PrintRenderer {
currentPath = null;
Rectangle2D.Float lineRect = new Rectangle2D.Float(
sx1a, outery, ex1a - sx1a, innery - outery);
- Java2DRenderer.drawBorderLine(lineRect, true, true,
+ Java2DRenderer.drawBorderLine(lineRect, true, true,
bpsBefore.style, bpsBefore.color, g);
//restoreGraphicsState();
}
@@ -1447,7 +1447,7 @@ public class PCLRenderer extends PrintRenderer {
float outerx = startx + width + clipw[1];
float clipx = outerx - clipw[1];
float innerx = outerx - bw[1];
-
+
//saveGraphicsState();
Graphics2D g = (Graphics2D)g2d.create();
moveTo(clipx, sy1);
@@ -1472,7 +1472,7 @@ public class PCLRenderer extends PrintRenderer {
currentPath = null;
Rectangle2D.Float lineRect = new Rectangle2D.Float(
innerx, sy1a, outerx - innerx, ey1a - sy1a);
- Java2DRenderer.drawBorderLine(lineRect, false, false,
+ Java2DRenderer.drawBorderLine(lineRect, false, false,
bpsEnd.style, bpsEnd.color, g);
//restoreGraphicsState();
}
@@ -1511,7 +1511,7 @@ public class PCLRenderer extends PrintRenderer {
currentPath = null;
Rectangle2D.Float lineRect = new Rectangle2D.Float(
sx1a, innery, ex1a - sx1a, outery - innery);
- Java2DRenderer.drawBorderLine(lineRect, true, false,
+ Java2DRenderer.drawBorderLine(lineRect, true, false,
bpsAfter.style, bpsAfter.color, g);
//restoreGraphicsState();
}
@@ -1550,7 +1550,7 @@ public class PCLRenderer extends PrintRenderer {
currentPath = null;
Rectangle2D.Float lineRect = new Rectangle2D.Float(
outerx, sy1a, innerx - outerx, ey1a - sy1a);
- Java2DRenderer.drawBorderLine(lineRect, false, false,
+ Java2DRenderer.drawBorderLine(lineRect, false, false,
bpsStart.style, bpsStart.color, g);
//restoreGraphicsState();
}
@@ -1559,10 +1559,10 @@ public class PCLRenderer extends PrintRenderer {
public Dimension getImageSize() {
return paintRect.getSize();
}
-
+
};
try {
- g2a.paintImage(painter, rc,
+ g2a.paintImage(painter, rc,
paintRect.x - xoffset, paintRect.y, paintRect.width, paintRect.height);
} catch (IOException ioe) {
handleIOTrouble(ioe);
@@ -1577,7 +1577,7 @@ public class PCLRenderer extends PrintRenderer {
public void setAllTextAsBitmaps(boolean allTextAsBitmaps) {
this.allTextAsBitmaps = allTextAsBitmaps;
}
-
-
-
+
+
+
}
diff --git a/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java b/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java
index ea4cc50bb..aa0fc88b9 100644
--- a/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java
+++ b/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.fop.render.ps;
@@ -91,28 +91,28 @@ public abstract class AbstractPSTranscoder extends AbstractFOPTranscoder {
* @exception TranscoderException if an error occured while transcoding
*/
protected void transcode(Document document, String uri,
- TranscoderOutput output)
+ TranscoderOutput output)
throws TranscoderException {
graphics = createDocumentGraphics2D();
if (!isTextStroked()) {
- FontInfo fontInfo = new FontInfo();
- //TODO Do custom font configuration here somewhere/somehow
- FontSetup.setup(fontInfo);
+ FontInfo fontInfo = new FontInfo();
+ //TODO Do custom font configuration here somewhere/somehow
+ FontSetup.setup(fontInfo);
graphics.setCustomTextHandler(new NativeTextHandler(graphics, fontInfo));
}
super.transcode(document, uri, output);
getLogger().trace("document size: " + width + " x " + height);
-
+
// prepare the image to be painted
- UnitProcessor.Context uctx = UnitProcessor.createContext(ctx,
+ UnitProcessor.Context uctx = UnitProcessor.createContext(ctx,
document.getDocumentElement());
- float widthInPt = UnitProcessor.userSpaceToSVG(width, SVGLength.SVG_LENGTHTYPE_PT,
+ float widthInPt = UnitProcessor.userSpaceToSVG(width, SVGLength.SVG_LENGTHTYPE_PT,
UnitProcessor.HORIZONTAL_LENGTH, uctx);
int w = (int)(widthInPt + 0.5);
- float heightInPt = UnitProcessor.userSpaceToSVG(height, SVGLength.SVG_LENGTHTYPE_PT,
+ float heightInPt = UnitProcessor.userSpaceToSVG(height, SVGLength.SVG_LENGTHTYPE_PT,
UnitProcessor.HORIZONTAL_LENGTH, uctx);
int h = (int)(heightInPt + 0.5);
getLogger().trace("document size: " + w + "pt x " + h + "pt");
@@ -140,7 +140,7 @@ public abstract class AbstractPSTranscoder extends AbstractFOPTranscoder {
throw new TranscoderException(ex);
}
}
-
+
/** {@inheritDoc} */
protected BridgeContext createBridgeContext() {
@@ -148,7 +148,7 @@ public abstract class AbstractPSTranscoder extends AbstractFOPTranscoder {
if (!isTextStroked()) {
TextHandler handler = graphics.getCustomTextHandler();
if (handler instanceof NativeTextHandler) {
- NativeTextHandler nativeTextHandler = (NativeTextHandler)handler;
+ NativeTextHandler nativeTextHandler = (NativeTextHandler)handler;
PSTextPainter textPainter = new PSTextPainter(nativeTextHandler);
ctx.setTextPainter(textPainter);
ctx.putBridge(new PSTextElementBridge(textPainter));
diff --git a/src/java/org/apache/fop/render/ps/NativeTextHandler.java b/src/java/org/apache/fop/render/ps/NativeTextHandler.java
index 174fe8077..9f62097e9 100644
--- a/src/java/org/apache/fop/render/ps/NativeTextHandler.java
+++ b/src/java/org/apache/fop/render/ps/NativeTextHandler.java
@@ -38,16 +38,16 @@ import org.apache.xmlgraphics.ps.PSGenerator;
public class NativeTextHandler implements PSTextHandler {
private PSGraphics2D g2d;
-
+
/** FontInfo containing all available fonts */
protected FontInfo fontInfo;
/** Currently valid Font */
protected Font font;
-
+
/** Overriding FontState */
protected Font overrideFont = null;
-
+
/** the current (internal) font name */
protected String currentFontName;
@@ -67,13 +67,13 @@ public class NativeTextHandler implements PSTextHandler {
setupFontInfo();
}
}
-
+
private void setupFontInfo() {
//Sets up a FontInfo with default fonts
fontInfo = new FontInfo();
FontSetup.setup(fontInfo);
}
-
+
/**
* Return the font information associated with this object
* @return the FontInfo object
@@ -85,7 +85,7 @@ public class NativeTextHandler implements PSTextHandler {
private PSGenerator getPSGenerator() {
return this.g2d.getPSGenerator();
}
-
+
/** {@inheritDoc} */
public void writeSetup() throws IOException {
if (fontInfo != null) {
@@ -99,9 +99,9 @@ public class NativeTextHandler implements PSTextHandler {
}
/**
- * Draw a string to the PostScript document. The text is painted using
+ * Draw a string to the PostScript document. The text is painted using
* text operations.
- * {@inheritDoc}
+ * {@inheritDoc}
*/
public void drawString(String s, float x, float y) throws IOException {
g2d.preparePainting();
@@ -112,7 +112,7 @@ public class NativeTextHandler implements PSTextHandler {
this.font = this.overrideFont;
this.overrideFont = null;
}
-
+
//Color and Font state
g2d.establishColor(g2d.getColor());
establishCurrentFont();
@@ -130,14 +130,14 @@ public class NativeTextHandler implements PSTextHandler {
gen.writeln(gen.formatDouble(x) + " "
+ gen.formatDouble(y) + " moveto ");
gen.writeln("1 -1 scale");
-
+
StringBuffer sb = new StringBuffer("(");
escapeText(s, sb);
sb.append(") t ");
gen.writeln(sb.toString());
-
- gen.restoreGraphicsState();
+
+ gen.restoreGraphicsState();
}
private void escapeText(final String text, StringBuffer target) {
@@ -157,7 +157,7 @@ public class NativeTextHandler implements PSTextHandler {
int fontSize = 1000 * f.getSize();
String style = f.isItalic() ? "italic" : "normal";
int weight = f.isBold() ? Font.WEIGHT_BOLD : Font.WEIGHT_NORMAL;
-
+
FontTriplet triplet = fontInfo.findAdjustWeight(fontFamily, style, weight);
if (triplet == null) {
triplet = fontInfo.findAdjustWeight("sans-serif", style, weight);
@@ -166,10 +166,10 @@ public class NativeTextHandler implements PSTextHandler {
}
private void establishCurrentFont() throws IOException {
- if ((currentFontName != this.font.getFontName())
+ if ((currentFontName != this.font.getFontName())
|| (currentFontSize != this.font.getFontSize())) {
PSGenerator gen = getPSGenerator();
- gen.writeln(this.font.getFontName() + " "
+ gen.writeln(this.font.getFontName() + " "
+ gen.formatDouble(font.getFontSize() / 1000f) + " F");
currentFontName = this.font.getFontName();
currentFontSize = this.font.getFontSize();
@@ -183,6 +183,6 @@ public class NativeTextHandler implements PSTextHandler {
public void setOverrideFont(Font override) {
this.overrideFont = override;
}
-
+
}