]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
FOP-2713: Text missing on last page with changing ipd
authorSimon Steiner <ssteiner@apache.org>
Mon, 19 Jun 2017 15:22:38 +0000 (15:22 +0000)
committerSimon Steiner <ssteiner@apache.org>
Mon, 19 Jun 2017 15:22:38 +0000 (15:22 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1799220 13f79535-47bb-0310-9956-ffa450edef68

fop-core/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java
fop/test/layoutengine/standard-testcases/flow_changing-ipd_last-page_14.xml [new file with mode: 0644]

index 43fca99a2c26d2fe13bc6394445684a9dbd3ace9..6096fef938e6435a7b4b95bac88b24494c278a19 100644 (file)
@@ -467,16 +467,19 @@ public class PageBreaker extends AbstractBreaker {
                 */
             }
         } else {
-            if (fitsOnePage) {
+            boolean ipdChange = algRestart.getIPDdifference() != 0;
+            if (fitsOnePage && !ipdChange) {
                 //Replace last page
                 pslm.setCurrentPage(pageProvider.getPage(false, currentPageNum));
             } else {
                 //Last page-master cannot hold the content.
                 //Add areas now...
                 addAreas(alg, restartPoint, partCount - restartPoint, originalList, effectiveList);
-                //...and add a blank last page
-                setLastPageIndex(currentPageNum + 1);
-                pslm.setCurrentPage(pslm.makeNewPage(true));
+                if (!ipdChange) {
+                    //...and add a blank last page
+                    setLastPageIndex(currentPageNum + 1);
+                    pslm.setCurrentPage(pslm.makeNewPage(true));
+                }
                 return;
             }
         }
diff --git a/fop/test/layoutengine/standard-testcases/flow_changing-ipd_last-page_14.xml b/fop/test/layoutengine/standard-testcases/flow_changing-ipd_last-page_14.xml
new file mode 100644 (file)
index 0000000..b3122b7
--- /dev/null
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+  <info>
+    <p>
+      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.
+    </p>
+  </info>
+  <fo>
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">
+  <fo:layout-master-set>
+    <fo:simple-page-master master-name="BlankPage" page-width="8.5in" page-height="11in" margin-bottom="0.5in" margin-right="0.5in" margin-top="0.5in" margin-left="0.5in">
+      <fo:region-body margin-bottom="0in" margin-right="0in" margin-top="0in" margin-left="0in" background-color="yellow"/>
+    </fo:simple-page-master>
+    <fo:simple-page-master master-name="NotesPage" page-width="8.5in" page-height="11in" margin-bottom="0.5in" margin-right="0.5in" margin-top="0.5in" margin-left="0.5in">
+      <fo:region-body margin-bottom="0in" margin-right="0in" margin-top="0in" margin-left="0in" region-name="NotesBody" background-color="green"/>
+
+    </fo:simple-page-master>
+    <fo:simple-page-master master-name="OddPage" page-width="8.5in" page-height="11in" margin-bottom="0.2in" margin-right="0.4in" margin-top="0.5in" margin-left="0.4in">
+      <fo:region-body margin-bottom="0.5in" margin-right="0in" margin-top="3.4in" margin-left="0in" region-name="Body" background-color="blue"/>
+
+    </fo:simple-page-master>
+    <fo:simple-page-master master-name="StubPage" page-width="8.5in" page-height="11in" margin-bottom="0.5in" margin-right="0.4in" margin-top="0.5in" margin-left="0.4in">
+      <fo:region-body margin-bottom="3.6in" margin-right="0in" margin-top="3.6in" margin-left="0in" region-name="Body" background-color="red"/>
+
+    </fo:simple-page-master>
+    <fo:page-sequence-master master-name="LetterPages">
+      <fo:repeatable-page-master-alternatives>
+        <fo:conditional-page-master-reference page-position="last" master-reference="StubPage"/>
+        <fo:conditional-page-master-reference odd-or-even="odd" page-position="first" master-reference="OddPage"/>
+        <fo:conditional-page-master-reference odd-or-even="odd" page-position="rest" master-reference="OddPage"/>
+        <fo:conditional-page-master-reference odd-or-even="even" master-reference="NotesPage"/>
+      </fo:repeatable-page-master-alternatives>
+    </fo:page-sequence-master>
+  </fo:layout-master-set>
+  <fo:page-sequence format="1" id="th_default_sequence1" force-page-count="end-on-odd" initial-page-number="auto" master-reference="LetterPages">
+
+    <fo:flow flow-name="Body">
+      <fo:block font-size="60pt">hello hello hello hello hello hello hello hello hello hello end</fo:block>
+    </fo:flow>
+  </fo:page-sequence>
+</fo:root>
+</fo>
+  <checks>
+    <eval expected="end" xpath="//pageViewport[1]//lineArea[4]/text[1]/word[2]"/>
+  </checks>
+</testcase>