aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-12-13 19:50:59 +0000
committerJeremias Maerki <jeremias@apache.org>2005-12-13 19:50:59 +0000
commitb45765ff3c9cc5deed81c299a203b221af0dbb6d (patch)
treeb68a5816dbab43cdf4247a87b2f805419b52c7d1
parentb9c18acdd094acfc29b4619b9785b19aa83d29e1 (diff)
downloadxmlgraphics-fop-b45765ff3c9cc5deed81c299a203b221af0dbb6d.tar.gz
xmlgraphics-fop-b45765ff3c9cc5deed81c299a203b221af0dbb6d.zip
Bugzilla #37880:
Bugfix for lost footnotes in centered text. Skip elements with no Position in TextLayoutManager. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@356594 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java6
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java4
-rw-r--r--status.xml23
-rw-r--r--test/layoutengine/standard-testcases/footnote_bug37880.xml64
4 files changed, 94 insertions, 3 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java
index 29087b029..48a919896 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java
@@ -79,7 +79,7 @@ public class FootnoteLayoutManager extends AbstractLayoutManager
//Inline part of the footnote is empty. Need to send back an auxiliary
//zero-width, zero-height inline box so the footnote gets painted.
KnuthSequence seq = new KnuthSequence(true);
- seq.add(new KnuthInlineBox(0, null, null, true));
+ seq.add(new KnuthInlineBox(0, null, null, false));
returnedList.add(seq);
}
setFinished(true);
@@ -106,7 +106,7 @@ public class FootnoteLayoutManager extends AbstractLayoutManager
ListIterator nestedIterator = seq.listIterator(seq.size());
while (nestedIterator.hasPrevious() && lastBox == null) {
KnuthElement element = (KnuthElement)nestedIterator.previous();
- if (element instanceof KnuthInlineBox) {
+ if (element instanceof KnuthInlineBox && !element.isAuxiliary()) {
lastBox = (KnuthInlineBox) element;
}
}
@@ -114,6 +114,8 @@ public class FootnoteLayoutManager extends AbstractLayoutManager
}
if (lastBox != null) {
lastBox.setFootnoteBodyLM(bodyLM);
+ } else {
+ throw new IllegalStateException("No anchor box was found for a footnote.");
}
}
diff --git a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
index cbf798b03..f6de2e939 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
@@ -271,7 +271,9 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
*/
while (posIter.hasNext()) {
LeafPosition tbpNext = (LeafPosition) posIter.next();
- //
+ if (tbpNext == null) {
+ continue; //Ignore elements without Positions
+ }
if (tbpNext.getLeafPos() != -1) {
ai = (AreaInfo) vecAreaInfo.get(tbpNext.getLeafPos());
if (firstAreaInfoIndex == -1) {
diff --git a/status.xml b/status.xml
index 10d2df528..a67405174 100644
--- a/status.xml
+++ b/status.xml
@@ -27,6 +27,29 @@
<changes>
<release version="FOP Trunk">
+ <action context="Code" dev="JM" type="fix" fixes-bug="37880">
+ Bugfix: Footnotes were lost if the footnote appeared in centered text.
+ </action>
+ <action context="Code" dev="JM" type="update">
+ Improved log and error messages in a number of places by adding additional
+ context information that should make it easier to find the location in the
+ source files.
+ </action>
+ <action context="Code" dev="JM" type="fix">
+ Fix to correct image sizes in RTF output.
+ </action>
+ <action context="Code" dev="JM" type="add">
+ First attempt at SVG support in RTF output. SVG images are converted to 300dpi JPEG
+ images internally.
+ </action>
+ <action context="Code" dev="JM" type="update">
+ Additional checks to detect text overflows. The overflow property is now properly
+ handled where applicable.
+ </action>
+ <action context="Code" dev="JM" type="update">
+ Source location information improved. If location information is not available,
+ the context information is provided based on text content.
+ </action>
<action context="Code" dev="JM" type="add">
The command-line now automatically sets two parameters for any XSLT transformation:
"fop-output-format" contains the MIME type of the currently selected output format,
diff --git a/test/layoutengine/standard-testcases/footnote_bug37880.xml b/test/layoutengine/standard-testcases/footnote_bug37880.xml
new file mode 100644
index 000000000..d293973a7
--- /dev/null
+++ b/test/layoutengine/standard-testcases/footnote_bug37880.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ Licensed 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 footnotes, particularly bug #37880. A footnote in centered text was ignored.
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="5in" page-height="3in">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block text-align="center">
+ Blah
+ <fo:footnote id="fn1">
+ <fo:inline font-size="6.95pt" vertical-align="super">1) </fo:inline>
+ <fo:footnote-body>
+ <fo:block text-align="left">
+ <fo:inline font-size="6.95pt" vertical-align="super">1) </fo:inline>http://xmlgrapics.apache.org/fop/</fo:block>
+ </fo:footnote-body>
+ </fo:footnote>
+ </fo:block>
+ <!-- This second block uses an empty inline which will produce an auxiliary box w=0. I wanted to check if maybe this
+ box would be ignored as anchor due to the additional check on auxiliary boxes that was necessary to fix the
+ above bug. -->
+ <fo:block text-align="center">
+ Blah2
+ <fo:footnote id="fn2">
+ <fo:inline/>
+ <fo:footnote-body>
+ <fo:block text-align="left">
+ <fo:inline font-size="6.95pt" vertical-align="super">2) </fo:inline>http://www.apache.org</fo:block>
+ </fo:footnote-body>
+ </fo:footnote>
+ </fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <true xpath="//footnote/block[1]/@bpd &gt; 0"/>
+ <true xpath="//footnote/block[2]/@bpd &gt; 0"/>
+ </checks>
+</testcase>