]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Merge from trunk
authorSimon Pepping <spepping@apache.org>
Sat, 18 Dec 2010 11:36:28 +0000 (11:36 +0000)
committerSimon Pepping <spepping@apache.org>
Sat, 18 Dec 2010 11:36:28 +0000 (11:36 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_ComplexScripts@1050618 13f79535-47bb-0310-9956-ffa450edef68

1  2 
src/java/org/apache/fop/area/LineArea.java
src/java/org/apache/fop/area/inline/InlineArea.java
src/java/org/apache/fop/area/inline/InlineParent.java

index b4aabeea10c76e2087aa05a74c104e33975a4df0,b33b5da1433270e1ce0704916dc477a666f7447f..bca42186e982877dd890fe5833ff8307f14ed16c
@@@ -206,8 -206,11 +215,11 @@@ public class LineArea extends Area 
       * and destroy the AdjustingInfo object if there are
       * no UnresolvedAreas left
       */
 -    public void finalise() {
 +    public void finish() {
          if (adjustingInfo.lineAlignment == Constants.EN_JUSTIFY) {
+             if (log.isTraceEnabled()) {
+                 log.trace("Applying variation factor to justified line: " + adjustingInfo);
+             }
              // justified line: apply the variation factor
              boolean bUnresolvedAreasPresent = false;
              // recursively apply variation factor to descendant areas
index 78617018695b6d991a73f10d2d6ee13a418cc7be,86c9141e681902e096b7909de3494e8b040ba2a3..9e69e00a703ab4db4604b619fffd0f1513567c1e
  
  package org.apache.fop.area.inline;
  
- import org.apache.fop.area.Area;
- import java.util.ArrayList;
- import java.util.Iterator;
  import java.util.List;
++import java.util.Iterator;
+ import org.apache.fop.area.Area;
  
  /**
   * Inline parent area.
@@@ -87,35 -86,17 +88,40 @@@ public class InlineParent extends Inlin
      public boolean applyVariationFactor(double variationFactor,
                                          int lineStretch, int lineShrink) {
          boolean bUnresolvedAreasPresent = false;
+         int cumulativeIPD = 0;
          // recursively apply variation factor to descendant areas
          for (int i = 0, len = inlines.size(); i < len; i++) {
-             bUnresolvedAreasPresent |= ((InlineArea)inlines.get(i))
-                 .applyVariationFactor(variationFactor, lineStretch, lineShrink);
+             InlineArea inline = inlines.get(i);
+             bUnresolvedAreasPresent |= inline.applyVariationFactor(
+                     variationFactor, lineStretch, lineShrink);
+             cumulativeIPD += inline.getIPD();  //Update this area's IPD based on changes to children
          }
+         setIPD(cumulativeIPD);
          return bUnresolvedAreasPresent;
      }
 -}
  
 +    /**
 +     * Reset bidirectionality level of all children to default (-1),
 +     * signalling that they will inherit the level of their parent text area.
 +     */
 +    public void resetChildrenLevel() {
 +        for ( Iterator it = inlines.iterator(); it.hasNext();) {
 +            ( (InlineArea) it.next() ) .resetBidiLevel();
 +        }
 +    }
 +    private void updateLevel ( int newLevel ) {
 +        if ( newLevel >= 0 ) {
 +            int curLevel = getBidiLevel();
 +            if ( curLevel >= 0 ) {
 +                if ( newLevel < curLevel ) {
 +                    setBidiLevel ( newLevel );
 +                }
 +            } else {
 +                setBidiLevel ( newLevel );
 +            }
 +        }
 +    }
 +
 +
 +}