diff options
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/LineLayoutManager.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java index 62014219e..d04bdd5ab 100644 --- a/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java @@ -322,7 +322,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager { prevBP = getBestBP(vecPossEnd); } // Backup child LM if necessary - if (bp != prevBP && !prevBP.couldEndLine()) { + if (bp != prevBP && !prevCouldEndLine(prevBP)) { reset(); } @@ -396,6 +396,20 @@ public class LineLayoutManager extends InlineStackingLayoutManager { return true; } + /** Test whether all breakposs in vecInlineBreaks + back to and including prev could end line */ + private boolean prevCouldEndLine(BreakPoss prev) { + ListIterator bpIter = + vecInlineBreaks.listIterator(vecInlineBreaks.size()); + boolean couldEndLine = true; + while (bpIter.hasPrevious()) { + BreakPoss bp = (BreakPoss) bpIter.previous(); + couldEndLine = bp.couldEndLine(); + if (!couldEndLine || bp == prev) break; + } + return couldEndLine; + } + private HyphContext getHyphenContext(BreakPoss prev, BreakPoss newBP) { // Get a "word" to hyphenate by getting characters from all |