SVG Word Wrap - Show stopper?

前端 未结 8 967
既然无缘
既然无缘 2020-12-23 21:42

For fun I am trying to see how far I can get at implementing an SVG browser client for a RIA I\'m messing around with in my spare time.

But have hit what appears to

相关标签:
8条回答
  • 2020-12-23 22:37

    I've been looking for a solution about word wrapping in svg so many hours (or many days). If you can in your app, edit your code to put some tspan, or any other method, go in it.

    Text wrapping will be implement in the 1.2 version but except opera, no browser fully implement it yet (4 years, the specification are on the W3 ...).

    Because I had to use some alignment settings, i couldn't use any of the code that many forum can provide (no foreign object, no carto script or anything).

    If I post this message, it's just in order to be usefull to some other people when googling word wrapping svg because this post on the top result and in many case, this post doesn't help.

    Here is a cool, easy and light solution : http://dev.w3.org/SVG/profiles/1.1F2/test/svg/text-dom-01-f.svg

    0 讨论(0)
  • 2020-12-23 22:38

    There is also foreignObject tag. Then you can embed HTML in SVG which gives the greatest flexibility. HTML is great for document layout and has been hacked to no end to support application layout, drawing, and everything us developers want. But it's strength is word wrapping and document layout. Let HTML do what it does best, and let SVG do what it does best.

    http://www.w3.org/TR/SVG/extend.html

    This works for most browsers FireFox, Opera, Webkit, except IE (as of IE11). :-( Story of the web ain't it?

    http://schmerg.com/svg-support-in-ie9-close-but-should-try-harde

    0 讨论(0)
提交回复
热议问题