aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2008-08-26 08:14:11 +0000
committerJeremias Maerki <jeremias@apache.org>2008-08-26 08:14:11 +0000
commit8f8a366431e21e06fe4658582ab8c7429d1d193a (patch)
tree20fe2556af15e7dd1577d7519ccfc4ede428e613
parent0864f618dc60cfe3dde181a06ae82b12a0f32931 (diff)
downloadxmlgraphics-fop-8f8a366431e21e06fe4658582ab8c7429d1d193a.tar.gz
xmlgraphics-fop-8f8a366431e21e06fe4658582ab8c7429d1d193a.zip
Fixed cursor advancement for fixed width spaces.
Set color before "BT" (beginText) to match the old PDFRenderer. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign@688990 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFPainter.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/render/pdf/PDFPainter.java b/src/java/org/apache/fop/render/pdf/PDFPainter.java
index e4418bb99..6501ea648 100644
--- a/src/java/org/apache/fop/render/pdf/PDFPainter.java
+++ b/src/java/org/apache/fop/render/pdf/PDFPainter.java
@@ -393,6 +393,7 @@ public class PDFPainter extends AbstractBinaryWritingIFPainter {
/** {@inheritDoc} */
public void drawText(int x, int y, int[] dx, int[] dy, String text) throws IFException {
//Note: dy is currently ignored
+ generator.updateColor(state.getTextColor(), true, null);
generator.beginTextObject();
FontTriplet triplet = new FontTriplet(
state.getFontFamily(), state.getFontStyle(), state.getFontWeight());
@@ -401,7 +402,6 @@ public class PDFPainter extends AbstractBinaryWritingIFPainter {
String fontKey = fontInfo.getInternalFontKey(triplet);
int sizeMillipoints = state.getFontSize();
float fontSize = sizeMillipoints / 1000f;
- generator.updateColor(state.getTextColor(), true, null);
// This assumes that *all* CIDFonts use a /ToUnicode mapping
Typeface tf = getTypeface(fontKey);
@@ -442,7 +442,8 @@ public class PDFPainter extends AbstractBinaryWritingIFPainter {
if (CharUtilities.isFixedWidthSpace(orgChar)) {
//Fixed width space are rendered as spaces so copy/paste works in a reader
ch = font.mapChar(CharUtilities.SPACE);
- glyphAdjust = -(font.getCharWidth(ch) - font.getCharWidth(orgChar));
+ int spaceDiff = font.getCharWidth(ch) - font.getCharWidth(orgChar);
+ glyphAdjust = -(10 * spaceDiff / fontSize);
} else {
ch = font.mapChar(orgChar);
}