From 26df5d3099cf61227665a120fd55c4d5461265c7 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Thu, 8 Dec 2005 10:15:33 +0000 Subject: Looks like the 2-column situation has to be handled differently than the 3-column approach. The 4-column example shows that my current approach is not good enough and needs to be revisited. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@355063 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/layoutmgr/BalancingColumnBreakingAlgorithm.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java b/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java index b3a887f34..77c8b43c4 100644 --- a/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java +++ b/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java @@ -76,12 +76,18 @@ public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm { log.trace("balance=" + balance); } double absBalance = Math.abs(balance); + dem = absBalance; //Step 1: This does the rough balancing - if (balance <= 0) { - dem = absBalance; + if (columnCount > 2) { + if (balance > 0) { + //shorter parts are less desired than longer ones + dem = dem * 1.2f; + } } else { - //shorter parts are less desired than longer ones - dem = absBalance * 1.2f; + if (balance < 0) { + //shorter parts are less desired than longer ones + dem = dem * 1.2f; + } } //Step 2: This helps keep the trailing parts shorter than the previous ones dem += (avgRestLen) / 1000f; -- cgit v1.2.3