From ed243054080d0145916487076d53addcbd7a54b3 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Sat, 20 Aug 2005 15:01:37 +0000 Subject: [PATCH] Bugfix for Bugzilla #36248 (and inline2.xml): Nest KnuthElements in inline KnuthSequences. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@234042 13f79535-47bb-0310-9956-ffa450edef68 --- .../layoutmgr/inline/CharacterLayoutManager.java | 15 +++++++++------ .../layoutmgr/inline/FootnoteLayoutManager.java | 4 +++- .../fop/layoutmgr/inline/LeaderLayoutManager.java | 13 ++++++++----- .../layoutmgr/inline/LeafNodeLayoutManager.java | 7 +++++-- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java index 9f05e8876..b278c0f2b 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java @@ -23,6 +23,7 @@ import org.apache.fop.fonts.Font; import org.apache.fop.layoutmgr.KnuthElement; import org.apache.fop.layoutmgr.KnuthGlue; import org.apache.fop.layoutmgr.KnuthPenalty; +import org.apache.fop.layoutmgr.KnuthSequence; import org.apache.fop.layoutmgr.LayoutContext; import org.apache.fop.layoutmgr.LeafPosition; import org.apache.fop.layoutmgr.Position; @@ -103,7 +104,7 @@ public class CharacterLayoutManager extends LeafNodeLayoutManager { int alignment) { MinOptMax ipd; curArea = get(context); - LinkedList returnList = new LinkedList(); + KnuthSequence seq = new KnuthSequence(true); if (curArea == null) { setFinished(true); @@ -146,7 +147,7 @@ public class CharacterLayoutManager extends LeafNodeLayoutManager { // node is a fo:Character if (letterSpaceIPD.min == letterSpaceIPD.max) { // constant letter space, only return a box - returnList.add(new KnuthInlineBox(areaInfo.ipdArea.opt, areaInfo.lead, + seq.add(new KnuthInlineBox(areaInfo.ipdArea.opt, areaInfo.lead, areaInfo.total, areaInfo.middle, new LeafPosition(this, 0), false)); } else { @@ -154,17 +155,19 @@ public class CharacterLayoutManager extends LeafNodeLayoutManager { // at the moment the character is supposed to have no letter spaces, // but returning this sequence allows us to change only one element // if addALetterSpaceTo() is called - returnList.add(new KnuthInlineBox(areaInfo.ipdArea.opt, areaInfo.lead, + seq.add(new KnuthInlineBox(areaInfo.ipdArea.opt, areaInfo.lead, areaInfo.total, areaInfo.middle, new LeafPosition(this, 0), false)); - returnList.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, + seq.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, new LeafPosition(this, -1), true)); - returnList.add(new KnuthGlue(0, 0, 0, + seq.add(new KnuthGlue(0, 0, 0, new LeafPosition(this, -1), true)); - returnList.add(new KnuthInlineBox(0, 0, 0, 0, + seq.add(new KnuthInlineBox(0, 0, 0, 0, new LeafPosition(this, -1), true)); } + LinkedList returnList = new LinkedList(); + returnList.add(seq); setFinished(true); return returnList; } diff --git a/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java index 779c4c587..21267f7c5 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java @@ -74,7 +74,9 @@ public class FootnoteLayoutManager extends AbstractLayoutManager if (returnedList.size() == 0) { //Inline part of the footnote is empty. Need to send back an auxiliary //zero-width, zero-height inline box so the footnote gets painted. - returnedList.add(new KnuthInlineBox(0, 0, 0, 0, null, true)); + KnuthSequence seq = new KnuthSequence(true); + seq.add(new KnuthInlineBox(0, 0, 0, 0, null, true)); + returnedList.add(seq); } setFinished(true); diff --git a/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java index 8dc2481c8..7d87ea8fd 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java @@ -30,6 +30,7 @@ import org.apache.fop.layoutmgr.KnuthElement; import org.apache.fop.layoutmgr.KnuthGlue; import org.apache.fop.layoutmgr.KnuthPenalty; import org.apache.fop.layoutmgr.KnuthPossPosIter; +import org.apache.fop.layoutmgr.KnuthSequence; import org.apache.fop.layoutmgr.LayoutContext; import org.apache.fop.layoutmgr.LeafPosition; import org.apache.fop.layoutmgr.Position; @@ -244,7 +245,7 @@ public class LeaderLayoutManager extends LeafNodeLayoutManager { int alignment) { MinOptMax ipd; curArea = get(context); - LinkedList returnList = new LinkedList(); + KnuthSequence seq = new KnuthSequence(true); if (curArea == null) { setFinished(true); @@ -273,20 +274,22 @@ public class LeaderLayoutManager extends LeafNodeLayoutManager { lead, total, middle); // node is a fo:Leader - returnList.add(new KnuthInlineBox(0, areaInfo.lead, areaInfo.total, + seq.add(new KnuthInlineBox(0, areaInfo.lead, areaInfo.total, areaInfo.middle, new LeafPosition(this, -1), true)); - returnList.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, + seq.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, new LeafPosition(this, -1), true)); - returnList.add + seq.add (new KnuthGlue(areaInfo.ipdArea.opt, areaInfo.ipdArea.max - areaInfo.ipdArea.opt, areaInfo.ipdArea.opt - areaInfo.ipdArea.min, new LeafPosition(this, 0), false)); - returnList.add(new KnuthInlineBox(0, areaInfo.lead, areaInfo.total, + seq.add(new KnuthInlineBox(0, areaInfo.lead, areaInfo.total, areaInfo.middle, new LeafPosition(this, -1), true)); + LinkedList returnList = new LinkedList(); + returnList.add(seq); setFinished(true); return returnList; } diff --git a/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java index 1bd06564c..56a8e9f10 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java @@ -22,6 +22,7 @@ import org.apache.fop.area.Area; import org.apache.fop.area.inline.InlineArea; import org.apache.fop.fo.FObj; import org.apache.fop.layoutmgr.AbstractLayoutManager; +import org.apache.fop.layoutmgr.KnuthSequence; import org.apache.fop.layoutmgr.LayoutContext; import org.apache.fop.layoutmgr.LeafPosition; import org.apache.fop.layoutmgr.Position; @@ -286,10 +287,12 @@ public abstract class LeafNodeLayoutManager extends AbstractLayoutManager // node is a fo:ExternalGraphic, fo:InstreamForeignObject, // fo:PageNumber or fo:PageNumberCitation - LinkedList returnList = new LinkedList(); - returnList.add(new KnuthInlineBox(areaInfo.ipdArea.opt, areaInfo.lead, + KnuthSequence seq = new KnuthSequence(true); + seq.add(new KnuthInlineBox(areaInfo.ipdArea.opt, areaInfo.lead, areaInfo.total, areaInfo.middle, new LeafPosition(this, 0), false)); + LinkedList returnList = new LinkedList(); + returnList.add(seq); setFinished(true); return returnList; } -- 2.39.5