diff options
author | Manuel Mall <manuel@apache.org> | 2005-11-13 16:06:51 +0000 |
---|---|---|
committer | Manuel Mall <manuel@apache.org> | 2005-11-13 16:06:51 +0000 |
commit | d5b198f09451d04a57226914ae7f68b66ea6d6fd (patch) | |
tree | 6fc777d9c55da14b8682d4c944e9307c90bfc88e | |
parent | 8d4c6805ee30385f9200b5fa02826a4bfbc5a6b9 (diff) | |
download | xmlgraphics-fop-d5b198f09451d04a57226914ae7f68b66ea6d6fd.tar.gz xmlgraphics-fop-d5b198f09451d04a57226914ae7f68b66ea6d6fd.zip |
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
4 files changed, 64 insertions, 1 deletions
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 @@ -75,6 +75,15 @@ public class FilledArea extends InlineParent { } /** + * 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 * it fills the total width of the area a whole number of times 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 @@ <fo:leader leader-length="36pt" leader-pattern="use-content" leader-pattern-width="12pt"><fo:inline border="solid 1pt red" font-size="6pt" alignment-baseline="middle" background-color="yellow">++</fo:inline></fo:leader> Content is "++" with l-p-w="12pt" and border small font </fo:block> + <fo:block> + <fo:leader leader-length="36pt" leader-pattern="use-content" leader-pattern-width="12pt"><fo:instream-foreign-object> + <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10"> + <rect x="0" y="0" width="5" height="5" style="fill:red"/> + <rect x="5" y="5" width="5" height="5" style="fill:black"/> + </svg> + </fo:instream-foreign-object></fo:leader> + Content is svg 10 x 10 + </fo:block> + <fo:block> + <fo:leader leader-pattern="use-content"> + <fo:instream-foreign-object> + <svg xmlns="http://www.w3.org/2000/svg" width="20" height="10"> + <rect x="0" y="0" width="10" height="5" style="fill:red"/> + <rect x="5" y="5" width="10" height="5" style="fill:black"/> + </svg> + </fo:instream-foreign-object> + </fo:leader> + Content is svg 20 x 10 which is wider than the default leader-length + </fo:block> </fo:flow> </fo:page-sequence> </fo:root> @@ -126,5 +146,32 @@ <eval expected="0" xpath="//flow/block[5]/lineArea/inlineparent/inlineparent[3]/@offset"/> <eval expected="2739" xpath="//flow/block[5]/lineArea/inlineparent/inlineparent[3]/inlineparent/@offset"/> <eval expected="1000 1000 1000 1000" xpath="//flow/block[5]/lineArea/inlineparent/inlineparent[3]/inlineparent/@bap"/> + + <eval expected="11100" xpath="//flow/block[6]/lineArea/@bpd"/> + <eval expected="36000" xpath="//flow/block[6]/lineArea/inlineparent/@ipd"/> + <eval expected="0" xpath="//flow/block[6]/lineArea/inlineparent/@offset"/> + <eval expected="2000" xpath="//flow/block[6]/lineArea/inlineparent/space/@ipd"/> + <eval expected="10000" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[1]/@ipd"/> + <eval expected="0" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[1]/@offset"/> + <eval expected="-1384" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[1]/viewport/@offset"/> + <eval expected="0 0 0 0" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[1]/viewport/@bap"/> + <eval expected="2000" xpath="//flow/block[6]/lineArea/inlineparent/space/@ipd"/> + <eval expected="10000" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[2]/@ipd"/> + <eval expected="0" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[2]/@offset"/> + <eval expected="-1384" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[2]/viewport/@offset"/> + <eval expected="0 0 0 0" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[2]/viewport/@bap"/> + <eval expected="2000" xpath="//flow/block[6]/lineArea/inlineparent/space/@ipd"/> + <eval expected="10000" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[3]/@ipd"/> + <eval expected="0" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[3]/@offset"/> + <eval expected="-1384" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[3]/viewport/@offset"/> + <eval expected="0 0 0 0" xpath="//flow/block[6]/lineArea/inlineparent/inlineparent[3]/viewport/@bap"/> + + <eval expected="11100" xpath="//flow/block[7]/lineArea/@bpd"/> + <eval expected="23336" xpath="//flow/block[7]/lineArea/inlineparent/@ipd"/> + <eval expected="0" xpath="//flow/block[7]/lineArea/inlineparent/@offset"/> + <eval expected="23336" xpath="//flow/block[7]/lineArea/inlineparent/inlineparent[1]/@ipd"/> + <eval expected="0" xpath="//flow/block[7]/lineArea/inlineparent/inlineparent[1]/@offset"/> + <eval expected="20000" xpath="//flow/block[7]/lineArea/inlineparent/inlineparent[1]/viewport/@ipd"/> + <eval expected="-1384" xpath="//flow/block[7]/lineArea/inlineparent/inlineparent[1]/viewport/@offset"/> </checks> </testcase> 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 @@ <fo:page-sequence master-reference="normal" white-space-collapse="true"> <fo:flow flow-name="xsl-region-body"> <!-- nested inlines --> - <fo:block>normal <fo:inline color="blue" text-decoration="underline">under <fo:inline color="red" text-decoration="line-through">through</fo:inline> <fo:inline text-decoration="none">none</fo:inline> under</fo:inline> normal</fo:block> + <fo:block>normal <fo:inline color="blue" text-decoration="underline">under <fo:inline color="red" font-size="14pt" text-decoration="line-through">through</fo:inline> <fo:inline text-decoration="none">none</fo:inline> under</fo:inline> normal</fo:block> </fo:flow> </fo:page-sequence> </fo:root> |