New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert all texts to path #129

Closed
quent57 opened this Issue Jul 15, 2012 · 3 comments

Comments

Projects
None yet
2 participants
@quent57
Contributor

quent57 commented Jul 15, 2012

With a big document, it's to slow to do this tricks manually :

http://sozi.baierouge.fr/wiki/en:tips#convert_texts_to_paths (Convert text to path).

I purpose that a programe do it for you.

for exemple :

./ink_text2path.py orig.svg copy.svg

@quent57

This comment has been minimized.

Show comment
Hide comment
@quent57

quent57 Jul 15, 2012

Contributor

I had wrote a start of program for it. I don't have the time to finish it, but it's a good start :

from lxml import etree
import xml.etree.ElementTree as xml
import cssutils.css as css
import cssutils
import logging

#need to copy orig.svg to dest.svg

cssutils.log.setLevel(logging.ERROR)

def text2path(textsbis):
command="inkscape "
for text in textsbis:
command=command+" --verb=EditDeselect --select="+text.get("id") + " --verb=ObjectToPath"
command+=" --verb=FileSave --verb=FileClose dest.svg"
print command

tree=etree.parse(open("soziv3.svg"))
root=tree.getroot()
expr = "//*[local-name() = $name]"
texts = root.xpath(expr,name="text")
text2path(texts)

#need to execute command instead of just printing it.

Contributor

quent57 commented Jul 15, 2012

I had wrote a start of program for it. I don't have the time to finish it, but it's a good start :

from lxml import etree
import xml.etree.ElementTree as xml
import cssutils.css as css
import cssutils
import logging

#need to copy orig.svg to dest.svg

cssutils.log.setLevel(logging.ERROR)

def text2path(textsbis):
command="inkscape "
for text in textsbis:
command=command+" --verb=EditDeselect --select="+text.get("id") + " --verb=ObjectToPath"
command+=" --verb=FileSave --verb=FileClose dest.svg"
print command

tree=etree.parse(open("soziv3.svg"))
root=tree.getroot()
expr = "//*[local-name() = $name]"
texts = root.xpath(expr,name="text")
text2path(texts)

#need to execute command instead of just printing it.

@senshu

This comment has been minimized.

Show comment
Hide comment
@senshu

senshu Nov 13, 2013

Owner

After one year, I have finally added a script following your proposal:
https://github.com/senshu/Sozi/blob/dev/tools/texts2paths/texts2paths.py

Thanks.

Owner

senshu commented Nov 13, 2013

After one year, I have finally added a script following your proposal:
https://github.com/senshu/Sozi/blob/dev/tools/texts2paths/texts2paths.py

Thanks.

@quent57

This comment has been minimized.

Show comment
Hide comment
@quent57

quent57 Nov 13, 2013

Contributor

Hey, it's cool that my ugly copy paste finally be added in the official git hub project !
Good continuation

Contributor

quent57 commented Nov 13, 2013

Hey, it's cool that my ugly copy paste finally be added in the official git hub project !
Good continuation

@senshu senshu closed this Apr 10, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment