From c020f2f4678ec65ba9591b953faf73c5935c45f2 Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Tue, 21 Jul 2020 13:28:42 +0000 Subject: [PATCH] FOP-2957: Don't change ipd on lastpage if column count changes git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1880106 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/fop/layoutmgr/PageBreaker.java | 7 +- .../flow_changing-ipd_last-page_17.xml | 65 +++++++++++++++++++ 2 files changed, 70 insertions(+), 2 deletions(-) create mode 100755 fop/test/layoutengine/standard-testcases/flow_changing-ipd_last-page_17.xml diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java index d6575e5f9..b1babb12a 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java @@ -68,6 +68,7 @@ public class PageBreaker extends AbstractBreaker { private MinOptMax relayedFootnoteSeparatorLength; private int previousFootnoteListIndex = -2; private int previousFootnoteElementIndex = -2; + private int prevousColumnCount; /** * The FlowLayoutManager object, which processes @@ -712,8 +713,10 @@ public class PageBreaker extends AbstractBreaker { boolean onlyPageMasterDefined = pslm.getPageSequence().hasPagePositionOnly(); if (lastPageMasterDefined && !onlyPageMasterDefined) { // code not very robust and unable to handle situations were only and last are defined - if (pageProvider.getCurrentColumnCount() > 1 - && optimalPageCount % pageProvider.getCurrentColumnCount() == 0) { + int currentColumnCount = pageProvider.getCurrentColumnCount(); + boolean changeInColumnCount = prevousColumnCount > 0 && prevousColumnCount != currentColumnCount; + prevousColumnCount = currentColumnCount; + if ((currentColumnCount > 1 && optimalPageCount % currentColumnCount == 0) || changeInColumnCount) { return false; } int currentIPD = this.pageProvider.getCurrentIPD(); diff --git a/fop/test/layoutengine/standard-testcases/flow_changing-ipd_last-page_17.xml b/fop/test/layoutengine/standard-testcases/flow_changing-ipd_last-page_17.xml new file mode 100755 index 000000000..ad8762f9e --- /dev/null +++ b/fop/test/layoutengine/standard-testcases/flow_changing-ipd_last-page_17.xml @@ -0,0 +1,65 @@ + + + + + +

+ This test checks that the definition of a special page-master for the last page with a + different width that the previous "rest" page causes FOP to redo the line breaking layout. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + Important Information + + + + CHANGES TO YOUR MINIMUM MONTHLY PAYMENT + + + + + + + + + +
-- 2.39.5