Author: jeremias
Date: Thu Dec 11 08:41:53 2008
New Revision: 725738

URL: http://svn.apache.org/viewvc?rev=725738&view=rev
Log:
Fixed another little kerning bug.
Trim down dx array to the maximum size necessary.

Modified:
    
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFRenderer.java

Modified: 
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFRenderer.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFRenderer.java?rev=725738&r1=725737&r2=725738&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFRenderer.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFRenderer.java
 Thu Dec 11 08:41:53 2008
@@ -1025,7 +1025,7 @@
     private class TextUtil {
         private static final int INITIAL_BUFFER_SIZE = 16;
         private int[] dx = new int[INITIAL_BUFFER_SIZE];
-        private boolean hasDX = false;
+        private int lastDXPos = 0;
         private StringBuffer text = new StringBuffer();
         private int startx, starty;
 
@@ -1035,7 +1035,7 @@
 
         void adjust(int adjust) {
             if (adjust != 0) {
-                int idx = text.length();
+                int idx = text.length() - 1;
                 if (idx > dx.length - 1) {
                     int newSize = Math.max(dx.length, idx + 1) + 
INITIAL_BUFFER_SIZE;
                     int[] newDX = new int[newSize];
@@ -1043,7 +1043,7 @@
                     dx = newDX;
                 }
                 dx[idx] += adjust;
-                hasDX = true;
+                lastDXPos = idx;
             }
         }
 
@@ -1051,7 +1051,7 @@
             if (text.length() > 0) {
                 text.setLength(0);
                 Arrays.fill(dx, 0);
-                hasDX = false;
+                lastDXPos = 0;
             }
         }
 
@@ -1063,7 +1063,13 @@
         void flush() {
             if (text.length() > 0) {
                 try {
-                    painter.drawText(startx, starty, (hasDX ? dx : null), 
null, text.toString());
+                    int[] effDX = null;
+                    if (lastDXPos > 0) {
+                        int size = lastDXPos + 1;
+                        effDX = new int[size];
+                        System.arraycopy(dx, 0, effDX, 0, size);
+                    }
+                    painter.drawText(startx, starty, effDX, null, 
text.toString());
                 } catch (IFException e) {
                     handleIFException(e);
                 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to