From d5b198f09451d04a57226914ae7f68b66ea6d6fd Mon Sep 17 00:00:00 2001 From: Manuel Mall Date: Sun, 13 Nov 2005 16:06:51 +0000 Subject: Initial fix for examples/basic/leader.fo problem git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@333041 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/area/inline/FilledArea.java | 9 +++++++++ .../org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java | 7 +++++++ 2 files changed, 16 insertions(+) (limited to 'src/java/org/apache') diff --git a/src/java/org/apache/fop/area/inline/FilledArea.java b/src/java/org/apache/fop/area/inline/FilledArea.java index febc5ac98..9c3bcf4ca 100644 --- a/src/java/org/apache/fop/area/inline/FilledArea.java +++ b/src/java/org/apache/fop/area/inline/FilledArea.java @@ -74,6 +74,15 @@ public class FilledArea extends InlineParent { unitWidth = w; } + /** + * Return the unit width for the areas to fill the full width. + * + * @return the unit width + */ + public int getUnitWidth() { + return unitWidth; + } + /** * Get the child areas for this filed area. * This copies the references of the inline areas so that diff --git a/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java index f16b78553..ede040d21 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java @@ -233,6 +233,13 @@ public class LeaderLayoutManager extends LeafNodeLayoutManager { , context.getAlignmentContext()); ipd = getAllocationIPD(context.getRefIPD()); + if (fobj.getLeaderPattern() == EN_USECONTENT && curArea instanceof FilledArea) { + // If we have user supplied content make it fit if we can + int unitWidth = ((FilledArea)curArea).getUnitWidth(); + if (ipd.opt < unitWidth && ipd.max >= unitWidth) { + ipd.opt = unitWidth; + } + } // create the AreaInfo object to store the computed values areaInfo = new AreaInfo((short) 0, ipd, false, context.getAlignmentContext()); -- cgit v1.2.3