]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Initial fix for examples/basic/leader.fo problem
authorManuel Mall <manuel@apache.org>
Sun, 13 Nov 2005 16:06:51 +0000 (16:06 +0000)
committerManuel Mall <manuel@apache.org>
Sun, 13 Nov 2005 16:06:51 +0000 (16:06 +0000)
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
src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
test/layoutengine/standard-testcases/leader_leader-pattern_use-content.xml
test/layoutengine/standard-testcases/text-decoration_2.xml

index febc5ac98272db179da4aadc49a6856559b7cd87..9c3bcf4ca5dff2a518c985602c28598a7f308cfc 100644 (file)
@@ -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
index f16b78553f1e87081d9cd6ce7cc07a00cd1318a7..ede040d213746d67f574bc07d2635238cafd6bee 100644 (file)
@@ -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());
index 11287f0586ab0edc72bca1196bc3a1e7245f9e53..a27218736c9817b9ebac08e251520a845b0c0cbc 100644 (file)
             <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>
     <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>
index 07f565b39fdb56ff04609d210a1260ec40c500e2..04229fcc878a863b15a40bb39498a5907eab1034 100644 (file)
@@ -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>