aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org
diff options
context:
space:
mode:
authorLuca Furini <lfurini@apache.org>2005-06-14 16:12:08 +0000
committerLuca Furini <lfurini@apache.org>2005-06-14 16:12:08 +0000
commit1011fe2181fffbf37b806103a28f5ab3e0fe6b9c (patch)
treeb2ce45a2279d13354182cc05505ed19eb5182841 /src/java/org
parent96b68e466d5ea08b1ee72bb0504770725271cdaa (diff)
downloadxmlgraphics-fop-1011fe2181fffbf37b806103a28f5ab3e0fe6b9c.tar.gz
xmlgraphics-fop-1011fe2181fffbf37b806103a28f5ab3e0fe6b9c.zip
The bpd of lines with no real content must collapse to 0
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198744 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org')
-rw-r--r--src/java/org/apache/fop/layoutmgr/LineLayoutManager.java40
1 files changed, 28 insertions, 12 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java
index f1063ad25..13befec2c 100644
--- a/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java
@@ -354,6 +354,10 @@ public class LineLayoutManager extends InlineStackingLayoutManager
int maxtb = follow;
// max size of middle alignment before and after the middle baseline
int middlefollow = maxtb;
+ // true if this line contains only zero-height, auxiliary boxes
+ // and the actual line width is 0; in this case, the line "collapses"
+ // i.e. the line area will have bpd = 0
+ boolean bZeroHeightLine = (difference == iLineWidth);
// if line-stacking-strategy is "font-height", the line height
// is not affected by its content
@@ -379,6 +383,13 @@ public class LineLayoutManager extends InlineStackingLayoutManager
middlefollow += ((KnuthInlineBox) element).getMiddle()
- middlefollow + middleShift;
}
+ if (bZeroHeightLine
+ && (!element.isAuxiliary()
+ || ((KnuthInlineBox) element).getTotal() > 0
+ || ((KnuthInlineBox) element).getLead() > 0
+ || ((KnuthInlineBox) element).getMiddle() > 0)) {
+ bZeroHeightLine = false;
+ }
}
}
@@ -387,19 +398,24 @@ public class LineLayoutManager extends InlineStackingLayoutManager
}
}
- //lineLead += halfLeading;
- //middlefollow += lineHeight - lead - follow - halfLeading;
-
constantLineHeight = lineLead + middlefollow + (lineHeight - lead - follow);
- //System.out.println("desired height: " + lineHeight + " actual height: " + (lineLead + middlefollow + (lineHeight - lead - follow)) + " halfleading = " + halfLeading + " and " + (lineHeight - lead - follow - halfLeading));
-
- return new LineBreakPosition(thisLLM,
- knuthParagraphs.indexOf(par),
- lastElementIndex,
- availableShrink, availableStretch, difference, ratio, 0, indent,
- lineLead + middlefollow + (lineHeight - lead - follow), iLineWidth,
- lineLead + halfLeading,
- - lineLead, middlefollow);
+
+ if (bZeroHeightLine) {
+ return new LineBreakPosition(thisLLM,
+ knuthParagraphs.indexOf(par),
+ lastElementIndex,
+ availableShrink, availableStretch, difference, ratio, 0, indent,
+ 0, iLineWidth,
+ 0, 0, 0);
+ } else {
+ return new LineBreakPosition(thisLLM,
+ knuthParagraphs.indexOf(par),
+ lastElementIndex,
+ availableShrink, availableStretch, difference, ratio, 0, indent,
+ lineLead + middlefollow + (lineHeight - lead - follow), iLineWidth,
+ lineLead + halfLeading,
+ - lineLead, middlefollow);
+ }
}
public int findBreakingPoints(Paragraph par, int lineWidth,