开发者

How to use SVG DOM in Python

开发者 https://www.devze.com 2023-03-18 00:56 出处:网络
This question may sounds dumb, but I can\'t manage to find a correct answer on my own. I am trying to use the SVG DOM interface in my python script. I would like to use getComputedTextLength but I can

This question may sounds dumb, but I can't manage to find a correct answer on my own. I am trying to use the SVG DOM interface in my python script. I would like to use getComputedTextLength but I can't find how even if I firstly thought it would be available thanks to modules or a packages like python-svg or something like that. I am sure there is something I miss, but I can't find what.

Any help would be appreciated. Thank you.

开发者_开发技巧EDIT: I forgot to talk about what my script actually does. It's a Python script used to generate a SVG file from data grabbed on the Internet. My script needs to write texts and repeat them all along a path. Also, as I know the exact length (in pixels) of the path I need to know the length of the text in order to repeat it only what I need to. That's why a method like getComputedTextLength would be helpful.


Try this: http://www.gnu.org/software/pythonwebkit/


I don't think this is possible. DOM is one thing and calling browser's function is other thing. I only saw Python module which help you to create tree structures like HTML or SVG but they don't provide any other additional functionality. (Btw., last time I look even browsers had problems correctly computing getComputedTextLength but that was some time ago...)

You could try better luck with fonttools.

0

精彩评论

暂无评论...
验证码 换一张
取 消