You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2010/10/16 19:38:51 UTC
svn commit: r1023338 -
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java
Author: lehmi
Date: Sat Oct 16 17:38:51 2010
New Revision: 1023338
URL: http://svn.apache.org/viewvc?rev=1023338&view=rev
Log:
PDFBOX-846: fixed wrong calculation of the space width
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java?rev=1023338&r1=1023337&r2=1023338&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java Sat Oct 16 17:38:51 2010
@@ -37,7 +37,6 @@ import org.apache.pdfbox.cos.COSObject;
import org.apache.pdfbox.cos.COSStream;
import org.apache.pdfbox.exceptions.WrappedIOException;
-import org.apache.pdfbox.pdfparser.BaseParser;
import org.apache.pdfbox.pdfparser.PDFStreamParser;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.PDResources;
@@ -361,8 +360,6 @@ public class PDFStreamEngine
spaceWidthText *= .80f;
}
- final float spaceWidthDisp = spaceWidthText * fontSizeText * horizontalScalingText;
-
float maxVerticalDisplacementText = 0;
Matrix textStateParameters = new Matrix();
@@ -387,6 +384,9 @@ public class PDFStreamEngine
c = font.encode( string, i, codeLength );
}
+ // the space width has to be transformed into display units
+ float spaceWidthDisp = spaceWidthText * fontSizeText * horizontalScalingText * textMatrix.getValue(0, 0) * getGraphicsState().getCurrentTransformationMatrix().getValue(0, 0);
+
//todo, handle horizontal displacement
// get the width and height of this character in text units
float characterHorizontalDisplacementText = font.getFontWidth( string, i, codeLength );