From b45765ff3c9cc5deed81c299a203b221af0dbb6d Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Tue, 13 Dec 2005 19:50:59 +0000 Subject: [PATCH] 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 --- .../inline/FootnoteLayoutManager.java | 6 +- .../layoutmgr/inline/TextLayoutManager.java | 4 +- status.xml | 23 +++++++ .../standard-testcases/footnote_bug37880.xml | 64 +++++++++++++++++++ 4 files changed, 94 insertions(+), 3 deletions(-) create mode 100644 test/layoutengine/standard-testcases/footnote_bug37880.xml 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 @@ + + Bugfix: Footnotes were lost if the footnote appeared in centered text. + + + 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. + + + Fix to correct image sizes in RTF output. + + + First attempt at SVG support in RTF output. SVG images are converted to 300dpi JPEG + images internally. + + + Additional checks to detect text overflows. The overflow property is now properly + handled where applicable. + + + Source location information improved. If location information is not available, + the context information is provided based on text content. + 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 @@ + + + + + +

+ This test checks footnotes, particularly bug #37880. A footnote in centered text was ignored. +

+
+ + + + + + + + + + + Blah + + 1) + + + 1) http://xmlgrapics.apache.org/fop/ + + + + + + Blah2 + + + + + 2) http://www.apache.org + + + + + + + + + + + +
-- 2.39.5