aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-12-08 10:15:33 +0000
committerJeremias Maerki <jeremias@apache.org>2005-12-08 10:15:33 +0000
commit26df5d3099cf61227665a120fd55c4d5461265c7 (patch)
treed996f162737ca63384487f322376e35a3910183c /src/java/org/apache
parentc333acfb9bc42ee91f7b7cd11ff88fa7dca64272 (diff)
downloadxmlgraphics-fop-26df5d3099cf61227665a120fd55c4d5461265c7.tar.gz
xmlgraphics-fop-26df5d3099cf61227665a120fd55c4d5461265c7.zip
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
Diffstat (limited to 'src/java/org/apache')
-rw-r--r--src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java14
1 files changed, 10 insertions, 4 deletions
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;