From: Chris Bowditch Date: Mon, 26 Apr 2004 14:28:30 +0000 (+0000) Subject: applied Luca Furini's patch from bug #28314 X-Git-Tag: Root_Temp_KnuthStylePageBreaking~751 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3d81811b573c812279c1a328f6aa132ea8cad2ab;p=xmlgraphics-fop.git applied Luca Furini's patch from bug #28314 fixes problems with justification on last line in a block. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197540 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java index 780d2fcc3..3c456ee00 100644 --- a/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java @@ -14,7 +14,7 @@ * limitations under the License. */ -/* $Id$ */ +/* $Id: LineLayoutManager.java,v 1.17 2004/04/02 10:38:29 cbowditch Exp $ */ package org.apache.fop.layoutmgr; @@ -129,7 +129,6 @@ public class LineLayoutManager extends InlineStackingLayoutManager { public BreakPoss getNextBreakPoss(LayoutContext context) { // Get a break from currently active child LM // Set up constraints for inline level managers - LayoutManager curLM ; // currently active LM BreakPoss prev = null; BreakPoss bp = null; // proposed BreakPoss @@ -243,8 +242,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager { /* If we are not in justified text, we can end the line at * prevBP. */ - if (prevBP == null) { vecInlineBreaks.add(bp); + if (prevBP == null) { prevBP = bp; } break; @@ -295,6 +294,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager { if (bp == null) { return null; } + if (prevBP == null) { BreakPoss prevLineEnd = (iPrevLineEnd == 0) ? null @@ -389,13 +389,22 @@ public class LineLayoutManager extends InlineStackingLayoutManager { /** Test whether all breakposs in vecInlineBreaks back to and including prev could end line */ private boolean prevCouldEndLine(BreakPoss prev) { + if (!isFinished()) { + return false; + } 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; + if (bp == prev) { + break; + } else { + couldEndLine = bp.isSuppressible(); + if (!couldEndLine) { + break; + } + } } return couldEndLine; }