From d5b198f09451d04a57226914ae7f68b66ea6d6fd Mon Sep 17 00:00:00 2001 From: Manuel Mall Date: Sun, 13 Nov 2005 16:06:51 +0000 Subject: [PATCH] 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 --- .../apache/fop/area/inline/FilledArea.java | 9 ++++ .../layoutmgr/inline/LeaderLayoutManager.java | 7 +++ .../leader_leader-pattern_use-content.xml | 47 +++++++++++++++++++ .../standard-testcases/text-decoration_2.xml | 2 +- 4 files changed, 64 insertions(+), 1 deletion(-) 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()); diff --git a/test/layoutengine/standard-testcases/leader_leader-pattern_use-content.xml b/test/layoutengine/standard-testcases/leader_leader-pattern_use-content.xml index 11287f058..a27218736 100644 --- a/test/layoutengine/standard-testcases/leader_leader-pattern_use-content.xml +++ b/test/layoutengine/standard-testcases/leader_leader-pattern_use-content.xml @@ -50,6 +50,26 @@ ++ Content is "++" with l-p-w="12pt" and border small font + + + + + + + + Content is svg 10 x 10 + + + + + + + + + + + Content is svg 20 x 10 which is wider than the default leader-length + @@ -126,5 +146,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/layoutengine/standard-testcases/text-decoration_2.xml b/test/layoutengine/standard-testcases/text-decoration_2.xml index 07f565b39..04229fcc8 100644 --- a/test/layoutengine/standard-testcases/text-decoration_2.xml +++ b/test/layoutengine/standard-testcases/text-decoration_2.xml @@ -31,7 +31,7 @@ - normal under through none under normal + normal under through none under normal -- 2.39.5