Hi there! I think I created a possible patch (see the appended file). The problem is that the SVGTextElementBridge doesn't catch Attr change events of it's children. With the appended patch it works but I'm not sure if it's the right way to do this. Perhaps some expert could check it?
By the way: I really like what you've created. The batik library is fantastic:) Best regards, Sebastian On Fr, Feb 20, 2009 at 02:15:00 +0100, you wrote: > Hello! > > I'm using batik1.7 on linux with sun java 1.6.0.12 and encountered the > following problem: > > As a simple testcase I'll use the SVG > http://www.w3.org/TR/SVG/images/text/toap01.svg > and add an id to the textPath in line 17: > <textPath id="test" xlink:href="#MyPath"> > > This file should be displayed in a JSVGCanvas and the textPath tag > should be dynamically changed from Java the following way: > > ------------------------------------------ > > svgCanvas.getUpdateManager().getUpdateRunnableQueue(). > invokeLater(new Runnable() > { > public void run() > { > SVGSVGElement svg = svgCanvas.getSVGDocument().getRootElement(); > SVGTextPathElement elm = (SVGTextPathElement)svg.getElementById("test"); > elm.setAttributeNS(null, "startOffset", "50%"); > } > }); > > ------------------------------------------ > > The problem is that the JSVGCanvas doesn't update the display. If I > replace "startOffset" with for example "font-size" it works perfectly. > If the whole document is rerendered (i.e. calling "setSVGDocument" > again) the result is also correct. Therefore I think there must be > something wrong with the handling of DOM changes to the "startOffset" > attribute. > > Moreover this bug seems to be similar to bug #45723 (startOffset > attribute of textPath cannot be animated). > > To make it easier for you to reproduce the bug I've appended the SVG and > a small application based on an example from the batik homepage. In this > application you can load the SVG and then press the Start! button to > execute the code above. > > Does it work for you? > > Kind regards, > Sebastian > --------------------------------------------------------------------- > To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org > For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org
Index: sources/org/apache/batik/bridge/SVGTextElementBridge.java =================================================================== --- sources/org/apache/batik/bridge/SVGTextElementBridge.java (Revision 746227) +++ sources/org/apache/batik/bridge/SVGTextElementBridge.java (Arbeitskopie) @@ -550,6 +550,15 @@ } } + public void handleDOMAttrModifiedEvent(MutationEvent evt) { + Node childNode = (Node)evt.getTarget(); + //if the parent is displayed, then discard the layout. + if (isParentDisplayed(childNode)) { + laidoutText = null; + computeLaidoutText(ctx, e, getTextNode()); + } + } + /** * Invoked when an MutationEvent of type 'DOMNodeRemoved' is fired. */ @@ -2157,7 +2166,7 @@ * Invoked when an MutationEvent of type 'DOMAttrModified' is fired. */ public void handleDOMAttrModifiedEvent(MutationEvent evt) { - //nothing to do + textBridge.handleDOMAttrModifiedEvent(evt); } /**
--------------------------------------------------------------------- To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org