From 7535be8128645c85c982b21817704aaa994465d8 Mon Sep 17 00:00:00 2001 From: Luca Furini Date: Mon, 16 Jun 2008 14:52:14 +0000 Subject: [PATCH] Fixing the PageBreakingAlgorithm, replacing calls to getLineWidth() with getLineWidth(int) so as to take into account each page's real height. This fixes the positioning of footnotes when the page bpd is not the same for all pages. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@668177 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/layoutmgr/PageBreakingAlgorithm.java | 8 +- status.xml | 5 + .../footnote_changing-page-bpd.xml | 97 +++++++++++++++++ .../footnote_changing-page-bpd_2.xml | 102 ++++++++++++++++++ 4 files changed, 208 insertions(+), 4 deletions(-) create mode 100644 test/layoutengine/standard-testcases/footnote_changing-page-bpd.xml create mode 100644 test/layoutengine/standard-testcases/footnote_changing-page-bpd_2.xml diff --git a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java b/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java index a3155e102..9e0b42ecb 100644 --- a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java +++ b/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java @@ -325,7 +325,7 @@ class PageBreakingAlgorithm extends BreakingAlgorithm { // this page contains some footnote citations // add the footnote separator width actualWidth += footnoteSeparatorLength.opt; - if (actualWidth + allFootnotes <= getLineWidth()) { + if (actualWidth + allFootnotes <= getLineWidth(activeNode.line)) { // there is enough space to insert all footnotes: // add the whole allFootnotes length actualWidth += allFootnotes; @@ -337,7 +337,7 @@ class PageBreakingAlgorithm extends BreakingAlgorithm { = checkCanDeferOldFootnotes(pageNode, elementIndex)) || newFootnotes) && (footnoteSplit = getFootnoteSplit(pageNode, - getLineWidth() - actualWidth, canDeferOldFootnotes)) > 0) { + getLineWidth(activeNode.line) - actualWidth, canDeferOldFootnotes)) > 0) { // it is allowed to break or even defer footnotes if either: // - there are new footnotes in the last piece of content, and // there is space to add at least a piece of the first one @@ -683,7 +683,7 @@ class PageBreakingAlgorithm extends BreakingAlgorithm { insertedFootnotesLength = lastNode.totalFootnotes; footnoteListIndex = lastNode.footnoteListIndex; footnoteElementIndex = lastNode.footnoteElementIndex; - int availableBPD = getLineWidth(); + int availableBPD = getLineWidth(lastNode.line); int split = 0; KnuthPageNode prevNode = lastNode; @@ -718,7 +718,7 @@ class PageBreakingAlgorithm extends BreakingAlgorithm { removeNode(prevNode.line, prevNode); prevNode = node; - availableBPD = getLineWidth(); + availableBPD = getLineWidth(node.line); } } // create the last node diff --git a/status.xml b/status.xml index 02786adbc..cc345117f 100644 --- a/status.xml +++ b/status.xml @@ -53,6 +53,11 @@ + + Fixed an inconsistency in footnote handling that led to unnecessary + empty areas in pages whose last normal line contains footnotes + when the page bpd is not the same for all pages. + + + + +

+ This test checks the positioning of footnotes when the body bpd changes + from page to page. +

+
+ + + + + + + + + + + + + + + + + line 1. + line 2. + line 3. + line 4. + line 5. + line 6. + line 7. + line 8. + line 9. + line 10. + line 11. + line 12. + line 13. + line 14. + line 15. + line 16. + line 17. + + 1 + + 1 ftnt line 1/3. + ftnt line 2/3. + ftnt line 3/3. + + + + line 18. + line 19. + line 20. + + + + + + + + + + + + + + + + + + + + + +
diff --git a/test/layoutengine/standard-testcases/footnote_changing-page-bpd_2.xml b/test/layoutengine/standard-testcases/footnote_changing-page-bpd_2.xml new file mode 100644 index 000000000..635cb171b --- /dev/null +++ b/test/layoutengine/standard-testcases/footnote_changing-page-bpd_2.xml @@ -0,0 +1,102 @@ + + + + + +

+ This test checks the positioning of footnotes when the body bpd changes + from page to page, in particular when footnote pages are created. +

+
+ + + + + + + + + + + + + + + + + + + + + line 1. + line 2. + line 3. + line 4. + + 1 + + 1 ftnt line 1. + ftnt line 2. + ftnt line 3. + ftnt line 4. + ftnt line 5. + ftnt line 6. + ftnt line 7. + ftnt line 8. + ftnt line 9. + ftnt line 10. + ftnt line 11. + ftnt line 12. + ftnt line 13. + ftnt line 14. + ftnt line 15. + + + + + + + + + + + + + + + + + + + + + + + + + + +
-- 2.39.5