wzw9258 created BATIK-1117: ------------------------------ Summary: SVG Text标签不显示或显示乱码 Key: BATIK-1117 URL: https://issues.apache.org/jira/browse/BATIK-1117 Project: Batik Issue Type: Bug Reporter: wzw9258
We develop power monitoring software, the client uses Batik displays real-time data. SVG file using the "<Text>" display real-time values, refresh every 3 seconds. svg document reads as follows: <text pathName="Ia" flagId="copy_219" svgLavel="0" id="0f28cde7-e0f9-4e18-aa7b-5c78d0e76573" mtype="0" style="visibility:visible;fill:#00ff00;font-size:10pt;opacity:1.0;font-family:serif;stroke-width:1.0;" name="Ia" parentFlagId="use_20" transform="matrix( 1, 0, 0, 1, 354.85, -91.2)" isSaved="true" metaType="analog" planeLavel="1" elementType="text" x="293" y="297"> value</text> Real Update method is as follows: UpdateManager um = MmiSvgCanvas.this.getUpdateManager(); um.getUpdateRunnableQueue().invokeLater( new Runnable() { public void run() { element.getChildNodes().item(0).setNodeValue(value); } }); Text sometimes do not show up or show cases incomplete, the source debugging find unusual or garbled BidiAttributedCharacterIterator constructor. Exception as follows: stroking text painter>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>1233.18A computeTextRuns text node=========1233.18A BidiAttributedCharacterIterator------------------------------ stroking text painter>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>1233.18A strb========1233.18A computeTextRuns text node=========1233.18A BidiAttributedCharacterIterator------------------------------ start==========0 end===8 strb========1233.18A Run: 0->1 of 8 size==15 start==========0 end===8 Run: 1->1 of 8 size==15 Run: 0->1 of 8 size==15 Run: 1->8 of 8 size==13 java.lang.IllegalArgumentException: Can't add attribute to 0-length text at java.text.AttributedString.addAttributes(AttributedString.java:364) at org.apache.batik.gvt.text.BidiAttributedCharacterIterator.<init>(BidiAttributedCharacterIterator.java:119) at org.apache.batik.gvt.renderer.StrokingTextPainter.computeTextRuns(StrokingTextPainter.java:241) at org.apache.batik.gvt.renderer.StrokingTextPainter.getTextRuns(StrokingTextPainter.java:214) at org.apache.batik.gvt.renderer.StrokingTextPainter.getBounds2D(StrokingTextPainter.java:1126) at org.apache.batik.gvt.TextNode.getPrimitiveBounds(Unknown Source) at org.apache.batik.gvt.AbstractGraphicsNode.getBounds(Unknown Source) at org.apache.batik.gvt.UpdateTracker.changeStarted(Unknown Source) at org.apache.batik.gvt.AbstractGraphicsNode.fireGraphicsNodeChangeStarted(Unknown Source) at org.apache.batik.gvt.AbstractGraphicsNode.fireGraphicsNodeChangeStarted(Unknown Source) at org.apache.batik.gvt.TextNode.swapTextPaintInfo(Unknown Source) at org.apache.batik.bridge.SVGTextElementBridge.addPaintAttributes(Unknown Source) at org.apache.batik.bridge.SVGTextElementBridge.computeLaidoutText(Unknown Source) at org.apache.batik.bridge.SVGTextElementBridge.handleDOMSubtreeModifiedEvent(Unknown Source) at org.apache.batik.bridge.SVGTextElementBridge$DOMSubtreeModifiedEventListener.handleEvent(Unknown Source) at org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown Source) at org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown Source) at org.apache.batik.dom.events.EventSupport.dispatchEvent(Unknown Source) at org.apache.batik.dom.AbstractNode.dispatchEvent(Unknown Source) at org.apache.batik.dom.AbstractParentNode.fireDOMSubtreeModifiedEvent(Unknown Source) at org.apache.batik.dom.AbstractCharacterData.setNodeValue(Unknown Source) at com.kh.mmi.ui.svg.MmiSvgCanvas.updateElement(MmiSvgCanvas.java:997) at com.kh.mmi.ui.svg.MmiSvgCanvas.access$10(MmiSvgCanvas.java:976) at com.kh.mmi.ui.svg.MmiSvgCanvas$1.run(MmiSvgCanvas.java:1073) at org.apache.batik.util.RunnableQueue.run(Unknown Source) at java.lang.Thread.run(Thread.java:662) Distortion as follows: computeTextRuns text node=========162.00A BidiAttributedCharacterIterator------------------------------ strb========16????? computeTextRuns text node=========162.00A BidiAttributedCharacterIterator------------------------------ start==========0 end===7 strb========162.00A start==========0 end===7 Run: 0->1 of 7 size==15 Run: 0->1 of 7 size==15 Run: 1->7 of 7 size==13 Run: 1->7 of 7 size==13 What causes this phenomenon ask? -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: batik-dev-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: batik-dev-h...@xmlgraphics.apache.org