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 je...@apache.org on 2005/08/30 17:35:44 UTC

svn commit: r264797 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java test/layoutengine/disabled-testcases.txt test/layoutengine/testcases/text-align2.xml

Author: jeremias
Date: Tue Aug 30 08:35:37 2005
New Revision: 264797

URL: http://svn.apache.org/viewcvs?rev=264797&view=rev
Log:
Fix for text-align2.xml (for real now). The alignment used to set up the element list was not properly determined.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
    xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.txt
    xmlgraphics/fop/trunk/test/layoutengine/testcases/text-align2.xml

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java?rev=264797&r1=264796&r2=264797&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java Tue Aug 30 08:35:37 2005
@@ -75,13 +75,17 @@
         hyphProps = fobj.getCommonHyphenation();
         
         //
+        effectiveAlignment = getEffectiveAlignment(bTextAlignment, bTextAlignmentLast);
+    }
+
+    private int getEffectiveAlignment(int alignment, int alignmentLast) {
         if (bTextAlignment != EN_JUSTIFY && bTextAlignmentLast == EN_JUSTIFY) {
-            effectiveAlignment = 0;
+            return 0;
         } else {
-            effectiveAlignment = bTextAlignment;
+            return bTextAlignment;
         }
     }
-
+    
     /**
      * Private class to store information about inline breaks.
      * Each value holds the start and end indexes into a List of
@@ -277,9 +281,10 @@
          */
         private void removeElementsForTrailingSpaces() {
             KnuthElement removedElement;
+            int effectiveAlignment = getEffectiveAlignment(textAlignment, textAlignmentLast);
             while (this.size() > ignoreAtStart
                    && ((KnuthElement) this.get(this.size() - 1)).isGlue()) {
-                if (textAlignmentLast == EN_CENTER) {
+                if (effectiveAlignment == EN_CENTER) {
                     // centered text: the pattern is
                     //     <glue> <penaly> <glue> <box> <penaly> <glue>
                     removedElement = (KnuthGlue) this.remove(this.size() - 1);
@@ -288,7 +293,7 @@
                     removedElement = (KnuthGlue) this.remove(this.size() - 1);
                     removedElement = (KnuthPenalty) this.remove(this.size() - 1);
                     removedElement = (KnuthGlue) this.remove(this.size() - 1);
-                } else if (textAlignmentLast == EN_START || textAlignmentLast == EN_END) {
+                } else if (effectiveAlignment == EN_START || effectiveAlignment == EN_END) {
                     // left- or right-aligned text: the pattern is
                     //     <glue> <penalty> <glue>
                     removedElement = (KnuthGlue) this.remove(this.size() - 1);
@@ -1411,6 +1416,7 @@
                     break;
                 }
             }
+            
             // collect word fragments, ignoring auxiliary elements;
             // each word fragment was created by a different TextLM
             if (firstElement.isBox() && !firstElement.isAuxiliary()) {

Modified: xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.txt
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.txt?rev=264797&r1=264796&r2=264797&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.txt (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.txt Tue Aug 30 08:35:37 2005
@@ -34,7 +34,6 @@
 table-border-separate1.xml
 table-column4.xml
 table-fixed2.xml
-text-align2.xml
 word-spacing1.xml
 word-spacing2.xml
 word-spacing3.xml

Modified: xmlgraphics/fop/trunk/test/layoutengine/testcases/text-align2.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/testcases/text-align2.xml?rev=264797&r1=264796&r2=264797&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/testcases/text-align2.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/testcases/text-align2.xml Tue Aug 30 08:35:37 2005
@@ -46,6 +46,6 @@
     <true xpath="not(boolean(//flow/block[2]/lineArea[1]/@start-indent))"/>
     <true xpath="not(boolean(//flow/block[3]/lineArea[1]/@start-indent))"/>
     <true xpath="//flow/block[1]/lineArea[1]/text/@ipd = //flow/block[2]/lineArea[1]/text/@ipd"/>
-    <true xpath="//flow/block[1]/lineArea[1]/text/@ipd = //flow/block[3]/lineArea[1]/text/@ipd"/>
+    <true xpath="//flow/block[1]/lineArea[1]/text/@ipd &gt; //flow/block[3]/lineArea[1]/text/@ipd"/>
   </checks>
 </testcase>



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org