diff options
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> |