是否有用于将文本绘制为矢量轮廓的 PHP 库?
在 PHP 中,使用 GD 将文本绘制到光栅画布上非常容易 字体(根据服务器上保存的 TTF 文件),并将其输出为 PNG 或 JPEG。
我想做大致相同的事情,但将文本绘制为矢量轮廓并将其输出为SVG。
(我不想将字体本身嵌入到生成的 SVG 中,因为该字体未获得许可。)
是否有任何 PHP 库提供此类功能?
In PHP, it's quite easy to use GD to draw text onto a raster canvas in a certain font (according to a TTF file held on the server), and output it as a PNG or JPEG.
I want to do roughly the same thing, but to draw the text as a vector outline and output it as an SVG.
(I do not want to embed the font itself in the resulting SVG, as the font is not licensed for that.)
Is there any PHP library that provides this sort of functionality?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可以编写 inkscape 脚本来执行此操作。
以下命令打开“example.svg”并选择文件中的所有形状并将它们转换为路径,然后保存并关闭文件。
It's possible to script inkscape to do this.
The following command opens "example.svg" and selects all shapes in the file and converts them to paths, and then saves and closes the file.
我能够通过搜索找到 CleverSVG 槽,但是我自己没有尝试过,我不确定它是否能够在不转发字体的情况下绘制文本。
I was able to find CleverSVG trough searching, however I did not try this myself, and I am unsure if it will be able to draw text without forwarding the font.