deweese 2002/08/27 06:17:45 Modified: samples/tests/spec/text textPosition.svg textPosition2.svg sources/org/apache/batik/bridge SVGTextElementBridge.java Log: 1) Fixed a bug in the handling of position attributes on empty tspans they overwrite all preceeding position attributes. PR: 10725 Revision Changes Path 1.2 +10 -1 xml-batik/samples/tests/spec/text/textPosition.svg Index: textPosition.svg =================================================================== RCS file: /home/cvs/xml-batik/samples/tests/spec/text/textPosition.svg,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- textPosition.svg 10 Dec 2001 14:24:23 -0000 1.1 +++ textPosition.svg 27 Aug 2002 13:17:44 -0000 1.2 @@ -77,6 +77,15 @@ <text x="240" y="340" class="info"><tspan x="240" dx="0 10 10 10 10" <tspan x="273" dy="1.1em">y="320" style="letter-spacing:10"></tspan></text> +<!-- ################################################################ --> + +<text><tspan x="50" letter-spacing="10" y="380">Batik</tspan><tspan x="10" y="380"/></text> +<text x="50" y="400" class="info">Empty Trailing tspan</text> + + +<text><tspan x="200" y="380"/><tspan x="240" letter-spacing="20" y="380">Batik</tspan></text> +<text x="240" y="400" class="info">Empty Preceeding tspan</text> + </g> 1.2 +3 -3 xml-batik/samples/tests/spec/text/textPosition2.svg Index: textPosition2.svg =================================================================== RCS file: /home/cvs/xml-batik/samples/tests/spec/text/textPosition2.svg,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- textPosition2.svg 10 Dec 2001 14:24:23 -0000 1.1 +++ textPosition2.svg 27 Aug 2002 13:17:44 -0000 1.2 @@ -19,7 +19,7 @@ <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="450" height="500" viewBox="0 0 450 500"> -<title>Text Position</title> +<title>Text Position 2</title> <style type="text/css"><![CDATA[ .info { @@ -55,7 +55,7 @@ <!-- Test content --> <!-- ============================================================= --> -<text class="title" x="50%" y="30">Text Position</text> +<text class="title" x="50%" y="30">Text Position 2</text> <g id="testContent" style="font-family:SVGArial; font-size:24"> 1.70 +19 -14 xml-batik/sources/org/apache/batik/bridge/SVGTextElementBridge.java Index: SVGTextElementBridge.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGTextElementBridge.java,v retrieving revision 1.69 retrieving revision 1.70 diff -u -r1.69 -r1.70 --- SVGTextElementBridge.java 5 Jun 2002 21:14:47 -0000 1.69 +++ SVGTextElementBridge.java 27 Aug 2002 13:17:44 -0000 1.70 @@ -901,10 +901,11 @@ * Appends a String and its associated attributes. */ public void append(String s, Map m) { - strings.add(s); - attributes.add(m); - count++; - length += s.length(); + if (s.length() == 0) return; + strings.add(s); + attributes.add(m); + count++; + length += s.length(); } /** @@ -1021,18 +1022,10 @@ if (!SVGUtilities.matchUserAgent(element, ctx.getUserAgent())) { return; } - // get all of the glyph position attribute values - String xAtt = element.getAttributeNS(null, SVG_X_ATTRIBUTE); - String yAtt = element.getAttributeNS(null, SVG_Y_ATTRIBUTE); - String dxAtt = element.getAttributeNS(null, SVG_DX_ATTRIBUTE); - String dyAtt = element.getAttributeNS(null, SVG_DY_ATTRIBUTE); - String rotateAtt = element.getAttributeNS(null, SVG_ROTATE_ATTRIBUTE); - - UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, element); AttributedCharacterIterator aci = as.getIterator(); // calculate which chars in the string belong to this element - int firstChar = 0; + int firstChar = -1; for (int i = 0; i < aci.getEndIndex(); i++) { aci.setIndex(i); Element delimeter = (Element)aci.getAttribute( @@ -1043,6 +1036,9 @@ break; } } + // No match so no chars to annotate. + if (firstChar == -1) return; + int lastChar = aci.getEndIndex()-1; for (int i = aci.getEndIndex()-1; i >= 0; i--) { aci.setIndex(i); @@ -1054,6 +1050,15 @@ break; } } + + // get all of the glyph position attribute values + String xAtt = element.getAttributeNS(null, SVG_X_ATTRIBUTE); + String yAtt = element.getAttributeNS(null, SVG_Y_ATTRIBUTE); + String dxAtt = element.getAttributeNS(null, SVG_DX_ATTRIBUTE); + String dyAtt = element.getAttributeNS(null, SVG_DY_ATTRIBUTE); + String rotateAtt = element.getAttributeNS(null, SVG_ROTATE_ATTRIBUTE); + + UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, element); ArrayList al; int len;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]