]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Fix for text-align2.xml (for real now). The alignment used to set up the element...
authorJeremias Maerki <jeremias@apache.org>
Tue, 30 Aug 2005 15:35:37 +0000 (15:35 +0000)
committerJeremias Maerki <jeremias@apache.org>
Tue, 30 Aug 2005 15:35:37 +0000 (15:35 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@264797 13f79535-47bb-0310-9956-ffa450edef68

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

index f5a19c08fff963ceddb5e3196c2dd8a1e96e6202..eb669be69a5e15f1ea8b98ffd8d1469cb438dccd 100644 (file)
@@ -75,13 +75,17 @@ public class LineLayoutManager extends InlineStackingLayoutManager
         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 @@ public class LineLayoutManager extends InlineStackingLayoutManager
          */
         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 @@ public class LineLayoutManager extends InlineStackingLayoutManager
                     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 @@ public class LineLayoutManager extends InlineStackingLayoutManager
                     break;
                 }
             }
+            
             // collect word fragments, ignoring auxiliary elements;
             // each word fragment was created by a different TextLM
             if (firstElement.isBox() && !firstElement.isAuxiliary()) {
index ec859f27b4b61f12503efc46f50313daa4bb748a..9d2b0e01ac7ac4e09e018bcdd86075455ffed51c 100644 (file)
@@ -34,7 +34,6 @@ table-border-collapse2.xml
 table-border-separate1.xml
 table-column4.xml
 table-fixed2.xml
-text-align2.xml
 word-spacing1.xml
 word-spacing2.xml
 word-spacing3.xml
index 1230bafa966804ea5bad57de2658cd0c81eadb72..e6fdd55cd1f114e5b61b71be5b2ef67a0780256d 100644 (file)
@@ -46,6 +46,6 @@
     <true xpath="not(boolean(//flow/block[2]/lineArea[1]/@start-indent))"/>\r
     <true xpath="not(boolean(//flow/block[3]/lineArea[1]/@start-indent))"/>\r
     <true xpath="//flow/block[1]/lineArea[1]/text/@ipd = //flow/block[2]/lineArea[1]/text/@ipd"/>\r
-    <true xpath="//flow/block[1]/lineArea[1]/text/@ipd = //flow/block[3]/lineArea[1]/text/@ipd"/>\r
+    <true xpath="//flow/block[1]/lineArea[1]/text/@ipd &gt; //flow/block[3]/lineArea[1]/text/@ipd"/>\r
   </checks>\r
 </testcase>\r