deweese 2004/11/21 13:20:23 Modified: sources/org/apache/batik/bridge SVGTextElementBridge.java sources/org/apache/batik/gvt ShapeNode.java TextNode.java sources/org/apache/batik/gvt/font AWTGVTGlyphVector.java SVGGVTGlyphVector.java sources/org/apache/batik/gvt/text TextPaintInfo.java test-resources/org/apache/batik/test samplesRendering.xml Added: samples/tests/spec/scripting textProperties2.svg samples/tests/spec/text textProperties2.svg test-references/samples/tests/spec/scripting textProperties2.png test-references/samples/tests/spec/text textProperties2.png Log: 1) Fixed PR: 30923. Text children now respect display and visibility properties (including dynamic changes). 2) New tests for 1. PR: 30923 Revision Changes Path 1.1 xml-batik/samples/tests/spec/scripting/textProperties2.svg Index: textProperties2.svg =================================================================== <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> <!-- Copyright 2001-2002 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- ========================================================================= --> <!-- Test description here --> <!-- --> <!-- @author [EMAIL PROTECTED] --> <!-- @version $Id: textProperties2.svg,v 1.1 2004/11/21 21:20:22 deweese Exp $ --> <!-- ========================================================================= --> <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?> <svg width="450" height="500" viewBox="0 0 450 500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" > <style type="text/css"><![CDATA[ .Caption { font-size: 8; font-family: dialog; font-weight: normal; font-style: normal; stroke: none; stroke-width: 0; fill: black } text > tspan { fill: blue; } text > tspan > tspan { fill: purple; }]]> </style> <script type="text/ecmascript"><![CDATA[ var inRegard=false; var root; function regardStart() { inRegard = true; doChange(); } function doSet(idx, attr, tv, tsv, ttsv) { var t = root.getElementById("t"+idx); var ts = root.getElementById("ts"+idx); var tts = root.getElementById("tts"+idx); if (tv) t.setAttribute(attr, tv); if (tsv) ts.setAttribute(attr, tsv); if (ttsv) tts.setAttribute(attr, ttsv); } function doChange() { root = document.getRootElement(); doSet(1, "visibility", "hidden", "hidden", undefined); doSet(2, "visibility", undefined, undefined, "hidden"); doSet(3, "visibility", undefined, undefined, "visible"); doSet(4, "visibility", "visible", undefined, "visible"); doSet(5, "visibility", undefined, undefined, "hidden"); doSet(6, "visibility", "hidden", undefined, undefined); doSet(7, "display", undefined, "none", undefined); doSet(8, "display", undefined, undefined, "inline"); doSet(9, "display", undefined, "inline", undefined); doSet(10, "display", "none", "inline", "inline"); doSet(11, "display", "inline", undefined, undefined); if (inRegard) regardTestInstance.scriptDone(); } ]]></script> <rect fill="gold" stroke="crimson" x="15" y="15" width="70" height="25" onclick="doChange()"/> <text fill="crimson" x="50" y="32" font-weight="bold" text-anchor="middle" pointer-events="none">Change!</text> <title>Text Properties</title> <!-- ============================================================= --> <!-- Test content --> <!-- ============================================================= --> <g id="testContent"> <text class="title" x="50%" y="40" font-size="15" > Text display and visibility.</text> <text x="50%" y="74" text-anchor="middle" >Visibility on text & tspans</text> <text x="50%" y="250" text-anchor="middle" >Display on text & tspans</text> <g stroke="black" stroke-width="1"> <rect x="12.5" y="82" width="425" height="25" fill="#EEE"/> <rect x="12.5" y="107" width="425" height="25" fill="#CCC"/> <rect x="12.5" y="132" width="425" height="25" fill="#EEE"/> <rect x="12.5" y="157" width="425" height="25" fill="#CCC"/> <rect x="12.5" y="182" width="425" height="25" fill="#EEE"/> <rect x="12.5" y="207" width="425" height="25" fill="#CCC"/> <line x1="325" x2="325" y1="82" y2="232"/> <line x1="381" x2="381" y1="82" y2="232"/> <rect x="12.5" y="257" width="425" height="25" fill="#EEE"/> <rect x="12.5" y="282" width="425" height="25" fill="#CCC"/> <rect x="12.5" y="307" width="425" height="25" fill="#EEE"/> <rect x="12.5" y="332" width="425" height="25" fill="#CCC"/> <rect x="12.5" y="357" width="425" height="25" fill="#EEE"/> <line x1="325" x2="325" y1="257" y2="382"/> <line x1="381" x2="381" y1="257" y2="382"/> </g> <text class="Caption" x="335" y="97" >---, ---, ---</text> <text class="Caption" x="335" y="122">---, hid, vis</text> <text class="Caption" x="335" y="147">---, hid, hid</text> <text class="Caption" x="335" y="172">hid, vis, hid</text> <text class="Caption" x="335" y="197">---, ---, ---</text> <text class="Caption" x="335" y="222">---, ---, ---</text> <text class="Caption" x="391" y="97" >hid, hid, ---</text> <text class="Caption" x="391" y="122">---, ---, hid</text> <text class="Caption" x="391" y="147">---, ---, vis</text> <text class="Caption" x="391" y="172">vis, ---, vis</text> <text class="Caption" x="391" y="197">---, ---, hid</text> <text class="Caption" x="391" y="222">hid, ---, ---</text> <text class="Caption" x="335" y="273">---, ---, ---</text> <text class="Caption" x="335" y="298">---, inl, non</text> <text class="Caption" x="335" y="323">---, non, inl</text> <text class="Caption" x="335" y="348">---, non, non</text> <text class="Caption" x="335" y="373">non, inl, non</text> <text class="Caption" x="391" y="273">---, non, ---</text> <text class="Caption" x="391" y="298">---, ---, inl</text> <text class="Caption" x="391" y="323">---, inl, ---</text> <text class="Caption" x="391" y="348">non, inl, inl</text> <text class="Caption" x="391" y="373">inl, ---, ---</text> <g transform="scale(1.25), translate(0, 10)"> <text id="t1" x="20" y="70">Text <tspan id="ts1" >tspan 1 <tspan id="tts1"> tspan 2</tspan > more span 1</tspan> finish text</text> <text id="t2" x="20" y="90" >Text <tspan id="ts2" visibility="hidden" >tspan 1 <tspan id="tts2" visibility="visible"> tspan 2</tspan > more span 1</tspan> finish text</text> <text id="t3" x="20" y="110">Text <tspan id="ts3" visibility="hidden" >tspan 1 <tspan id="tts3" visibility="hidden" > tspan 2</tspan> more span 1</tspan> finish text</text> <text id="t4" x="20" y="130" visibility="hidden" >Text <tspan id="ts4" visibility="visible" >tspan 1 <tspan id="tts4" visibility="hidden"> tspan 2</tspan > more span 1</tspan> finish text</text> <text id="t5" x="20" y="150" >Text <tspan id="ts5" >tspan 1 <tspan id="tts5" > tspan 2</tspan > more span 1</tspan> finish text</text> <text id="t6" x="20" y="170" >Text <tspan id="ts6" >tspan 1 <tspan id="tts6" > tspan 2</tspan > more span 1</tspan> finish text</text> <text id="t7" x="20" y="210">Text <tspan id="ts7" >tspan 1 <tspan id="tts7" >tspan 2 </tspan>more span 1</tspan > finish text</text> <text id="t8" x="20" y="230">Text <tspan id="ts8" display="inline" >tspan 1 <tspan id="tts8" display="none" > tspan 2</tspan> more span 1</tspan > finish text</text> <text id="t9" x="20" y="250">Text <tspan id="ts9" display="none" >tspan 1 <tspan id="tts9" display="inline" > tspan 2</tspan> more span 1</tspan > finish text</text> <text id="t10" x="20" y="270">Text <tspan id="ts10" display="none" >tspan 1 <tspan id="tts10" display="none" > tspan 2</tspan> more span 1</tspan > finish text</text> <text id="t11" x="20" y="290" display="none" >Text <tspan id="ts11" display="inline" >tspan 1 <tspan id="tts11" display="none" > tspan 2</tspan> more span 1</tspan > finish text</text> </g> </g> <!-- ============================================================= --> <!-- Batik sample mark --> <!-- ============================================================= --> <use xlink:href="../../../batikLogo.svg#Batik_Tag_Box" /> </svg> 1.1 xml-batik/samples/tests/spec/text/textProperties2.svg Index: textProperties2.svg =================================================================== <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> <!-- Copyright 2001-2002 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- ========================================================================= --> <!-- Test description here --> <!-- --> <!-- @author [EMAIL PROTECTED] --> <!-- @version $Id: textProperties2.svg,v 1.1 2004/11/21 21:20:23 deweese Exp $ --> <!-- ========================================================================= --> <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?> <svg width="450" height="500" viewBox="0 0 450 500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" > <title>Text Properties</title> <!-- ============================================================= --> <!-- Test content --> <!-- ============================================================= --> <defs> <style type="text/css"><![CDATA[ .Caption { font-size: 8; font-family: dialog; font-weight: normal; font-style: normal; stroke: none; stroke-width: 0; fill: black } text > tspan { fill: blue; } text > tspan > tspan { fill: purple; }]]> </style> </defs> <g id="testContent"> <text class="title" x="50%" y="40" font-size="15" > Text display and visibility.</text> <text x="50%" y="74" text-anchor="middle" >Visibility on text & tspans</text> <text x="50%" y="200" text-anchor="middle" >Display on text & tspans</text> <g stroke="black" stroke-width="1"> <rect x="12.5" y="82" width="425" height="25" fill="#EEE"/> <rect x="12.5" y="107" width="425" height="25" fill="#CCC"/> <rect x="12.5" y="132" width="425" height="25" fill="#EEE"/> <rect x="12.5" y="157" width="425" height="25" fill="#CCC"/> <line x1="340" x2="340" y1="82" y2="182"/> <rect x="12.5" y="207" width="425" height="25" fill="#EEE"/> <rect x="12.5" y="232" width="425" height="25" fill="#CCC"/> <rect x="12.5" y="257" width="425" height="25" fill="#EEE"/> <rect x="12.5" y="282" width="425" height="25" fill="#CCC"/> <rect x="12.5" y="307" width="425" height="25" fill="#EEE"/> <line x1="340" x2="340" y1="207" y2="332"/> </g> <text class="Caption" x="360" y="97" >vis, vis, vis</text> <text class="Caption" x="360" y="122">vis, hid, vis</text> <text class="Caption" x="360" y="147">vis, hid, hid</text> <text class="Caption" x="360" y="172">hid, vis, hid</text> <text class="Caption" x="360" y="223">inline, inline, inline</text> <text class="Caption" x="360" y="248">inline, inline, none</text> <text class="Caption" x="360" y="273">inline, none, inline</text> <text class="Caption" x="360" y="298">inline, none, none</text> <text class="Caption" x="360" y="323">none, inline, none</text> <g transform="scale(1.25), translate(0, 10)"> <text x="20" y="70">Text <tspan>tspan 1 <tspan> tspan 2</tspan> more span 1</tspan> finish text</text> <text x="20" y="90">Text <tspan visibility="hidden">tspan 1 <tspan visibility="visible"> tspan 2</tspan> more span 1</tspan> finish text</text> <text x="20" y="110">Text <tspan visibility="hidden">tspan 1 <tspan visibility="hidden"> tspan 2</tspan> more span 1</tspan> finish text</text> <text x="20" y="130" visibility="hidden">Text <tspan visibility="visible">tspan 1 <tspan visibility="hidden"> tspan 2</tspan> more span 1</tspan> finish text</text> <text x="20" y="170">Text <tspan>tspan 1 <tspan>tspan 2 </tspan>more span 1</tspan> finish text</text> <text x="20" y="190">Text <tspan display="inline">tspan 1 <tspan display="none"> tspan 2</tspan> more span 1</tspan> finish text</text> <text x="20" y="210">Text <tspan display="none">tspan 1 <tspan display="inline"> tspan 2</tspan> more span 1</tspan> finish text</text> <text x="20" y="230">Text <tspan display="none">tspan 1 <tspan display="none"> tspan 2</tspan> more span 1</tspan> finish text</text> <text x="20" y="250" display="none">Text <tspan display="inline">tspan 1 <tspan display="none"> tspan 2</tspan> more span 1</tspan> finish text</text> </g> </g> <!-- ============================================================= --> <!-- Batik sample mark --> <!-- ============================================================= --> <use xlink:href="../../../batikLogo.svg#Batik_Tag_Box" /> </svg> 1.100 +32 -24 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.99 retrieving revision 1.100 diff -u -r1.99 -r1.100 --- SVGTextElementBridge.java 18 Nov 2004 01:46:53 -0000 1.99 +++ SVGTextElementBridge.java 21 Nov 2004 21:20:23 -0000 1.100 @@ -535,9 +535,11 @@ Element element, BridgeContext ctx) { // 'requiredFeatures', 'requiredExtensions' and 'systemLanguage' - if (!SVGUtilities.matchUserAgent(element, ctx.getUserAgent())) { + if ((!SVGUtilities.matchUserAgent(element, ctx.getUserAgent())) || + (!CSSUtilities.convertDisplay(element))) { return; } + AttributedCharacterIterator aci = as.getIterator(); // calculate which chars in the string belong to this element @@ -624,21 +626,22 @@ // first try to find CSS properties that change the layout for (int i=0; i < properties.length; ++i) { switch(properties[i]) { - case SVGCSSEngine.TEXT_ANCHOR_INDEX: - case SVGCSSEngine.FONT_SIZE_INDEX: - case SVGCSSEngine.FONT_WEIGHT_INDEX: - case SVGCSSEngine.FONT_STYLE_INDEX: - case SVGCSSEngine.FONT_STRETCH_INDEX: - case SVGCSSEngine.FONT_FAMILY_INDEX: case SVGCSSEngine.BASELINE_SHIFT_INDEX: - case SVGCSSEngine.UNICODE_BIDI_INDEX: case SVGCSSEngine.DIRECTION_INDEX: - case SVGCSSEngine.WRITING_MODE_INDEX: - case SVGCSSEngine.GLYPH_ORIENTATION_VERTICAL_INDEX: + case SVGCSSEngine.DISPLAY_INDEX: + case SVGCSSEngine.FONT_FAMILY_INDEX: + case SVGCSSEngine.FONT_SIZE_INDEX: + case SVGCSSEngine.FONT_STRETCH_INDEX: + case SVGCSSEngine.FONT_STYLE_INDEX: + case SVGCSSEngine.FONT_WEIGHT_INDEX: case SVGCSSEngine.GLYPH_ORIENTATION_HORIZONTAL_INDEX: + case SVGCSSEngine.GLYPH_ORIENTATION_VERTICAL_INDEX: + case SVGCSSEngine.KERNING_INDEX: case SVGCSSEngine.LETTER_SPACING_INDEX: + case SVGCSSEngine.TEXT_ANCHOR_INDEX: + case SVGCSSEngine.UNICODE_BIDI_INDEX: case SVGCSSEngine.WORD_SPACING_INDEX: - case SVGCSSEngine.KERNING_INDEX: { + case SVGCSSEngine.WRITING_MODE_INDEX: { if (!hasNewACI) { hasNewACI = true; computeLaidoutText(ctx, e, node); @@ -790,7 +793,8 @@ Integer bidiLevel, AttributedStringBuffer asb) { // 'requiredFeatures', 'requiredExtensions' and 'systemLanguage' - if (!SVGUtilities.matchUserAgent(element, ctx.getUserAgent())) { + if ((!SVGUtilities.matchUserAgent(element, ctx.getUserAgent())) || + (!CSSUtilities.convertDisplay(element))) { return; } @@ -811,7 +815,7 @@ for (Node n = element.getFirstChild(); n != null; n = n.getNextSibling()) { - + last = n.getNextSibling() == null; int lastChar = asb.getLastChar(); @@ -820,11 +824,11 @@ switch (n.getNodeType()) { case Node.ELEMENT_NODE: - if (!SVG_NAMESPACE_URI.equals(n.getNamespaceURI())) { + if (!SVG_NAMESPACE_URI.equals(n.getNamespaceURI())) break; - } nodeElement = (Element)n; + String ln = n.getLocalName(); if (ln.equals(SVG_TSPAN_TAG) || @@ -1137,7 +1141,8 @@ BridgeContext ctx) { // 'requiredFeatures', 'requiredExtensions' and 'systemLanguage' - if (!SVGUtilities.matchUserAgent(element, ctx.getUserAgent())) { + if ((!SVGUtilities.matchUserAgent(element, ctx.getUserAgent())) || + (!CSSUtilities.convertDisplay(element))) { return; } AttributedCharacterIterator aci = as.getIterator(); @@ -1257,16 +1262,17 @@ if (child.getNodeType() != Node.ELEMENT_NODE) { continue; } - if (!SVG_NAMESPACE_URI.equals(child.getNamespaceURI())) { + if (!SVG_NAMESPACE_URI.equals(child.getNamespaceURI())) continue; - } + String ln = child.getLocalName(); if (ln.equals(SVG_TSPAN_TAG) || ln.equals(SVG_ALT_GLYPH_TAG) || ln.equals(SVG_A_TAG) || ln.equals(SVG_TEXT_PATH_TAG) || ln.equals(SVG_TREF_TAG)) { - addGlyphPositionAttributes(as, (Element)child, ctx); + Element childElement = (Element)child; + addGlyphPositionAttributes(as, childElement, ctx); } } } @@ -1280,7 +1286,8 @@ TextPaintInfo pi, BridgeContext ctx) { // 'requiredFeatures', 'requiredExtensions' and 'systemLanguage' - if (!SVGUtilities.matchUserAgent(element, ctx.getUserAgent())) { + if ((!SVGUtilities.matchUserAgent(element, ctx.getUserAgent())) || + (!CSSUtilities.convertDisplay(element))) { return; } Object o = elemTPI.get(element); @@ -1301,16 +1308,16 @@ if (child.getNodeType() != Node.ELEMENT_NODE) { continue; } - if (!SVG_NAMESPACE_URI.equals(child.getNamespaceURI())) { + if (!SVG_NAMESPACE_URI.equals(child.getNamespaceURI())) continue; - } + + Element childElement = (Element)child; String ln = child.getLocalName(); if (ln.equals(SVG_TSPAN_TAG) || ln.equals(SVG_ALT_GLYPH_TAG) || ln.equals(SVG_A_TAG) || ln.equals(SVG_TEXT_PATH_TAG) || ln.equals(SVG_TREF_TAG)) { - Element childElement = (Element)child; TextPaintInfo pi = getTextPaintInfo(childElement, node, parentPI, ctx); addPaintAttributes(as, childElement, node, pi, ctx); @@ -1708,6 +1715,7 @@ else pi.composite = AlphaComposite.SrcOver; + pi.visible = CSSUtilities.convertVisibility(element); pi.fillPaint = PaintServer.convertFillPaint (element, node, ctx); pi.strokePaint = PaintServer.convertStrokePaint(element, node, ctx); pi.strokeStroke = PaintServer.convertStroke (element); 1.29 +2 -4 xml-batik/sources/org/apache/batik/gvt/ShapeNode.java Index: ShapeNode.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/ShapeNode.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- ShapeNode.java 23 Oct 2004 17:11:03 -0000 1.28 +++ ShapeNode.java 21 Nov 2004 21:20:23 -0000 1.29 @@ -138,10 +138,8 @@ * @param g2d the Graphics2D to use */ public void paint(Graphics2D g2d) { - if (isVisible) { + if (isVisible) super.paint(g2d); - } - } /** 1.33 +1 -12 xml-batik/sources/org/apache/batik/gvt/TextNode.java Index: TextNode.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/TextNode.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- TextNode.java 18 Aug 2004 07:14:27 -0000 1.32 +++ TextNode.java 21 Nov 2004 21:20:23 -0000 1.33 @@ -378,17 +378,6 @@ // /** - * Paints this node. - * - * @param g2d the Graphics2D to use - */ - public void paint(Graphics2D g2d) { - if (isVisible) { - super.paint(g2d); - } - } - - /** * Paints this node without applying Filter, Mask, Composite, and clip. * * @param g2d the Graphics2D to use 1.33 +6 -2 xml-batik/sources/org/apache/batik/gvt/font/AWTGVTGlyphVector.java Index: AWTGVTGlyphVector.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/font/AWTGVTGlyphVector.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- AWTGVTGlyphVector.java 6 Sep 2004 00:01:58 -0000 1.32 +++ AWTGVTGlyphVector.java 21 Nov 2004 21:20:23 -0000 1.33 @@ -174,7 +174,9 @@ if (tpi == null) return null; - + if (!tpi.visible) + return null; + cacheTPI = new TextPaintInfo(tpi); Shape outline = null; if (tpi.fillPaint != null) { @@ -818,6 +820,8 @@ TextPaintInfo tpi = (TextPaintInfo)aci.getAttribute (GVTAttributedCharacterIterator.TextAttribute.PAINT_INFO); if (tpi == null) return; + if (!tpi.visible) return; + Paint fillPaint = tpi.fillPaint; Stroke stroke = tpi.strokeStroke; Paint strokePaint = tpi.strokePaint; 1.21 +14 -8 xml-batik/sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java Index: SVGGVTGlyphVector.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- SVGGVTGlyphVector.java 6 Sep 2004 00:01:58 -0000 1.20 +++ SVGGVTGlyphVector.java 21 Nov 2004 21:20:23 -0000 1.21 @@ -486,14 +486,16 @@ return bounds2D; Rectangle2D b=null; - for (int i = 0; i < getNumGlyphs(); i++) { - if (!glyphVisible[i]) continue; + if (tpi.visible) { + for (int i = 0; i < getNumGlyphs(); i++) { + if (!glyphVisible[i]) continue; - Rectangle2D glyphBounds = glyphs[i].getBounds2D(); - // System.out.println("GB["+i+"]: " + glyphBounds); - if (glyphBounds == null) continue; - if (b == null) b=glyphBounds; - else b = glyphBounds.createUnion(b); + Rectangle2D glyphBounds = glyphs[i].getBounds2D(); + // System.out.println("GB["+i+"]: " + glyphBounds); + if (glyphBounds == null) continue; + if (b == null) b=glyphBounds; + else b = glyphBounds.createUnion(b); + } } bounds2D = b; @@ -709,6 +711,10 @@ */ public void draw(Graphics2D graphics2D, AttributedCharacterIterator aci) { + aci.first(); + TextPaintInfo tpi = (TextPaintInfo)aci.getAttribute(PAINT_INFO); + if (!tpi.visible) return; + for (int i = 0; i < glyphs.length; i++) { if (glyphVisible[i]) { glyphs[i].draw(graphics2D); 1.3 +10 -2 xml-batik/sources/org/apache/batik/gvt/text/TextPaintInfo.java Index: TextPaintInfo.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/text/TextPaintInfo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TextPaintInfo.java 18 Aug 2004 07:14:42 -0000 1.2 +++ TextPaintInfo.java 21 Nov 2004 21:20:23 -0000 1.3 @@ -31,6 +31,7 @@ * @version $Id$ */ public class TextPaintInfo { + public boolean visible; public Paint fillPaint; public Paint strokePaint; public Stroke strokeStroke; @@ -47,7 +48,7 @@ public Paint strikethroughPaint; public Paint strikethroughStrokePaint; public Stroke strikethroughStroke; - + public TextPaintInfo() { } public TextPaintInfo(TextPaintInfo pi) { @@ -72,6 +73,8 @@ this.strikethroughPaint = null; this.strikethroughStrokePaint = null; this.strikethroughStroke = null; + + this.visible = false; } else { this.fillPaint = pi.fillPaint; this.strokePaint = pi.strokePaint; @@ -89,6 +92,8 @@ this.strikethroughPaint = pi.strikethroughPaint; this.strikethroughStrokePaint = pi.strikethroughStrokePaint; this.strikethroughStroke = pi.strikethroughStroke; + + this.visible = pi.visible; } } @@ -100,12 +105,15 @@ if ((tpi1.fillPaint == null) != (tpi2.fillPaint == null)) return false; + + if (tpi1.visible != tpi2.visible) return false; boolean tpi1Stroke = ((tpi1.strokePaint != null) && (tpi1.strokeStroke != null)); boolean tpi2Stroke = ((tpi2.strokePaint != null) && (tpi2.strokeStroke != null)); + return (tpi1Stroke == tpi2Stroke); } 1.1 xml-batik/test-references/samples/tests/spec/scripting/textProperties2.png <<Binary file>> 1.1 xml-batik/test-references/samples/tests/spec/text/textProperties2.png <<Binary file>> 1.120 +3 -1 xml-batik/test-resources/org/apache/batik/test/samplesRendering.xml Index: samplesRendering.xml =================================================================== RCS file: /home/cvs/xml-batik/test-resources/org/apache/batik/test/samplesRendering.xml,v retrieving revision 1.119 retrieving revision 1.120 diff -u -r1.119 -r1.120 --- samplesRendering.xml 18 Nov 2004 01:47:06 -0000 1.119 +++ samplesRendering.xml 21 Nov 2004 21:20:23 -0000 1.120 @@ -336,6 +336,7 @@ <test id="samples/tests/spec/text/textOnPathSpaces.svg" /> <test id="samples/tests/spec/text/textPCDATA.svg" /> <test id="samples/tests/spec/text/textProperties.svg" /> + <test id="samples/tests/spec/text/textProperties2.svg" /> <test id="samples/tests/spec/text/textStyles.svg" /> <test id="samples/tests/spec/text/verticalText.svg" /> <test id="samples/tests/spec/text/verticalTextOnPath.svg" /> @@ -417,5 +418,6 @@ <test id="samples/tests/spec/scripting/setProperty.svg" /> <test id="samples/tests/spec/scripting/styling.svg" /> <test id="samples/tests/spec/scripting/text_content.svg" /> + <test id="samples/tests/spec/scripting/textProperties2.svg" /> </testGroup> </testSuite>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]