SVG自动换行-显示挡块? [英] SVG Word Wrap - Show stopper?

查看:126
本文介绍了SVG自动换行-显示挡块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了好玩,我试图看看我在业余时间为RIA实现SVG浏览器客户端能走多远.

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 be a HUGE stumbling block. There is no word wrap!!

有人知道周围有什么解决方法吗(我在想某种我不知道的JavaScript或特殊标签)?

Does anyone know of any work around (I'm thinking some kind of JavaScript or special tag I don't know)?

如果不是这样,我要么不得不走xhtml路线,开始将HTML元素粘贴到我的SVG(ouch)中,要么只是在十年后SVG 1.2准备就绪时又回来.

If not I'm either going to have to go the xhtml route and start sticking HTML elements in my SVG (ouch), or just come back again in ten years when SVG 1.2 is ready.

推荐答案

文档出现 tspan 可以给出自动换行的错觉:

Per this document, it appears that tspan can give the illusion of word wrap:

tspan标记与text标记相同,但可以嵌套在text标记内和自身内.结合'dy'属性,可以在SVG 1.1中产生自动换行的错觉.请注意,"dy"相对于绘制的最后一个字形(字符).

The tspan tag is identical to the text tag but can be nested inside text tags and inside itself. Coupled with the 'dy' attribute this allows the illusion of word wrap in SVG 1.1. Note that 'dy' is relative to the last glyph (character) drawn.

这篇关于SVG自动换行-显示挡块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆