From: Andreas L. Delmelle Date: Thu, 22 Feb 2007 19:07:15 +0000 (+0000) Subject: Bugzilla 41652: X-Git-Tag: fop-0_94~207 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e01480e8ec9872d671790adef579fc74e0e37acf;p=xmlgraphics-fop.git Bugzilla 41652: Preserved linefeeds now generate an empty line. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@510626 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java index f4a83e0fe..bad741ad4 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java @@ -702,8 +702,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager // the sequence contains inline Knuth elements if (sequence.isInlineSequence()) { // look at the last element - ListElement lastElement; - lastElement = sequence.getLast(); + ListElement lastElement = sequence.getLast(); if (lastElement == null) { throw new NullPointerException( "Sequence was empty! lastElement is null"); @@ -743,8 +742,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager lastPar.removeLast(); if (!lastPar.containsBox()) { //only a forced linefeed on this line - //-> compensate with a zero width box - lastPar.add(new KnuthInlineBox(0, null, null, false)); + //-> compensate with an auxiliary glue + lastPar.add(new KnuthGlue(iLineWidth, 0, iLineWidth, null, true)); } lastPar.endParagraph(); ElementListObserver.observe(lastPar, "line", null); diff --git a/status.xml b/status.xml index f7e330aec..fdeb3c62f 100644 --- a/status.xml +++ b/status.xml @@ -28,6 +28,11 @@ + + If a line contained nothing but a linefeed, this didn't produce empty lines. + Replaced the auxiliary zero-width box with a glue the width of a line, + and shrinkable to zero-width. + Stricter FOP user configuration checking diff --git a/test/layoutengine/standard-testcases/linefeed-treatment_preserve.xml b/test/layoutengine/standard-testcases/linefeed-treatment_preserve.xml new file mode 100644 index 000000000..2306a370c --- /dev/null +++ b/test/layoutengine/standard-testcases/linefeed-treatment_preserve.xml @@ -0,0 +1,65 @@ + + + + + +

+ This test checks linefeed-preservation. +

+
+ + + + + + + + + + + + First line yellow background +Second line red background +Third line red background + +Fifth line pink background; the above line has one preserved space character. +Sixth line yellow background + 1 + 2 + 3 + 4 + 5 + 6 One line, surrounded by some linefeeds; orange line in blue block + 7 + 8 + 9 + 10 + + + + + + + + + +