From b45765ff3c9cc5deed81c299a203b221af0dbb6d Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Tue, 13 Dec 2005 19:50:59 +0000 Subject: 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 --- src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java | 6 ++++-- src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src/java/org/apache/fop') 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) { -- cgit v1.2.3