diff options
author | Jeremias Maerki <jeremias@apache.org> | 2006-01-24 13:45:56 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2006-01-24 13:45:56 +0000 |
commit | 9ded99b802da5240a8c69066b019cb2d9dc99a73 (patch) | |
tree | c9b45c46acd6cca370c01f93a0ead47ba1b950b3 /src | |
parent | aeada3dbe380038575caed949a2daac250a4ac76 (diff) | |
download | xmlgraphics-fop-9ded99b802da5240a8c69066b019cb2d9dc99a73.tar.gz xmlgraphics-fop-9ded99b802da5240a8c69066b019cb2d9dc99a73.zip |
Bugfix: LineArea used a private field instead of the start-indent trait which caused problems for centered and right-aligned text when rendering is done from the intermediate format. The AreaTreeParser parses and sets the trait but not the startIndent field on LineArea, so I removed the startIndent field.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@371912 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/fop/area/LineArea.java | 29 | ||||
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java | 8 |
2 files changed, 11 insertions, 26 deletions
diff --git a/src/java/org/apache/fop/area/LineArea.java b/src/java/org/apache/fop/area/LineArea.java index e19e71374..eb2343565 100644 --- a/src/java/org/apache/fop/area/LineArea.java +++ b/src/java/org/apache/fop/area/LineArea.java @@ -57,14 +57,6 @@ public class LineArea extends Area { private LineAdjustingInfo adjustingInfo = null; - //private int stacking = LR; - // contains inline areas - // has start indent and length, dominant baseline, height - private int startIndent; - - // this is the offset for the dominant baseline - //private int baseLine; - // this class can contain the dominant char styling info // this means that many renderers can optimise a bit @@ -122,17 +114,6 @@ public class LineArea extends Area { } /** - * Set the start indent of this line area. - * The start indent is used for offsetting the start of - * the inline areas for alignment or other indents. - * - * @param si the start indent value - */ - public void setStartIndent(int si) { - startIndent = si; - } - - /** * Get the start indent of this line area. * The start indent is used for offsetting the start of * the inline areas for alignment or other indents. @@ -140,7 +121,11 @@ public class LineArea extends Area { * @return the start indent value */ public int getStartIndent() { - return startIndent; + if (hasTrait(Trait.START_INDENT)) { + return getTraitAsInteger(Trait.START_INDENT); + } else { + return 0; + } } /** @@ -179,11 +164,11 @@ public class LineArea extends Area { break; case Constants.EN_CENTER: // re-compute indent - startIndent -= ipdVariation / 2; + addTrait(Trait.START_INDENT, new Integer(getStartIndent() - ipdVariation / 2)); break; case Constants.EN_END: // re-compute indent - startIndent -= ipdVariation; + addTrait(Trait.START_INDENT, new Integer(getStartIndent() - ipdVariation)); break; case Constants.EN_JUSTIFY: // compute variation factor diff --git a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java index e3ea55669..c5d322a82 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java @@ -14,7 +14,7 @@ * limitations under the License. */ -/* $Id: LineLayoutManager.java,v 1.17 2004/04/02 10:38:29 cbowditch Exp $ */ +/* $Id$ */ package org.apache.fop.layoutmgr.inline; @@ -1664,7 +1664,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager = new LineArea((lbp.getLeafPos() < seq.size() - 1 ? textAlignment : textAlignmentLast), lbp.difference, lbp.availableStretch, lbp.availableShrink); - lineArea.setStartIndent(lbp.startIndent); + lineArea.addTrait(Trait.START_INDENT, new Integer(lbp.startIndent)); lineArea.setBPD(lbp.lineHeight); lineArea.setIPD(lbp.lineWidth); lineArea.addTrait(Trait.SPACE_BEFORE, new Integer(lbp.spaceBefore)); @@ -1745,12 +1745,12 @@ public class LineLayoutManager extends InlineStackingLayoutManager // re-compute indent int updatedIndent = lbp.startIndent + (context.getStackLimit().opt - lbp.lineWidth) / 2; - lineArea.setStartIndent(updatedIndent); + lineArea.addTrait(Trait.START_INDENT, new Integer(updatedIndent)); } else if (false && textAlignment == EN_END) { // re-compute indent int updatedIndent = lbp.startIndent + (context.getStackLimit().opt - lbp.lineWidth); - lineArea.setStartIndent(updatedIndent); + lineArea.addTrait(Trait.START_INDENT, new Integer(updatedIndent)); } setCurrentArea(lineArea); |