From 252c6c0648251301156920d6a1c861025c4a8a18 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Wed, 25 Jan 2006 09:57:01 +0000 Subject: [PATCH] My last change broke the test suite. Fix included. The start-indent should not be added to the area tree XML when it is zero. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@372175 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/layoutmgr/inline/LineLayoutManager.java | 4 +++- .../org/apache/fop/render/xml/XMLRenderer.java | 14 ++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java index c5d322a82..601b5ca62 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java @@ -1664,7 +1664,9 @@ public class LineLayoutManager extends InlineStackingLayoutManager = new LineArea((lbp.getLeafPos() < seq.size() - 1 ? textAlignment : textAlignmentLast), lbp.difference, lbp.availableStretch, lbp.availableShrink); - lineArea.addTrait(Trait.START_INDENT, new Integer(lbp.startIndent)); + if (lbp.startIndent != 0) { + 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)); diff --git a/src/java/org/apache/fop/render/xml/XMLRenderer.java b/src/java/org/apache/fop/render/xml/XMLRenderer.java index d231569d5..55881e1d1 100644 --- a/src/java/org/apache/fop/render/xml/XMLRenderer.java +++ b/src/java/org/apache/fop/render/xml/XMLRenderer.java @@ -309,13 +309,14 @@ public class XMLRenderer extends PrintRenderer { Iterator iter = traitMap.entrySet().iterator(); while (iter.hasNext()) { Map.Entry traitEntry = (Map.Entry) iter.next(); - String name = Trait.getTraitName(traitEntry.getKey()); - Class clazz = Trait.getTraitClass(traitEntry.getKey()); + Object key = traitEntry.getKey(); + String name = Trait.getTraitName(key); + Class clazz = Trait.getTraitClass(key); if ("break-before".equals(name) || "break-after".equals(name)) { continue; } Object value = traitEntry.getValue(); - if (Trait.getTraitName(Trait.FONT).equals(name)) { + if (key == Trait.FONT) { FontTriplet triplet = (FontTriplet)value; addAttribute("font-name", triplet.getName()); addAttribute("font-style", triplet.getStyle()); @@ -352,6 +353,10 @@ public class XMLRenderer extends PrintRenderer { addAttribute("bkg-horz-offset", bkg.getHoriz()); addAttribute("bkg-vert-offset", bkg.getVertical()); } + } else if (key == Trait.START_INDENT || key == Trait.END_INDENT) { + if (((Integer)value).intValue() != 0) { + addAttribute(name, value.toString()); + } } else { addAttribute(name, value.toString()); } @@ -681,9 +686,6 @@ public class XMLRenderer extends PrintRenderer { atts.clear(); addAreaAttributes(line); addTraitAttributes(line); - if (line.getStartIndent() != 0) { - addAttribute("start-indent", line.getStartIndent()); - } startElement("lineArea", atts); super.renderLineArea(line); endElement("lineArea"); -- 2.39.5