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 ac...@apache.org on 2009/10/15 22:43:14 UTC

svn commit: r825646 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/fonts/ src/java/org/apache/fop/layoutmgr/ src/java/org/apache/fop/layoutmgr/inline/ src/java/org/apache/fop/layoutmgr/list/ src/java/org/apache/fop/layoutmgr/table/ test/java/org/...

Author: acumiskey
Date: Thu Oct 15 20:43:13 2009
New Revision: 825646

URL: http://svn.apache.org/viewvc?rev=825646&view=rev
Log:
Application of the patch submitted by Alexander Kiel to improve variable names around Kerning and KnuthElement (see https://issues.apache.org/bugzilla/show_bug.cgi?id=48003).


Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/Font.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/ElementListUtils.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthBox.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthElement.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthGlue.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthSequence.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowPainter.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
    xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/ElementListCheck.java
    xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ElementListUtilsTestCase.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/Font.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/Font.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/Font.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/Font.java Thu Oct 15 20:43:13 2009
@@ -170,6 +170,9 @@
 
     /**
      * Returns the amount of kerning between two characters.
+     *
+     * The value returned measures in pt. So it is already adjusted for font size.
+     *
      * @param ch1 first character
      * @param ch2 second character
      * @return the distance to adjust for kerning, 0 if there's no kerning
@@ -179,7 +182,7 @@
         if (kernPair != null) {
             Integer width = (Integer)kernPair.get(new Integer(ch2));
             if (width != null) {
-                return width.intValue();
+                return width.intValue() * getFontSize() / 1000;
             }
         }
         return 0;

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java Thu Oct 15 20:43:13 2009
@@ -588,7 +588,7 @@
                             .listIterator(startElementIndex);
                     while (effectiveListIterator.nextIndex() <= endElementIndex) {
                         KnuthElement tempEl = (KnuthElement)effectiveListIterator.next();
-                        if (tempEl.isBox() && tempEl.getW() > 0) {
+                        if (tempEl.isBox() && tempEl.getWidth() > 0) {
                             boxCount++;
                         }
                     }
@@ -861,9 +861,9 @@
                     case BlockLevelLayoutManager.LINE_NUMBER_ADJUSTMENT:
                         // potential line number adjustment
                         lineNumberMaxAdjustment.max += ((KnuthGlue) thisElement)
-                                .getY();
+                                .getStretch();
                         lineNumberMaxAdjustment.min -= ((KnuthGlue) thisElement)
-                                .getZ();
+                                .getShrink();
                         adjustableLinesList.add(thisElement);
                         break;
                     case BlockLevelLayoutManager.LINE_HEIGHT_ADJUSTMENT:
@@ -885,9 +885,9 @@
                             KnuthGlue blockSpace = (KnuthGlue) unconfirmedList
                                     .removeFirst();
                             spaceMaxAdjustment.max += ((KnuthGlue) blockSpace)
-                                    .getY();
+                                    .getStretch();
                             spaceMaxAdjustment.min -= ((KnuthGlue) blockSpace)
-                                    .getZ();
+                                    .getShrink();
                             blockSpacesList.add(blockSpace);
                         }
                     }
@@ -898,11 +898,11 @@
             log.debug("| space adj      = "
                     + spaceMaxAdjustment);
 
-            if (thisElement.isPenalty() && thisElement.getW() > 0) {
+            if (thisElement.isPenalty() && thisElement.getWidth() > 0) {
                 log.debug("  mandatory variation to the number of lines!");
                 ((BlockLevelLayoutManager) thisElement
                         .getLayoutManager()).negotiateBPDAdjustment(
-                        thisElement.getW(), thisElement);
+                        thisElement.getWidth(), thisElement);
             }
 
             if (thisBreak.bpdAdjust != 0
@@ -967,7 +967,7 @@
         int partial = 0;
         while (spaceListIterator.hasNext()) {
             KnuthGlue blockSpace = (KnuthGlue)spaceListIterator.next();
-            partial += (difference > 0 ? blockSpace.getY() : blockSpace.getZ());
+            partial += (difference > 0 ? blockSpace.getStretch() : blockSpace.getShrink());
             if (log.isDebugEnabled()) {
                 log.debug("available = " + partial +  " / " + total);
                 log.debug("competenza  = "
@@ -990,7 +990,7 @@
         int partial = 0;
         while (lineListIterator.hasNext()) {
             KnuthGlue line = (KnuthGlue)lineListIterator.next();
-            partial += (difference > 0 ? line.getY() : line.getZ());
+            partial += (difference > 0 ? line.getStretch() : line.getShrink());
             int newAdjust = ((BlockLevelLayoutManager) line.getLayoutManager()).negotiateBPDAdjustment(((int) ((float) partial * difference / total)) - adjustedDiff, line);
             adjustedDiff += newAdjust;
         }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Thu Oct 15 20:43:13 2009
@@ -1133,7 +1133,7 @@
                     // by this BlockLM, and must be ignored
                     if (element.getLayoutManager() != this) {
                         splitList.add(element);
-                        splitLength += element.getW();
+                        splitLength += element.getWidth();
                         lastLM = element.getLayoutManager();
                     }
                 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Thu Oct 15 20:43:13 2009
@@ -339,7 +339,7 @@
                 // by this BlockLM, and must be ignored
                 if (element.getLayoutManager() != this) {
                     splitList.add(element);
-                    splitLength += element.getW();
+                    splitLength += element.getWidth();
                     lastLM = element.getLayoutManager();
                 }
             }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java Thu Oct 15 20:43:13 2009
@@ -695,11 +695,11 @@
 /*LF*/          //log.debug("  BLM.negotiateBPDAdjustment> bpunit con penalty");
                 KnuthPenalty storedPenalty = (KnuthPenalty)
                                              storedList.get(mappingPos.getLastIndex());
-                if (storedPenalty.getW() > 0) {
+                if (storedPenalty.getWidth() > 0) {
                     // the original penalty has width > 0
 /*LF*/              //log.debug("  BLM.negotiateBPDAdjustment> chiamata passata");
                     return ((BlockLevelLayoutManager)storedPenalty.getLayoutManager())
-                           .negotiateBPDAdjustment(storedPenalty.getW(),
+                           .negotiateBPDAdjustment(storedPenalty.getWidth(),
                                    storedPenalty);
                 } else {
                     // the original penalty has width = 0
@@ -1406,17 +1406,17 @@
         while (oldListIterator.hasNext()) {
             KnuthElement element = (KnuthElement) oldListIterator.next();
             if (element.isBox()) {
-                totalLength.add(new MinOptMax(element.getW()));
-                //log.debug("box " + element.getW());
+                totalLength.add(new MinOptMax(element.getWidth()));
+                //log.debug("box " + element.getWidth());
             } else if (element.isGlue()) {
-                totalLength.min -= element.getZ();
-                totalLength.max += element.getY();
+                totalLength.min -= element.getShrink();
+                totalLength.max += element.getStretch();
                 //leafValue = ((LeafPosition) element.getPosition()).getLeafPos();
-                //log.debug("glue " + element.getW() + " + "
-                //    + ((KnuthGlue) element).getY() + " - " + ((KnuthGlue) element).getZ());
+                //log.debug("glue " + element.getWidth() + " + "
+                //    + ((KnuthGlue) element).getStretch() + " - " + ((KnuthGlue) element).getShrink());
             } else {
-                //log.debug((((KnuthPenalty)element).getP() == KnuthElement.INFINITE
-                //    ? "PENALTY " : "penalty ") + element.getW());
+                //log.debug((((KnuthPenalty)element).getPenalty() == KnuthElement.INFINITE
+                //    ? "PENALTY " : "penalty ") + element.getWidth());
             }
         }
         // compute the total amount of "units"
@@ -1443,22 +1443,22 @@
             KnuthElement element = (KnuthElement) oldListIterator.next();
             lastIndex++;
             if (element.isBox()) {
-                lengthBeforeBreak.add(new MinOptMax(element.getW()));
-                lengthAfterBreak.subtract(new MinOptMax(element.getW()));
+                lengthBeforeBreak.add(new MinOptMax(element.getWidth()));
+                lengthAfterBreak.subtract(new MinOptMax(element.getWidth()));
                 bPrevIsBox = true;
             } else if (element.isGlue()) {
-                lengthBeforeBreak.min -= element.getZ();
-                lengthAfterBreak.min += element.getZ();
-                lengthBeforeBreak.max += element.getY();
-                lengthAfterBreak.max -= element.getY();
+                lengthBeforeBreak.min -= element.getShrink();
+                lengthAfterBreak.min += element.getShrink();
+                lengthBeforeBreak.max += element.getStretch();
+                lengthAfterBreak.max -= element.getStretch();
                 bPrevIsBox = false;
             } else {
-                lengthBeforeBreak.add(new MinOptMax(element.getW()));
+                lengthBeforeBreak.add(new MinOptMax(element.getWidth()));
                 bPrevIsBox = false;
             }
 
             // create the new elements
-            if (element.isPenalty() && element.getP() < KnuthElement.INFINITE
+            if (element.isPenalty() && element.getPenalty() < KnuthElement.INFINITE
                     || element.isGlue() && bPrevIsBox
                     || !oldListIterator.hasNext()) {
                 // suppress elements after the breaking point
@@ -1468,8 +1468,8 @@
                     iStepsForward++;
                     if (el.isGlue()) {
                         // suppressed glue
-                        lengthAfterBreak.min += el.getZ();
-                        lengthAfterBreak.max -= el.getY();
+                        lengthAfterBreak.min += el.getShrink();
+                        lengthAfterBreak.max -= el.getStretch();
                     } else if (el.isPenalty()) {
                         // suppressed penalty, do nothing
                     } else {
@@ -1489,8 +1489,8 @@
                 for (int i = 0; i < iStepsForward; i++) {
                     KnuthElement el = (KnuthElement) oldListIterator.previous();
                     if (el.isGlue()) {
-                        lengthAfterBreak.min -= el.getZ();
-                        lengthAfterBreak.max += el.getY();
+                        lengthAfterBreak.min -= el.getShrink();
+                        lengthAfterBreak.max += el.getStretch();
                     }
                 }
 
@@ -1611,7 +1611,7 @@
             }
 
             if (element.isPenalty()) {
-                lengthBeforeBreak.add(new MinOptMax(-element.getW()));
+                lengthBeforeBreak.add(new MinOptMax(-element.getWidth()));
             }
 
         }
@@ -1640,14 +1640,14 @@
                                    - neededUnits(totalLength.opt - adjustedSpaceBefore))
                                   * bpUnit;
             // insert the correct elements
-            newList.addFirst(new KnuthBox(wrongBox.getW() - decreasedLength,
+            newList.addFirst(new KnuthBox(wrongBox.getWidth() - decreasedLength,
                                           wrongBox.getPosition(), false));
             newList.addFirst(new KnuthGlue(decreasedLength, 0, 0, SPACE_BEFORE_ADJUSTMENT,
                                            wrongBox.getPosition(), false));
-            //log.debug("        rimosso box " + neededUnits(wrongBox.getW()));
+            //log.debug("        rimosso box " + neededUnits(wrongBox.getWidth()));
             //log.debug("        aggiunto glue " + neededUnits(decreasedLength) + " 0 0");
             //log.debug("        aggiunto box " + neededUnits(
-            //       wrongBox.getW() - decreasedLength));
+            //       wrongBox.getWidth() - decreasedLength));
         }
 
         // if space-after.conditionality is "discard", correct newList
@@ -1663,7 +1663,7 @@
             // (it cannot be parted and has some stretch or shrink)
             // the wrong box is the first one, not the last one
             LinkedList preserveList = new LinkedList();
-            if (wrongBox.getW() == 0) {
+            if (wrongBox.getWidth() == 0) {
                 preserveList.add(wrongBox);
                 preserveList.addFirst((KnuthGlue) newList.removeLast());
                 preserveList.addFirst((KnuthPenalty) newList.removeLast());
@@ -1676,7 +1676,7 @@
                                    - neededUnits(totalLength.opt - adjustedSpaceAfter))
                                   * bpUnit;
             // insert the correct box
-            newList.addLast(new KnuthBox(wrongBox.getW() - decreasedLength,
+            newList.addLast(new KnuthBox(wrongBox.getWidth() - decreasedLength,
                                          wrongBox.getPosition(), false));
             // add preserved elements
             if (!preserveList.isEmpty()) {
@@ -1685,9 +1685,9 @@
             // insert the correct glue
             newList.addLast(new KnuthGlue(decreasedLength, 0, 0, SPACE_AFTER_ADJUSTMENT,
                                           wrongBox.getPosition(), false));
-            //log.debug("        rimosso box " + neededUnits(wrongBox.getW()));
+            //log.debug("        rimosso box " + neededUnits(wrongBox.getWidth()));
             //log.debug("        aggiunto box " + neededUnits(
-            //      wrongBox.getW() - decreasedLength));
+            //      wrongBox.getWidth() - decreasedLength));
             //log.debug("        aggiunto glue " + neededUnits(decreasedLength) + " 0 0");
         }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java Thu Oct 15 20:43:13 2009
@@ -676,7 +676,7 @@
     protected void handleBox(KnuthBox box) {
         // a KnuthBox object is not a legal line break,
         // just add the width to the total
-        totalWidth += box.getW();
+        totalWidth += box.getWidth();
     }
 
     /**
@@ -697,9 +697,9 @@
             && !(allowedBreaks == ONLY_FORCED_BREAKS)) {
             considerLegalBreak(glue, position);
         }
-        totalWidth += glue.getW();
-        totalStretch += glue.getY();
-        totalShrink += glue.getZ();
+        totalWidth += glue.getWidth();
+        totalStretch += glue.getStretch();
+        totalShrink += glue.getShrink();
     }
 
     /**
@@ -716,8 +716,8 @@
         // only if its penalty is not infinite;
         // consider all penalties, non-flagged penalties or non-forcing penalties
         // according to the value of allowedBreaks
-        if (((penalty.getP() < KnuthElement.INFINITE)
-                && (!(allowedBreaks == NO_FLAGGED_PENALTIES) || !penalty.isFlagged())
+        if (((penalty.getPenalty() < KnuthElement.INFINITE)
+                && (!(allowedBreaks == NO_FLAGGED_PENALTIES) || !penalty.isPenaltyFlagged())
                 && (!(allowedBreaks == ONLY_FORCED_BREAKS)
                         || penalty.isForcedBreak()))) {
             considerLegalBreak(penalty, position);
@@ -880,7 +880,7 @@
      */
     protected boolean elementCanEndLine(KnuthElement element, int line, int difference) {
         return (!element.isPenalty()
-                || element.getP() < KnuthElement.INFINITE);
+                || element.getPenalty() < KnuthElement.INFINITE);
     }
 
     /**
@@ -921,9 +921,9 @@
             if (tempElement.isBox()) {
                 break;
             } else if (tempElement.isGlue()) {
-                newWidth += tempElement.getW();
-                newStretch += tempElement.getY();
-                newShrink += tempElement.getZ();
+                newWidth += tempElement.getWidth();
+                newStretch += tempElement.getStretch();
+                newShrink += tempElement.getShrink();
             } else if (tempElement.isForcedBreak() && i != elementIdx) {
                 break;
             }
@@ -1034,9 +1034,9 @@
             if (tempElement.isBox()) {
                 break;
             } else if (tempElement.isGlue()) {
-                newWidth += tempElement.getW();
-                newStretch += tempElement.getY();
-                newShrink += tempElement.getZ();
+                newWidth += tempElement.getWidth();
+                newStretch += tempElement.getStretch();
+                newShrink += tempElement.getShrink();
             } else if (tempElement.isForcedBreak() && i != elementIdx) {
                 break;
             }
@@ -1075,7 +1075,7 @@
         // compute the adjustment ratio
         int actualWidth = totalWidth - activeNode.totalWidth;
         if (element.isPenalty()) {
-            actualWidth += element.getW();
+            actualWidth += element.getWidth();
         }
         return getLineWidth() - actualWidth;
     }
@@ -1133,7 +1133,7 @@
         double f = Math.abs(r);
         f = 1 + 100 * f * f * f;
         if (element.isPenalty()) {
-            double penalty = element.getP();
+            double penalty = element.getPenalty();
             if (penalty >= 0) {
                 f += penalty;
                 demerits = f * f;
@@ -1146,9 +1146,9 @@
             demerits = f * f;
         }
 
-        if (element.isPenalty() && ((KnuthPenalty) element).isFlagged()
+        if (element.isPenalty() && ((KnuthPenalty) element).isPenaltyFlagged()
             && getElement(activeNode.position).isPenalty()
-            && ((KnuthPenalty) getElement(activeNode.position)).isFlagged()) {
+            && ((KnuthPenalty) getElement(activeNode.position)).isPenaltyFlagged()) {
             // add demerit for consecutive breaks at flagged penalties
             demerits += repeatedFlaggedDemerit;
             // there are at least two consecutive lines ending with a flagged penalty;
@@ -1160,7 +1160,7 @@
                  prevNode = prevNode.previous) {
                 KnuthElement prevElement = getElement(prevNode.position);
                 if (prevElement.isPenalty()
-                    && ((KnuthPenalty) prevElement).isFlagged()) {
+                    && ((KnuthPenalty) prevElement).isPenaltyFlagged()) {
                     // the previous line ends with a flagged penalty too
                     flaggedPenaltiesCount++;
                 } else {

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/ElementListUtils.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/ElementListUtils.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/ElementListUtils.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/ElementListUtils.java Thu Oct 15 20:43:13 2009
@@ -62,13 +62,13 @@
             if (el.isPenalty()) {
                 KnuthPenalty penalty = (KnuthPenalty)el;
                 //Convert all penalties to break inhibitors
-                if (penalty.getP() < KnuthPenalty.INFINITE) {
-                    iter.set(new KnuthPenalty(penalty.getW(), KnuthPenalty.INFINITE,
-                            penalty.isFlagged(), penalty.getPosition(), penalty.isAuxiliary()));
+                if (penalty.getPenalty() < KnuthPenalty.INFINITE) {
+                    iter.set(new KnuthPenalty(penalty.getWidth(), KnuthPenalty.INFINITE,
+                            penalty.isPenaltyFlagged(), penalty.getPosition(), penalty.isAuxiliary()));
                 }
             } else if (el.isGlue()) {
                 KnuthGlue glue = (KnuthGlue)el;
-                len += glue.getW();
+                len += glue.getWidth();
                 iter.previous();
                 el = (ListElement)iter.previous();
                 iter.next();
@@ -84,7 +84,7 @@
                 }
             } else {
                 KnuthElement kel = (KnuthElement)el;
-                len += kel.getW();
+                len += kel.getWidth();
             }
             if (len >= constraint) {
                 return false;
@@ -109,13 +109,13 @@
             if (el.isPenalty()) {
                 KnuthPenalty penalty = (KnuthPenalty)el;
                 //Convert all penalties to break inhibitors
-                if (penalty.getP() < KnuthPenalty.INFINITE) {
-                    i.set(new KnuthPenalty(penalty.getW(), KnuthPenalty.INFINITE,
-                            penalty.isFlagged(), penalty.getPosition(), penalty.isAuxiliary()));
+                if (penalty.getPenalty() < KnuthPenalty.INFINITE) {
+                    i.set(new KnuthPenalty(penalty.getWidth(), KnuthPenalty.INFINITE,
+                            penalty.isPenaltyFlagged(), penalty.getPosition(), penalty.isAuxiliary()));
                 }
             } else if (el.isGlue()) {
                 KnuthGlue glue = (KnuthGlue)el;
-                len += glue.getW();
+                len += glue.getWidth();
                 el = (ListElement)i.previous();
                 i.next();
                 if (el.isBox()) {
@@ -134,7 +134,7 @@
                 }
             } else {
                 KnuthElement kel = (KnuthElement)el;
-                len += kel.getW();
+                len += kel.getWidth();
             }
             if (len >= constraint) {
                 return false;
@@ -158,9 +158,9 @@
         while (iter.hasNext()) {
             ListElement el = (ListElement)iter.next();
             if (el.isBox()) {
-                len += ((KnuthElement)el).getW();
+                len += ((KnuthElement)el).getWidth();
             } else if (el.isGlue()) {
-                len += ((KnuthElement)el).getW();
+                len += ((KnuthElement)el).getWidth();
             } else {
                 //log.debug("Ignoring penalty: " + el);
                 //ignore penalties
@@ -210,7 +210,7 @@
      */
     public static boolean endsWithNonInfinitePenalty(List elems) {
         ListElement last = (ListElement) ListUtil.getLast(elems);
-        if (last.isPenalty() && ((KnuthPenalty)last).getP() < KnuthElement.INFINITE) {
+        if (last.isPenalty() && ((KnuthPenalty)last).getPenalty() < KnuthElement.INFINITE) {
             return true;
         } else if (last instanceof BreakElement
                         && ((BreakElement)last).getPenaltyValue() < KnuthElement.INFINITE) {
@@ -230,7 +230,7 @@
         int prevBreak = startIndex - 1;
         while (prevBreak >= 0) {
             KnuthElement el = (KnuthElement)elems.get(prevBreak);
-            if (el.isPenalty() && el.getP() < KnuthElement.INFINITE) {
+            if (el.isPenalty() && el.getPenalty() < KnuthElement.INFINITE) {
                 break;
             }
             prevBreak--;

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java Thu Oct 15 20:43:13 2009
@@ -72,7 +72,7 @@
         lastOldElement = getLast();
         firstNewElement = sequence.getElement(0);
         if (firstNewElement.isBox() && !((KnuthElement) firstNewElement).isAuxiliary()
-                && lastOldElement.isBox() && ((KnuthElement) lastOldElement).getW() != 0) {
+                && lastOldElement.isBox() && ((KnuthElement) lastOldElement).getWidth() != 0) {
             addALetterSpace();
         }
         addAll(sequence);

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthBox.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthBox.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthBox.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthBox.java Thu Oct 15 20:43:13 2009
@@ -37,12 +37,12 @@
     /**
      * Create a new KnuthBox.
      *
-     * @param w    the width of this box
+     * @param width    the width of this box
      * @param pos  the Position stored in this box
-     * @param bAux is this box auxiliary?
+     * @param auxiliary is this box auxiliary?
      */
-    public KnuthBox(int w, Position pos, boolean bAux) {
-        super(w, pos, bAux);
+    public KnuthBox(int width, Position pos, boolean auxiliary) {
+        super(width, pos, auxiliary);
     }
 
     /** {@inheritDoc} */
@@ -52,14 +52,14 @@
 
     /** {@inheritDoc} */
     public String toString() {
-        StringBuffer sb = new StringBuffer(64);
+        StringBuffer buffer = new StringBuffer(64);
         if (isAuxiliary()) {
-            sb.append("aux. ");
+            buffer.append("aux. ");
         }
-        sb.append("box");
-        sb.append(" w=");
-        sb.append(getW());
-        return sb.toString();
+        buffer.append("box");
+        buffer.append(" w=");
+        buffer.append(getWidth());
+        return buffer.toString();
     }
 
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthElement.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthElement.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthElement.java Thu Oct 15 20:43:13 2009
@@ -33,44 +33,44 @@
     public static final int INFINITE = 1000;
 
     private int width;
-    private boolean bIsAuxiliary;
+    private boolean auxiliary;
 
     /**
      * Create a new KnuthElement.
      * This class being abstract, this can be called only by subclasses.
      *
-     * @param w    the width of this element
+     * @param width    the width of this element
      * @param pos  the Position stored in this element
-     * @param bAux is this an auxiliary element?
+     * @param auxiliary is this an auxiliary element?
      */
-    protected KnuthElement(int w, Position pos, boolean bAux) {
+    protected KnuthElement(int width, Position pos, boolean auxiliary) {
         super(pos);
-        width = w;
-        bIsAuxiliary = bAux;
+        this.width = width;
+        this.auxiliary = auxiliary;
     }
 
     /** @return true if this element is an auxiliary one. */
     public boolean isAuxiliary() {
-        return bIsAuxiliary;
+        return auxiliary;
     }
 
     /** @return the width of this element. */
-    public int getW() {
+    public int getWidth() {
         return width;
     }
 
     /** @return the penalty value of this element, if applicable. */
-    public int getP() {
+    public int getPenalty() {
         throw new RuntimeException("Element is not a penalty");
     }
 
     /** @return the stretch value of this element, if applicable. */
-    public int getY() {
+    public int getStretch() {
         throw new RuntimeException("Element is not a glue");
     }
 
     /** @return the shrink value of this element, if applicable. */
-    public int getZ() {
+    public int getShrink() {
         throw new RuntimeException("Element is not a glue");
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthGlue.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthGlue.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthGlue.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthGlue.java Thu Oct 15 20:43:13 2009
@@ -54,24 +54,25 @@
     /**
      * Create a new KnuthGlue.
      *
-     * @param w the width of this glue
-     * @param y the stretchability of this glue
-     * @param z the shrinkability of this glue
+     * @param width the width of this glue
+     * @param stretchability the stretchability of this glue
+     * @param shrinkability the shrinkability of this glue
      * @param pos the Position stored in this glue
-     * @param bAux is this glue auxiliary?
+     * @param auxiliary is this glue auxiliary?
      */
-    public KnuthGlue(int w, int y, int z, Position pos, boolean bAux) {
-        super(w, pos, bAux);
-        stretchability = y;
-        shrinkability = z;
+    public KnuthGlue(int width, int stretchability, int shrinkability, Position pos,
+                     boolean auxiliary) {
+        super(width, pos, auxiliary);
+        this.stretchability = stretchability;
+        this.shrinkability = shrinkability;
     }
 
-    public KnuthGlue(int w, int y, int z,
-            int iAdjClass, Position pos, boolean bAux) {
-        super(w, pos, bAux);
-        stretchability = y;
-        shrinkability = z;
-        adjustmentClass = iAdjClass;
+    public KnuthGlue(int width, int stretchability, int shrinkability, int adjustmentClass,
+                     Position pos, boolean auxiliary) {
+        super(width, pos, auxiliary);
+        this.stretchability = stretchability;
+        this.shrinkability = shrinkability;
+        this.adjustmentClass = adjustmentClass;
     }
 
     /** {@inheritDoc} */
@@ -80,12 +81,12 @@
     }
 
     /** @return the stretchability of this glue. */
-    public int getY() {
+    public int getStretch() {
         return stretchability;
     }
 
     /** @return the shrinkability of this glue. */
-    public int getZ() {
+    public int getShrink() {
         return shrinkability;
     }
 
@@ -96,18 +97,18 @@
 
     /** {@inheritDoc} */
     public String toString() {
-        StringBuffer sb = new StringBuffer(64);
+        StringBuffer buffer = new StringBuffer(64);
         if (isAuxiliary()) {
-            sb.append("aux. ");
+            buffer.append("aux. ");
         }
-        sb.append("glue");
-        sb.append(" w=").append(getW());
-        sb.append(" stretch=").append(getY());
-        sb.append(" shrink=").append(getZ());
+        buffer.append("glue");
+        buffer.append(" w=").append(getWidth());
+        buffer.append(" stretch=").append(getStretch());
+        buffer.append(" shrink=").append(getShrink());
         if (getAdjustmentClass() >= 0) {
-            sb.append(" adj-class=").append(getAdjustmentClass());
+            buffer.append(" adj-class=").append(getAdjustmentClass());
         }
-        return sb.toString();
+        return buffer.toString();
     }
 
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java Thu Oct 15 20:43:13 2009
@@ -45,39 +45,40 @@
     public static final int FLAGGED_PENALTY = 50;
 
     private int penalty;
-    private boolean isFlagged;
+    private boolean penaltyFlagged;
     private int breakClass = -1;
 
     /**
      * Create a new KnuthPenalty.
      *
-     * @param w the width of this penalty
-     * @param p the penalty value of this penalty
-     * @param f is this penalty flagged?
+     * @param width the width of this penalty
+     * @param penalty the penalty value of this penalty
+     * @param penaltyFlagged is this penalty flagged?
      * @param pos the Position stored in this penalty
-     * @param isAuxiliary is this penalty auxiliary?
+     * @param auxiliary is this penalty auxiliary?
      */
-    public KnuthPenalty(int w, int p, boolean f, Position pos, boolean isAuxiliary) {
-        super(w, pos, isAuxiliary);
-        penalty = p;
-        isFlagged = f;
+    public KnuthPenalty(int width, int penalty, boolean penaltyFlagged, Position pos,
+                        boolean auxiliary) {
+        super(width, pos, auxiliary);
+        this.penalty = penalty;
+        this.penaltyFlagged = penaltyFlagged;
     }
 
     /**
      * Create a new KnuthPenalty.
      *
-     * @param w the width of this penalty
-     * @param p the penalty value of this penalty
-     * @param f is this penalty flagged?
+     * @param width the width of this penalty
+     * @param penalty the penalty value of this penalty
+     * @param penaltyFlagged is this penalty flagged?
      * @param breakClass the break class of this penalty (one of
      * {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN}, {@link Constants#EN_PAGE},
      * {@link Constants#EN_EVEN_PAGE}, {@link Constants#EN_ODD_PAGE})
      * @param pos the Position stored in this penalty
      * @param isAuxiliary is this penalty auxiliary?
      */
-    public KnuthPenalty(int w, int p, boolean f,
-            int breakClass, Position pos, boolean isAuxiliary) {
-        this(w, p, f, pos, isAuxiliary);
+    public KnuthPenalty(int width, int penalty, boolean penaltyFlagged, int breakClass,
+                        Position pos, boolean isAuxiliary) {
+        this(width, penalty, penaltyFlagged, pos, isAuxiliary);
         this.breakClass = breakClass;
     }
 
@@ -90,6 +91,8 @@
      * (Mainly used in {@link #toString()} methods, to improve readability
      * of the trace logs.)
      *
+     * TODO: shouldn't be penalty a class of its own?
+     *
      * @param penaltyValue  the penalty value
      * @return  the penalty value as a {@link java.lang.String}
      */
@@ -110,21 +113,21 @@
     /**
      * @return the penalty value of this penalty.
      */
-    public int getP() {
+    public int getPenalty() {
         return penalty;
     }
 
     /**
      * Sets a new penalty value.
-     * @param p the new penalty value
+     * @param penalty the new penalty value
      */
-    public void setP(int p) {
-        this.penalty = p;
+    public void setPenalty(int penalty) {
+        this.penalty = penalty;
     }
 
     /** @return true is this penalty is a flagged one. */
-    public boolean isFlagged() {
-        return isFlagged;
+    public boolean isPenaltyFlagged() {
+        return penaltyFlagged;
     }
 
     /** {@inheritDoc} */
@@ -142,28 +145,28 @@
 
     /** {@inheritDoc} */
     public String toString() {
-        StringBuffer sb = new StringBuffer(64);
+        StringBuffer buffer = new StringBuffer(64);
         if (isAuxiliary()) {
-            sb.append("aux. ");
+            buffer.append("aux. ");
         }
-        sb.append("penalty");
-        sb.append(" p=");
-        sb.append(valueOf(this.penalty));
-        if (this.isFlagged) {
-            sb.append(" [flagged]");
+        buffer.append("penalty");
+        buffer.append(" p=");
+        buffer.append(valueOf(this.penalty));
+        if (this.penaltyFlagged) {
+            buffer.append(" [flagged]");
         }
-        sb.append(" w=");
-        sb.append(getW());
+        buffer.append(" w=");
+        buffer.append(getWidth());
         if (isForcedBreak()) {
-            sb.append(" (forced break, ")
+            buffer.append(" (forced break, ")
                     .append(getBreakClassName(this.breakClass))
                     .append(")");
         } else if (this.penalty >= 0 && this.breakClass != -1) {
             //penalty corresponding to a keep constraint
-            sb.append(" (keep constraint, ")
+            buffer.append(" (keep constraint, ")
                     .append(getBreakClassName(this.breakClass))
                     .append(")");
         }
-        return sb.toString();
+        return buffer.toString();
     }
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthSequence.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthSequence.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthSequence.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthSequence.java Thu Oct 15 20:43:13 2009
@@ -26,9 +26,12 @@
 import java.util.ListIterator;
 
 /**
- * Represents a list of Knuth elements.
+ * Represents a list of {@link KnuthElement Knuth elements}.
  */
 public abstract class KnuthSequence extends ArrayList {
+
+    //TODO: do not extend ArrayList
+
     /**
      * Creates a new and empty list.
      */

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java Thu Oct 15 20:43:13 2009
@@ -320,7 +320,7 @@
          * will not have considered it a legal break, but it could still
          * be one.
          */
-        if (penalty.getP() == KnuthPenalty.INFINITE) {
+        if (penalty.getPenalty() == KnuthPenalty.INFINITE) {
             int breakClass = penalty.getBreakClass();
             if (breakClass == Constants.EN_PAGE
                     || breakClass == Constants.EN_COLUMN) {
@@ -363,7 +363,7 @@
                     noteListIterator.hasNext();) {
                 final KnuthElement element = (KnuthElement) noteListIterator.next();
                 if (element.isBox() || element.isGlue()) {
-                    noteLength += element.getW();
+                    noteLength += element.getWidth();
                 }
             }
             int prevLength = (lengthList == null || lengthList.isEmpty())
@@ -445,22 +445,22 @@
             return true;
         } else {
             KnuthPenalty p = (KnuthPenalty) element;
-            if (p.getP() <= 0) {
+            if (p.getPenalty() <= 0) {
                 return true;
             } else {
                 int context = p.getBreakClass();
                 switch (context) {
                 case Constants.EN_LINE:
                 case Constants.EN_COLUMN:
-                    return p.getP() < KnuthPenalty.INFINITE;
+                    return p.getPenalty() < KnuthPenalty.INFINITE;
                 case Constants.EN_PAGE:
-                    return p.getP() < KnuthPenalty.INFINITE
+                    return p.getPenalty() < KnuthPenalty.INFINITE
                             || !pageProvider.endPage(line - 1);
                 case Constants.EN_AUTO:
                     log.debug("keep is not auto but context is");
                     return true;
                 default:
-                    if (p.getP() < KnuthPenalty.INFINITE) {
+                    if (p.getPenalty() < KnuthPenalty.INFINITE) {
                         log.debug("Non recognized keep context:" + context);
                         return true;
                     } else {
@@ -479,7 +479,7 @@
         int footnoteSplit = 0;
         boolean canDeferOldFootnotes;
         if (element.isPenalty()) {
-            actualWidth += element.getW();
+            actualWidth += element.getWidth();
         }
         if (footnotesPending) {
             // compute the total length of the footnotes not yet inserted
@@ -588,7 +588,7 @@
                  index++) {
                 if (par.getElement(index).isGlue() && par.getElement(index - 1).isBox()
                     || par.getElement(index).isPenalty()
-                       && ((KnuthElement) par.getElement(index)).getP() < KnuthElement.INFINITE) {
+                       && ((KnuthElement) par.getElement(index)).getPenalty() < KnuthElement.INFINITE) {
                     // break found
                     break;
                 }
@@ -711,7 +711,7 @@
                     element = (KnuthElement) noteListIterator.next();
                     if (element.isBox()) {
                         // element is a box
-                        splitLength += element.getW();
+                        splitLength += element.getWidth();
                         boxPreceding = true;
                     } else if (element.isGlue()) {
                         // element is a glue
@@ -721,10 +721,10 @@
                             break;
                         }
                         boxPreceding = false;
-                        splitLength += element.getW();
+                        splitLength += element.getWidth();
                     } else {
                         // element is a penalty
-                        if (element.getP() < KnuthElement.INFINITE) {
+                        if (element.getPenalty() < KnuthElement.INFINITE) {
                             // end of the sub-sequence
                             index = noteListIterator.previousIndex();
                             break;
@@ -792,7 +792,7 @@
         double f = Math.abs(r);
         f = 1 + 100 * f * f * f;
         if (element.isPenalty()) {
-            double penalty = element.getP();
+            double penalty = element.getPenalty();
             if (penalty >= 0) {
                 f += penalty;
                 demerits = f * f;
@@ -805,9 +805,9 @@
             demerits = f * f;
         }
 
-        if (element.isPenalty() && ((KnuthPenalty) element).isFlagged()
+        if (element.isPenalty() && ((KnuthPenalty) element).isPenaltyFlagged()
             && getElement(activeNode.position).isPenalty()
-            && ((KnuthPenalty) getElement(activeNode.position)).isFlagged()) {
+            && ((KnuthPenalty) getElement(activeNode.position)).isPenaltyFlagged()) {
             // add demerit for consecutive breaks at flagged penalties
             demerits += repeatedFlaggedDemerit;
         }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java Thu Oct 15 20:43:13 2009
@@ -266,12 +266,12 @@
                         KnuthSequence ks = (KnuthSequence)obj;
                         for (Iterator it = ks.iterator(); it.hasNext(); ) {
                             contentElement = (KnuthElement)it.next();
-                            stackSize += contentElement.getW();
+                            stackSize += contentElement.getWidth();
                             contentList.add(contentElement);
                         }
                     } else {
                         contentElement = (KnuthElement)obj;
-                        stackSize += contentElement.getW();
+                        stackSize += contentElement.getWidth();
                         contentList.add(contentElement);
                     }
                 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java?rev=825646&r1=825645&r2=825646&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 Thu Oct 15 20:43:13 2009
@@ -680,7 +680,7 @@
                     assert lastElement != null;
                     previousIsBox = lastElement.isBox()
                             && !((KnuthElement) lastElement).isAuxiliary()
-                            && ((KnuthElement) lastElement).getW() != 0;
+                            && ((KnuthElement) lastElement).getWidth() != 0;
 
                     // if last paragraph is open, add the new elements to the paragraph
                     // else this is the last paragraph
@@ -705,7 +705,7 @@
 
                     // finish last paragraph if it was closed with a linefeed
                     if (lastElement.isPenalty()
-                            && ((KnuthPenalty) lastElement).getP() == -KnuthPenalty.INFINITE) {
+                            && ((KnuthPenalty) lastElement).getPenalty() == -KnuthPenalty.INFINITE) {
                         // a penalty item whose value is -inf
                         // represents a preserved linefeed,
                         // which forces a line break
@@ -1172,7 +1172,7 @@
         LeafPosition pos = (LeafPosition)lastElement.getPosition();
         int totalAdj = adj;
         //if (lastElement.isPenalty()) {
-        //    totalAdj += lastElement.getW();
+        //    totalAdj += lastElement.getWidth();
         //}
         //int lineNumberDifference = (int)((double) totalAdj / constantLineHeight);
         int lineNumberDifference = (int) Math.round((double) totalAdj / constantLineHeight

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java Thu Oct 15 20:43:13 2009
@@ -54,6 +54,8 @@
  */
 public class TextLayoutManager extends LeafNodeLayoutManager {
 
+    //TODO: remove all final modifiers at local variables
+
     /**
      * Store information about each potential text area.
      * Index of character which ends the area, IPD of area, including
@@ -686,39 +688,39 @@
     }
 
     private AreaInfo processWord(final int alignment, final KnuthSequence sequence,
-            AreaInfo prevAi, final char ch, final boolean breakOpportunity,
+            AreaInfo prevAreaInfo, final char ch, final boolean breakOpportunity,
             final boolean checkEndsWithHyphen) {
-        AreaInfo ai;
+
         //Word boundary found, process widths and kerning
         int lastIndex = this.nextStart;
         while (lastIndex > 0
-                && this.foText.charAt(lastIndex - 1) == CharUtilities.SOFT_HYPHEN) {
+                && foText.charAt(lastIndex - 1) == CharUtilities.SOFT_HYPHEN) {
             lastIndex--;
         }
         final boolean endsWithHyphen = checkEndsWithHyphen
-                && this.foText.charAt(lastIndex) == CharUtilities.SOFT_HYPHEN;
+                && foText.charAt(lastIndex) == CharUtilities.SOFT_HYPHEN;
         final Font font = FontSelector
-                .selectFontForCharactersInText(this.foText,
-                        this.thisStart, lastIndex, this.foText, this);
+                .selectFontForCharactersInText(foText,
+                        this.thisStart, lastIndex, foText, this);
         final int wordLength = lastIndex - this.thisStart;
         final boolean kerning = font.hasKerning();
         final MinOptMax wordIPD = new MinOptMax(0);
         for (int i = this.thisStart; i < lastIndex; i++) {
-            final char c = this.foText.charAt(i);
+            final char currentChar = foText.charAt(i);
 
             //character width
-            final int charWidth = font.getCharWidth(c);
+            final int charWidth = font.getCharWidth(currentChar);
             wordIPD.add(charWidth);
 
             //kerning
             if (kerning) {
                 int kern = 0;
                 if (i > this.thisStart) {
-                    final char previous = this.foText.charAt(i - 1);
-                    kern = font.getKernValue(previous, c) * font.getFontSize() / 1000;
-                } else if (prevAi != null && !prevAi.isSpace && prevAi.breakIndex > 0) {
-                    final char previous = this.foText.charAt(prevAi.breakIndex - 1);
-                    kern = font.getKernValue(previous, c) * font.getFontSize() / 1000;
+                    final char previousChar = foText.charAt(i - 1);
+                    kern = font.getKernValue(previousChar, currentChar);
+                } else if (prevAreaInfo != null && !prevAreaInfo.isSpace && prevAreaInfo.breakIndex > 0) {
+                    final char previousChar = foText.charAt(prevAreaInfo.breakIndex - 1);
+                    kern = font.getKernValue(previousChar, currentChar);
                 }
                 if (kern != 0) {
                     this.addToLetterAdjust(i, kern);
@@ -731,11 +733,10 @@
                 && !TextLayoutManager.isSpace(ch)
                 && lastIndex > 0
                 && endsWithHyphen) {
-            final int kern = font.getKernValue(
-                    this.foText.charAt(lastIndex - 1), ch)
-                    * font.getFontSize() / 1000;
+            final int kern = font.getKernValue(foText.charAt(lastIndex - 1), ch);
             if (kern != 0) {
                 this.addToLetterAdjust(lastIndex, kern);
+                //TODO: add kern to wordIPD?
             }
         }
         int iLetterSpaces = wordLength - 1;
@@ -748,20 +749,20 @@
         wordIPD.add(MinOptMax.multiply(this.letterSpaceIPD, iLetterSpaces));
 
         // create the AreaInfo object
-        ai = new AreaInfo(this.thisStart, lastIndex, 0,
+        AreaInfo areaInfo = new AreaInfo(this.thisStart, lastIndex, 0,
                 iLetterSpaces, wordIPD,
                 endsWithHyphen,
                 false, breakOpportunity, font);
-        prevAi = ai;
-        this.vecAreaInfo.add(ai);
+        prevAreaInfo = areaInfo;
+        this.vecAreaInfo.add(areaInfo);
         this.tempStart = this.nextStart;
 
         //add the elements
-        this.addElementsForAWordFragment(sequence, alignment, ai,
+        this.addElementsForAWordFragment(sequence, alignment, areaInfo,
                 this.vecAreaInfo.size() - 1, this.letterSpaceIPD);
-        ai = null;
         this.thisStart = this.nextStart;
-        return prevAi;
+
+        return prevAreaInfo;
     }
 
     /** {@inheritDoc} */

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java Thu Oct 15 20:43:13 2009
@@ -298,14 +298,14 @@
             int stepPenalty = 0;
             KnuthElement endEl = (KnuthElement)elementLists[0].get(end[0]);
             if (endEl instanceof KnuthPenalty) {
-                additionalPenaltyHeight = endEl.getW();
-                stepPenalty = Math.max(stepPenalty, endEl.getP());
+                additionalPenaltyHeight = endEl.getWidth();
+                stepPenalty = Math.max(stepPenalty, endEl.getPenalty());
             }
             endEl = (KnuthElement)elementLists[1].get(end[1]);
             if (endEl instanceof KnuthPenalty) {
                 additionalPenaltyHeight = Math.max(
-                        additionalPenaltyHeight, endEl.getW());
-                stepPenalty = Math.max(stepPenalty, endEl.getP());
+                        additionalPenaltyHeight, endEl.getWidth());
+                stepPenalty = Math.max(stepPenalty, endEl.getPenalty());
             }
 
             int boxHeight = step - addedBoxHeight - penaltyHeight;
@@ -367,7 +367,7 @@
                 end[i]++;
                 KnuthElement el = (KnuthElement)elementLists[i].get(end[i]);
                 if (el.isPenalty()) {
-                    if (el.getP() < KnuthElement.INFINITE) {
+                    if (el.getPenalty() < KnuthElement.INFINITE) {
                         //First legal break point
                         break;
                     }
@@ -379,9 +379,9 @@
                             break;
                         }
                     }
-                    partialHeights[i] += el.getW();
+                    partialHeights[i] += el.getWidth();
                 } else {
-                    partialHeights[i] += el.getW();
+                    partialHeights[i] += el.getWidth();
                 }
             }
             if (end[i] < start[i]) {

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java Thu Oct 15 20:43:13 2009
@@ -158,9 +158,9 @@
         private int contentLength;
 
         FillerPenalty(KnuthPenalty p, int length) {
-            super(length, p.getP(), p.isFlagged(), p.getBreakClass(),
+            super(length, p.getPenalty(), p.isPenaltyFlagged(), p.getBreakClass(),
                     p.getPosition(), p.isAuxiliary());
-            contentLength = p.getW();
+            contentLength = p.getWidth();
         }
 
         FillerPenalty(int length) {
@@ -190,7 +190,7 @@
         } else if (el instanceof FillerBox) {
             return 0;
         } else {
-            return el.getW();
+            return el.getWidth();
         }
     }
 
@@ -248,17 +248,17 @@
                 KnuthElement el = (KnuthElement) iter.next();
                 if (el.isBox()) {
                     prevIsBox = true;
-                    cumulateLength += el.getW();
+                    cumulateLength += el.getWidth();
                 } else if (el.isGlue()) {
                     if (prevIsBox) {
                         elementList.add(iter.nextIndex() - 1,
                                 new FillerPenalty(minBPD - cumulateLength));
                     }
                     prevIsBox = false;
-                    cumulateLength += el.getW();
+                    cumulateLength += el.getWidth();
                 } else {
                     prevIsBox = false;
-                    if (cumulateLength + el.getW() < minBPD) {
+                    if (cumulateLength + el.getWidth() < minBPD) {
                         iter.set(new FillerPenalty((KnuthPenalty) el, minBPD - cumulateLength));
                     }
                 }
@@ -314,7 +314,7 @@
             KnuthElement el = (KnuthElement) knuthIter.next();
             if (el.isPenalty()) {
                 prevIsBox = false;
-                if (el.getP() < KnuthElement.INFINITE
+                if (el.getPenalty() < KnuthElement.INFINITE
                         || ((KnuthPenalty) el).getBreakClass() == Constants.EN_PAGE) {
                     // TODO too much is being done in that test, only to handle
                     // keep.within-column properly.
@@ -322,8 +322,8 @@
                     // First legal break point
                     breakFound = true;
                     KnuthPenalty p = (KnuthPenalty) el;
-                    afterNextStep.penaltyLength = p.getW();
-                    afterNextStep.penaltyValue = p.getP();
+                    afterNextStep.penaltyLength = p.getWidth();
+                    afterNextStep.penaltyValue = p.getPenalty();
                     if (p.isForcedBreak()) {
                         afterNextStep.breakClass = p.getBreakClass();
                     }
@@ -333,9 +333,9 @@
                     // Second legal break point
                     breakFound = true;
                 } else {
-                    afterNextStep.contentLength += el.getW();
+                    afterNextStep.contentLength += el.getWidth();
                     if (!boxFound) {
-                        afterNextStep.condBeforeContentLength += el.getW();
+                        afterNextStep.condBeforeContentLength += el.getWidth();
                     }
                 }
                 prevIsBox = false;
@@ -348,7 +348,7 @@
                 }
                 prevIsBox = true;
                 boxFound = true;
-                afterNextStep.contentLength += el.getW();
+                afterNextStep.contentLength += el.getWidth();
             }
         }
         afterNextStep.end = knuthIter.nextIndex() - 1;

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowPainter.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowPainter.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowPainter.java Thu Oct 15 20:43:13 2009
@@ -361,7 +361,7 @@
                 while (iter.nextIndex() < endIndex) {
                     KnuthElement el = (KnuthElement) iter.next();
                     if (el.isBox() || el.isGlue()) {
-                        len += el.getW();
+                        len += el.getWidth();
                     }
                 }
                 len += ActiveCell.getElementContentLength((KnuthElement) iter.next());

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java Thu Oct 15 20:43:13 2009
@@ -202,7 +202,7 @@
         if (lastItem.isForcedBreak()) {
             KnuthPenalty p = (KnuthPenalty) lastItem;
             primaryGridUnit.setBreakAfter(p.getBreakClass());
-            p.setP(0);
+            p.setPenalty(0);
         }
 
         setFinished(true);

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/ElementListCheck.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/ElementListCheck.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/ElementListCheck.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/ElementListCheck.java Thu Oct 15 20:43:13 2009
@@ -83,10 +83,10 @@
                     }
                     if (domEl.getAttribute("w").length() > 0) {
                         int w = Integer.parseInt(domEl.getAttribute("w"));
-                        if (w != knuthEl.getW()) {
+                        if (w != knuthEl.getWidth()) {
                             fail("Expected w=" + w
                                     + " at position " + pos
-                                    + " but got: " + knuthEl.getW());
+                                    + " but got: " + knuthEl.getWidth());
                         }
                     }
                     if ("true".equals(domEl.getAttribute("aux"))) {
@@ -110,24 +110,24 @@
                     KnuthPenalty pen = (KnuthPenalty)knuthEl;
                     if (domEl.getAttribute("w").length() > 0) {
                         int w = Integer.parseInt(domEl.getAttribute("w"));
-                        if (w != knuthEl.getW()) {
+                        if (w != knuthEl.getWidth()) {
                             fail("Expected w=" + w
                                     + " at position " + pos
-                                    + " but got: " + knuthEl.getW());
+                                    + " but got: " + knuthEl.getWidth());
                         }
                     }
                     if (domEl.getAttribute("p").length() > 0) {
                         if ("<0".equals(domEl.getAttribute("p"))) {
-                            if (knuthEl.getP() >= 0) {
+                            if (knuthEl.getPenalty() >= 0) {
                                 fail("Expected p<0"
                                         + " at position " + pos
-                                        + " but got: " + knuthEl.getP());
+                                        + " but got: " + knuthEl.getPenalty());
                             }
                         } else if (">0".equals(domEl.getAttribute("p"))) {
-                            if (knuthEl.getP() <= 0) {
+                            if (knuthEl.getPenalty() <= 0) {
                                 fail("Expected p>0"
                                         + " at position " + pos
-                                        + " but got: " + knuthEl.getP());
+                                        + " but got: " + knuthEl.getPenalty());
                             }
                         } else {
                             int p;
@@ -142,20 +142,20 @@
                             } else {
                                 p = Integer.parseInt(domEl.getAttribute("p"));
                             }
-                            if (p != knuthEl.getP()) {
+                            if (p != knuthEl.getPenalty()) {
                                 fail("Expected p=" + p
                                         + " at position " + pos
-                                        + " but got: " + knuthEl.getP());
+                                        + " but got: " + knuthEl.getPenalty());
                             }
                         }
                     }
                     if ("true".equals(domEl.getAttribute("flagged"))) {
-                        if (!pen.isFlagged()) {
+                        if (!pen.isPenaltyFlagged()) {
                             fail("Expected flagged penalty"
                                     + " at position " + pos);
                         }
                     } else if ("false".equals(domEl.getAttribute("flagged"))) {
-                        if (pen.isFlagged()) {
+                        if (pen.isPenaltyFlagged()) {
                             fail("Expected non-flagged penalty"
                                     + " at position " + pos);
                         }
@@ -180,26 +180,26 @@
                     KnuthGlue glue = (KnuthGlue)knuthEl;
                     if (domEl.getAttribute("w").length() > 0) {
                         int w = Integer.parseInt(domEl.getAttribute("w"));
-                        if (w != knuthEl.getW()) {
+                        if (w != knuthEl.getWidth()) {
                             fail("Expected w=" + w
                                     + " at position " + pos
-                                    + " but got: " + knuthEl.getW());
+                                    + " but got: " + knuthEl.getWidth());
                         }
                     }
                     if (domEl.getAttribute("y").length() > 0) {
                         int stretch = Integer.parseInt(domEl.getAttribute("y"));
-                        if (stretch != knuthEl.getY()) {
+                        if (stretch != knuthEl.getStretch()) {
                             fail("Expected y=" + stretch
                                     + " (stretch) at position " + pos
-                                    + " but got: " + knuthEl.getY());
+                                    + " but got: " + knuthEl.getStretch());
                         }
                     }
                     if (domEl.getAttribute("z").length() > 0) {
                         int shrink = Integer.parseInt(domEl.getAttribute("z"));
-                        if (shrink != knuthEl.getZ()) {
+                        if (shrink != knuthEl.getShrink()) {
                             fail("Expected z=" + shrink
                                     + " (shrink) at position " + pos
-                                    + " but got: " + knuthEl.getZ());
+                                    + " but got: " + knuthEl.getShrink());
                         }
                     }
                 } else {

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ElementListUtilsTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ElementListUtilsTestCase.java?rev=825646&r1=825645&r2=825646&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ElementListUtilsTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ElementListUtilsTestCase.java Thu Oct 15 20:43:13 2009
@@ -55,9 +55,9 @@
 
         assertFalse(res);
 
-        assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(1)).getP());
-        assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(3)).getP());
-        assertEquals(0, ((KnuthPenalty)lst.get(5)).getP());
+        assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(1)).getPenalty());
+        assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(3)).getPenalty());
+        assertEquals(0, ((KnuthPenalty)lst.get(5)).getPenalty());
     }
 
     /**
@@ -82,11 +82,11 @@
         assertFalse(res);
 
         //Must insert an INFINITE penalty
-        assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(1)).getP());
-        assertEquals(0, ((KnuthGlue)lst.get(2)).getW());
-        assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(4)).getP());
-        assertEquals(0, ((KnuthGlue)lst.get(5)).getW());
-        assertEquals(0, ((KnuthGlue)lst.get(7)).getW());
+        assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(1)).getPenalty());
+        assertEquals(0, ((KnuthGlue)lst.get(2)).getWidth());
+        assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(4)).getPenalty());
+        assertEquals(0, ((KnuthGlue)lst.get(5)).getWidth());
+        assertEquals(0, ((KnuthGlue)lst.get(7)).getWidth());
     }
 
     /**
@@ -110,9 +110,9 @@
 
         assertFalse(res);
 
-        assertEquals(0, ((KnuthPenalty)lst.get(1)).getP());
-        assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(3)).getP());
-        assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(5)).getP());
+        assertEquals(0, ((KnuthPenalty)lst.get(1)).getPenalty());
+        assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(3)).getPenalty());
+        assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(5)).getPenalty());
     }
 
     /**
@@ -137,10 +137,10 @@
         assertFalse(res);
 
         //Must insert an INFINITE penalty
-        assertEquals(0, ((KnuthPenalty)lst.get(1)).getP());
-        assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(3)).getP());
-        assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(5)).getP());
-        assertEquals(0, ((KnuthGlue)lst.get(6)).getW());
+        assertEquals(0, ((KnuthPenalty)lst.get(1)).getPenalty());
+        assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(3)).getPenalty());
+        assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(5)).getPenalty());
+        assertEquals(0, ((KnuthGlue)lst.get(6)).getWidth());
     }
 
 



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