aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
diff options
context:
space:
mode:
authorLuca Furini <lfurini@apache.org>2005-05-30 15:56:42 +0000
committerLuca Furini <lfurini@apache.org>2005-05-30 15:56:42 +0000
commit8236380d5c1dfd3ece361c65b7975f7b09f607d3 (patch)
treef0ea59e4e47343f20e64d5cfee79c8aa03c037c3 /src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
parent4fd57be8583def33a23a5e1a4bf8adde73b1183a (diff)
downloadxmlgraphics-fop-8236380d5c1dfd3ece361c65b7975f7b09f607d3.tar.gz
xmlgraphics-fop-8236380d5c1dfd3ece361c65b7975f7b09f607d3.zip
Handling of very long footnotes
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198702 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java')
-rw-r--r--src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java b/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
index 11e125475..e7098e330 100644
--- a/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
+++ b/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
@@ -55,7 +55,7 @@ public abstract class BreakingAlgorithm {
/**
* The paragraph of KnuthElements.
*/
- private KnuthSequence par;
+ protected KnuthSequence par;
/**
* The width of a line.
@@ -370,6 +370,7 @@ public abstract class BreakingAlgorithm {
i = lastForced.position;
}
}
+ finish();
if (log.isTraceEnabled()) {
log.trace("Main loop completed " + activeNodeCount);
log.trace("Active nodes=" + toString(""));
@@ -381,7 +382,7 @@ public abstract class BreakingAlgorithm {
// for each active node, create a set of breaking points
for (int i = startLine; i < endLine; i++) {
- for (KnuthNode node = getNode(line); node != null; node = node.next) {
+ for (KnuthNode node = getNode(i); node != null; node = node.next) {
updateData1(node.line, node.totalDemerits);
calculateBreakPoints(node, par, node.line);
}
@@ -443,7 +444,7 @@ public abstract class BreakingAlgorithm {
if (node.position == elementIdx) {
continue;
}
- int difference = computeDifference(node, element);
+ int difference = computeDifference(node, element, elementIdx);
double r = computeAdjustmentRatio(node, difference);
int availableShrink = totalShrink - node.totalShrink;
int availableStretch = totalStretch - node.totalStretch;
@@ -559,7 +560,8 @@ public abstract class BreakingAlgorithm {
* @return The difference in width. Positive numbers mean extra space in the line,
* negative number that the line overflows.
*/
- protected int computeDifference(KnuthNode activeNode, KnuthElement element) {
+ protected int computeDifference(KnuthNode activeNode, KnuthElement element,
+ int elementIndex) {
// compute the adjustment ratio
int actualWidth = totalWidth - activeNode.totalWidth;
if (element.isPenalty()) {
@@ -653,6 +655,9 @@ public abstract class BreakingAlgorithm {
return demerits;
}
+ protected void finish() {
+ }
+
/**
* Return the element at index idx in the paragraph.
* @param idx index of the element.
@@ -686,7 +691,7 @@ public abstract class BreakingAlgorithm {
* @param line
* @param node
*/
- private void addNode(int line, KnuthNode node) {
+ protected void addNode(int line, KnuthNode node) {
int headIdx = line * 2;
if (headIdx >= activeLines.length) {
KnuthNode[] oldList = activeLines;