开发者

Cant dynamically update text in svg using SVGWEB, Embedded SVG Fonts, and Flash Renderer

I am having a problem with the flash viewer and embedded SVG fonts. I am dynamically changing the content of a element using javascript. When I do this with the default system font, the text updates beautifully, however when I use an embedded SVG font and the flash viewer, changing the context of the element does not delete the previous contents, it just prints the new c开发者_Python百科ontents over the old.

This only happens with the flash renderer. If I use the native viewers on firefox or safari, the embedded fonts work perfectly.

Has anyone seen this before? Is there a better way to dynamically change the value of a text element besides doing this:

svgDoc.getElementById('text1').childNodes[0].nodeValue = customText


There are some other ways to set text content sure. If you are ok with the children of that node being overwritten, then textContent is quite handy for example:

svgDoc.getElementById('text1').textContent = customText (spec link)

If you need very fine-grained control you can look up the Text node properties.

I guess you can always try removing the child elements of your text element if that's what causes repainting issues in SVGWeb. Also you should create an SVGWeb issue so that the bug can get fixed in a future release.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜