You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2008/06/02 14:50:55 UTC

svn commit: r662417 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java test/layoutengine/standard-testcases/block_keep-together_integers_1.xml

Author: jeremias
Date: Mon Jun  2 05:50:55 2008
New Revision: 662417

URL: http://svn.apache.org/viewvc?rev=662417&view=rev
Log:
Integer keeps inside multi-line blocks and in between block-paragraphs.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_integers_1.xml

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java?rev=662417&r1=662416&r2=662417&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java Mon Jun  2 05:50:55 2008
@@ -46,6 +46,7 @@
 import org.apache.fop.layoutmgr.BreakingAlgorithm;
 import org.apache.fop.layoutmgr.ElementListObserver;
 import org.apache.fop.layoutmgr.InlineKnuthSequence;
+import org.apache.fop.layoutmgr.KeepUtil;
 import org.apache.fop.layoutmgr.KnuthBlockBox;
 import org.apache.fop.layoutmgr.KnuthBox;
 import org.apache.fop.layoutmgr.KnuthElement;
@@ -1052,11 +1053,14 @@
         LinkedList returnList = new LinkedList();
         
         for (int p = 0; p < knuthParagraphs.size(); p++) {
-            // null penalty between paragraphs
-            if (p > 0 && !((BlockLevelLayoutManager) parentLM).mustKeepTogether()) {
-                returnList.add(new BreakElement(
-                        new Position(this), 0, context));
-                //returnList.add(new KnuthPenalty(0, 0, false, new Position(this), false));
+            // penalty between paragraphs
+            if (p > 0) {
+                int strength = getKeepTogetherStrength();
+                int penalty = KeepUtil.getPenaltyForKeep(strength);
+                if (penalty < KnuthElement.INFINITE) {
+                    returnList.add(new BreakElement(
+                            new Position(this), penalty, context));
+                }
             }
         
             LineLayoutPossibilities llPoss;
@@ -1090,14 +1094,17 @@
                 for (int i = 0;
                         i < llPoss.getChosenLineCount();
                         i++) {
-                    if (!((BlockLevelLayoutManager) parentLM).mustKeepTogether()
+                    if (returnList.size() > 0
+                            && i > 0 //if i==0 break generated above already
                             && i >= fobj.getOrphans()
-                            && i <= llPoss.getChosenLineCount() - fobj.getWidows()
-                            && returnList.size() > 0) {
-                        // null penalty allowing a page break between lines
-                        returnList.add(new BreakElement(
-                                returnPosition, 0, context));
-                        //returnList.add(new KnuthPenalty(0, 0, false, returnPosition, false));
+                            && i <= llPoss.getChosenLineCount() - fobj.getWidows()) {
+                        // penalty allowing a page break between lines
+                        int strength = getKeepTogetherStrength();
+                        int penalty = KeepUtil.getPenaltyForKeep(strength);
+                        if (penalty < KnuthElement.INFINITE) {
+                            returnList.add(new BreakElement(
+                                    returnPosition, penalty, context));
+                        }
                     }
                     int endIndex
                       = ((LineBreakPosition) llPoss.getChosenPosition(i)).getLeafPos();

Modified: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_integers_1.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_integers_1.xml?rev=662417&r1=662416&r2=662417&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_integers_1.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_integers_1.xml Mon Jun  2 05:50:55 2008
@@ -54,6 +54,11 @@
             </fo:block>
             <fo:block>block10</fo:block>
           </fo:block>
+          <fo:block keep-together.within-column="5" linefeed-treatment="preserve">The quick brown fox jumps over the lazy dog.
+            The quick brown fox jumps over the lazy dog.
+            The quick brown fox jumps over the lazy dog.
+            The quick brown fox jumps over the lazy dog.
+          </fo:block>
         </fo:flow>
       </fo:page-sequence>
     </fo:root>
@@ -76,7 +81,9 @@
       <box/>
       <penalty w="0" p="0"/>
       <box/> <!-- block 3 -->
+      <penalty w="0" p="999"/>
       <box/>
+      <penalty w="0" p="999"/>
       <box/>
       <penalty w="0" p="0"/>
       <box/> <!-- block4 -->
@@ -91,7 +98,17 @@
       <penalty w="0" p="INF"/>
       <box/> <!-- block9 -->
       <penalty w="0" p="999"/>
+      <box/> <!-- block10 -->
+      <penalty w="0" p="0"/>
+
+      <box/>
+      <penalty w="0" p="999"/>
       <box/>
+      <penalty w="0" p="999"/>
+      <box/>
+      <penalty w="0" p="999"/>
+      <box/>
+      
       
       <skip>3</skip>
     </element-list>



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org