Raphael JS/SVG中的自动换行 [英] Word Wrap in Raphael JS / SVG

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

问题描述

在RaphaelJS中,如何获取将单词包装在框中的文字?还是一般基于浏览器的SVG?

How do you get words to wrap inside a box in RaphaelJS? Or in browser-based SVG in general?

我在其上找到了此线程,但是这没有任何意义.他们说使用"widthToCharNum",但据我所知,此线程是这些词在互联网上唯一使用过的地方.他们建议使用宽度"属性,但这无效.

I found this thread on it, but it doesn't make any sense. They say to use "widthToCharNum" but as far as I can tell, this thread is the only place those words have ever been used on the internet. They suggest using a "width" attribute, but this has no effect.

推荐答案

文本包装不是内置的 Raphael或SVG规范.时期.来自HTML世界,我发现缺少文本环绕功能令人震惊.

Text-wrapping is not built into Raphael or the SVG spec. Period. Coming from the HTML world, I found the absence of text wrapping pretty shocking.

但是,您可以自己完成此任务,而不会遇到太多困难.参见此问题以获取详细信息和示例.不幸的是,您必须消耗一些客户端周期才能使其动态工作.

However, you can do it yourself without too much difficulty. See this question for details and an example. Unfortunately, you have to burn some client-side cycles to make it work dynamically.

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

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