From: Joerg Pietschmann Date: Tue, 16 Jul 2002 20:04:44 +0000 (+0000) Subject: Fixed some remaining problems with the TextBuffer patch for X-Git-Tag: fop-0_20_5rc~127 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5af68d92a0e545655888d65ecbb0296410a2afb2;p=xmlgraphics-fop.git Fixed some remaining problems with the TextBuffer patch for FObjMixed Slightly Optimized extensions.Label git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_20_2-maintain@195003 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/org/apache/fop/extensions/Label.java b/src/org/apache/fop/extensions/Label.java index aa6bf1c31..c46384f38 100644 --- a/src/org/apache/fop/extensions/Label.java +++ b/src/org/apache/fop/extensions/Label.java @@ -11,7 +11,7 @@ import org.apache.fop.fo.*; public class Label extends ExtensionObj { - private String _label = ""; + private StringBuffer textBuffer; public static class Maker extends FObj.Maker { public FObj make(FObj parent, PropertyList propertyList) { @@ -28,12 +28,15 @@ public class Label extends ExtensionObj { super(parent, propertyList); } - protected void addCharacters(char data[], int start, int end) { - _label += new String(data, start, end - start); + protected void addCharacters(char data[], int start, int length) { + if (textBuffer==null) { + textBuffer = new StringBuffer(); + } + textBuffer.append(data,start,length); } public String toString() { - return _label; + return textBuffer.toString(); } diff --git a/src/org/apache/fop/fo/XMLObj.java b/src/org/apache/fop/fo/XMLObj.java index c7631efac..f4df1cb2b 100644 --- a/src/org/apache/fop/fo/XMLObj.java +++ b/src/org/apache/fop/fo/XMLObj.java @@ -128,7 +128,7 @@ public abstract class XMLObj extends FObj { } protected void addCharacters(char data[], int start, int length) { - String str = new String(data, start, length - start); + String str = new String(data, start, length); org.w3c.dom.Text text = doc.createTextNode(str); element.appendChild(text); }