aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-08-30 15:35:37 +0000
committerJeremias Maerki <jeremias@apache.org>2005-08-30 15:35:37 +0000
commitbcbc006c0c8c7dca492889df68a1fc52f220c457 (patch)
tree37a15293bef3a97571d33e28878101bae33776c4 /src
parent95cba97324944482e073c34662cb43ed8d637841 (diff)
downloadxmlgraphics-fop-bcbc006c0c8c7dca492889df68a1fc52f220c457.tar.gz
xmlgraphics-fop-bcbc006c0c8c7dca492889df68a1fc52f220c457.zip
Fix for text-align2.xml (for real now). The alignment used to set up the element list was not properly determined.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@264797 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
index f5a19c08f..eb669be69 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
@@ -75,13 +75,17 @@ public class LineLayoutManager extends InlineStackingLayoutManager
hyphProps = fobj.getCommonHyphenation();
//
+ effectiveAlignment = getEffectiveAlignment(bTextAlignment, bTextAlignmentLast);
+ }
+
+ private int getEffectiveAlignment(int alignment, int alignmentLast) {
if (bTextAlignment != EN_JUSTIFY && bTextAlignmentLast == EN_JUSTIFY) {
- effectiveAlignment = 0;
+ return 0;
} else {
- effectiveAlignment = bTextAlignment;
+ return bTextAlignment;
}
}
-
+
/**
* Private class to store information about inline breaks.
* Each value holds the start and end indexes into a List of
@@ -277,9 +281,10 @@ public class LineLayoutManager extends InlineStackingLayoutManager
*/
private void removeElementsForTrailingSpaces() {
KnuthElement removedElement;
+ int effectiveAlignment = getEffectiveAlignment(textAlignment, textAlignmentLast);
while (this.size() > ignoreAtStart
&& ((KnuthElement) this.get(this.size() - 1)).isGlue()) {
- if (textAlignmentLast == EN_CENTER) {
+ if (effectiveAlignment == EN_CENTER) {
// centered text: the pattern is
// <glue> <penaly> <glue> <box> <penaly> <glue>
removedElement = (KnuthGlue) this.remove(this.size() - 1);
@@ -288,7 +293,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
removedElement = (KnuthGlue) this.remove(this.size() - 1);
removedElement = (KnuthPenalty) this.remove(this.size() - 1);
removedElement = (KnuthGlue) this.remove(this.size() - 1);
- } else if (textAlignmentLast == EN_START || textAlignmentLast == EN_END) {
+ } else if (effectiveAlignment == EN_START || effectiveAlignment == EN_END) {
// left- or right-aligned text: the pattern is
// <glue> <penalty> <glue>
removedElement = (KnuthGlue) this.remove(this.size() - 1);
@@ -1411,6 +1416,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
break;
}
}
+
// collect word fragments, ignoring auxiliary elements;
// each word fragment was created by a different TextLM
if (firstElement.isBox() && !firstElement.isAuxiliary()) {