diff options
-rw-r--r-- | src/java/org/apache/fop/area/LineArea.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java | 13 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/java/org/apache/fop/area/LineArea.java b/src/java/org/apache/fop/area/LineArea.java index 4f13ad65f..15d22548f 100644 --- a/src/java/org/apache/fop/area/LineArea.java +++ b/src/java/org/apache/fop/area/LineArea.java @@ -190,7 +190,7 @@ public class LineArea extends Area { // if the LineArea has already been added to the area tree, // call finalize(); otherwise, wait for the LineLM to call it if (adjustingInfo.bAddedToAreaTree) { - finalize(); + finalise(); } break; default: @@ -203,7 +203,7 @@ public class LineArea extends Area { * and destroy the AdjustingInfo object if there are * no UnresolvedAreas left */ - public void finalize() { + public void finalise() { if (adjustingInfo.lineAlignment == Constants.EN_JUSTIFY) { // justified line: apply the variation factor boolean bUnresolvedAreasPresent = false; diff --git a/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java b/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java index 788339790..efe3e28ce 100644 --- a/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java +++ b/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java @@ -105,7 +105,18 @@ public class InlineKnuthSequence extends KnuthSequence { } public void addALetterSpace() { - KnuthBox prevBox = (KnuthBox) removeLast(); + KnuthBox prevBox = (KnuthBox) getLast(); + if (prevBox.isAuxiliary() + && (size() < 4 + || !getElement(size()-2).isGlue() + || !getElement(size()-3).isPenalty() + || !getElement(size()-4).isBox() + ) + ) { + // Not the sequence we are expecting + return; + } + removeLast(); LinkedList oldList = new LinkedList(); // if there are two consecutive KnuthBoxes the // first one does not represent a whole word, |