Raphael.js将文本转换为路径 [英] Raphael.js convert text to path

查看:137
本文介绍了Raphael.js将文本转换为路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Raphael.js设置了绘图实用程序.用户可以绘制形状,路径并输入文本.一旦用户向svg添加了文本-> Paper.text(),该svg就会进入可选状态.意思是,如果我添加文本并切换到钢笔工具,则在svg周围移动钢笔会导致相邻的dom元素进入其:: selection状态.

I've setup a drawing utility with Raphael.js. The user can draw shapes, paths and enter text. Once a user adds text -> Paper.text() to the svg the svg goes into a selectable state. Meaning, if I add text and switch to the pen tool, moving the pen around the svg will cause adjacent dom elements to go into their ::selection state.

因此,我想将文本转换为路径以防止这种情况发生.我在文档中看不到任何类似的东西.

So I'd like to convert the text to a path to prevent this from happening. I don't see anything like this in the documentation.

推荐答案

如果使用print()而不是text()进行文本打印,则文本将是拉斐尔路径对象. (print()使用可渲染为拉斐尔路径的cufon javascript字体).

if you use print() instead of text() for text printing, then the text will be a raphael path object. (print() use a cufon javascript font that renders to a raphael path).

这篇关于Raphael.js将文本转换为路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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