xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject svn commit: r371912 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: area/LineArea.java layoutmgr/inline/LineLayoutManager.java
Date Tue, 24 Jan 2006 13:46:03 GMT
Author: jeremias
Date: Tue Jan 24 05:45:56 2006
New Revision: 371912

URL: http://svn.apache.org/viewcvs?rev=371912&view=rev
Log:
Bugfix: LineArea used a private field instead of the start-indent trait which caused problems
for centered and right-aligned text when rendering is done from the intermediate format. The
AreaTreeParser parses and sets the trait but not the startIndent field on LineArea, so I removed
the startIndent field.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/area/LineArea.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/area/LineArea.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/area/LineArea.java?rev=371912&r1=371911&r2=371912&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/area/LineArea.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/area/LineArea.java Tue Jan 24 05:45:56 2006
@@ -57,14 +57,6 @@
     
     private LineAdjustingInfo adjustingInfo = null;
 
-    //private int stacking = LR;
-    // contains inline areas
-    // has start indent and length, dominant baseline, height
-    private int startIndent;
-
-    // this is the offset for the dominant baseline
-    //private int baseLine;
-
     // this class can contain the dominant char styling info
     // this means that many renderers can optimise a bit
 
@@ -122,17 +114,6 @@
     }
 
     /**
-     * Set the start indent of this line area.
-     * The start indent is used for offsetting the start of
-     * the inline areas for alignment or other indents.
-     *
-     * @param si the start indent value
-     */
-    public void setStartIndent(int si) {
-        startIndent = si;
-    }
-
-    /**
      * Get the start indent of this line area.
      * The start indent is used for offsetting the start of
      * the inline areas for alignment or other indents.
@@ -140,7 +121,11 @@
      * @return the start indent value
      */
     public int getStartIndent() {
-        return startIndent;
+        if (hasTrait(Trait.START_INDENT)) {
+            return getTraitAsInteger(Trait.START_INDENT);
+        } else {
+            return 0;
+        }
     }
 
     /**
@@ -179,11 +164,11 @@
                 break;
             case Constants.EN_CENTER:
                 // re-compute indent
-                startIndent -= ipdVariation / 2;
+                addTrait(Trait.START_INDENT, new Integer(getStartIndent() - ipdVariation
/ 2));
                 break;
             case Constants.EN_END:
                 // re-compute indent
-                startIndent -= ipdVariation;
+                addTrait(Trait.START_INDENT, new Integer(getStartIndent() - ipdVariation));
                 break;
             case Constants.EN_JUSTIFY:
                 // compute variation factor

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=371912&r1=371911&r2=371912&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 Jan 24 05:45:56 2006
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-/* $Id: LineLayoutManager.java,v 1.17 2004/04/02 10:38:29 cbowditch Exp $ */
+/* $Id$ */
 
 package org.apache.fop.layoutmgr.inline;
 
@@ -1664,7 +1664,7 @@
               = new LineArea((lbp.getLeafPos() < seq.size() - 1
                               ? textAlignment : textAlignmentLast),
                               lbp.difference, lbp.availableStretch, lbp.availableShrink);
-            lineArea.setStartIndent(lbp.startIndent);
+            lineArea.addTrait(Trait.START_INDENT, new Integer(lbp.startIndent));
             lineArea.setBPD(lbp.lineHeight);
             lineArea.setIPD(lbp.lineWidth);
             lineArea.addTrait(Trait.SPACE_BEFORE, new Integer(lbp.spaceBefore));
@@ -1745,12 +1745,12 @@
                 // re-compute indent
                 int updatedIndent = lbp.startIndent
                                     + (context.getStackLimit().opt - lbp.lineWidth) / 2;
-                lineArea.setStartIndent(updatedIndent);
+                lineArea.addTrait(Trait.START_INDENT, new Integer(updatedIndent));
             } else if (false && textAlignment == EN_END) {
                 // re-compute indent
                 int updatedIndent = lbp.startIndent 
                                     + (context.getStackLimit().opt - lbp.lineWidth);
-                lineArea.setStartIndent(updatedIndent);
+                lineArea.addTrait(Trait.START_INDENT, new Integer(updatedIndent));
             }
             
             setCurrentArea(lineArea);



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


Mime
View raw message