Script to grab outline and create svg files?
![](https://secure.gravatar.com/avatar/058a78be61b78e4cc8b71f60c2c42d93.jpg?s=120&d=mm&r=g)
I am new to inkscape and would like to know if it is possible to automate the following process to create svg files (I have manually succeeded in it), and if so, what does the script look like and how should it be executed?
In the manual process, I perform the following steps to create the svg file.
1) Open inkscape 2) Open File->Document Properties and set size to 1000 x 1000 3) Type t 4) Drag a rectangle (this step and previous step are needed to activate the Append button used in Step 7) 5) Click on Text -> Glyphs 6) Choose Font family, script and range (this is not English, which is why I need this step) 7) Click characters and click append for each character clicked (more than one character is involved, and I click on the character since I use an English keyboard but the language I am interested is not English) 8) Ctrl-Shift-C to grab the outline of the text 9) Save as svg by clicking File->Save As
I need to automate this process to create a number of svg files, some of which are formed due to the outline of multiple characters.
Thanks, -Ferdinand
![](https://secure.gravatar.com/avatar/058a78be61b78e4cc8b71f60c2c42d93.jpg?s=120&d=mm&r=g)
This is related to the previous post I made.
Is there a way to convert from the command line, a string to an svg file containing the outline of the glyphs that represent the string?
-Ferdinand
![](https://secure.gravatar.com/avatar/79cea575940e8249cf136135004f07e1.jpg?s=120&d=mm&r=g)
You might be able to do it via a python script On Feb 9, 2012 1:06 PM, "Ferdinand Ramirez" <ramirez.ferdinand@...12...> wrote:
This is related to the previous post I made.
Is there a way to convert from the command line, a string to an svg file containing the outline of the glyphs that represent the string?
-Ferdinand
Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
![](https://secure.gravatar.com/avatar/807b437a3bf56b085471b234c69bf927.jpg?s=120&d=mm&r=g)
Hi Ferdinand,
On Thu, 2012-02-09 at 10:05 -0800, Ferdinand Ramirez wrote:
This is related to the previous post I made.
Is there a way to convert from the command line, a string to an svg file containing the outline of the glyphs that represent the string?
This should be possible but as Matt mentioned, it might take use of a python script.
The general recipe I'd approach it with:
- Create an SVG with some sample text in it, using the font / font size / canvas size you're interested in - Give the sample text a recongizable ID... e.g., "mytext" - Save the sample SVG - Write a python script using one of the available XML libraries in python to open up the SVG, look up item with ID "mytext", and replace the string in that item with whatever string you want in there - Write out the SVG - Rinse and repeat until you have a series of SVGs that have the strings in them that you want - Run command-line inkscape with the -T or --export-text-to-path option on all of the SVGs to get the glyph outlines
This is just what I would think to do. It might not be the best possible way but it should work. I've done similar python scripts before, using the XML DOM to look up a specific element and replacing the string (we use this process to translate graphical banners in Fedora.) I've not relied on the -T / --export-text-to-path option on the command line before but have no reason to suspect it wouldn't work the way you're looking for it to.
Good luck, ~m
![](https://secure.gravatar.com/avatar/058a78be61b78e4cc8b71f60c2c42d93.jpg?s=120&d=mm&r=g)
Thanks! If the last step works, this is exactly what I need.
The --export-text-to-path option did not work, and on googling, I see that there was a request to make it work with svg as well. https://bugs.launchpad.net/inkscape/+bug/903772
The last comment on that page is dated Jan 30 and I guess I need to upgrade to version 0.49 to make it work with svg output.
-Ferdinand
--- On Thu, 2/9/12, Máirín Duffy <duffy@...2818...> wrote:
From: Máirín Duffy <duffy@...2818...> Subject: Re: [Inkscape-user] Text to svg command? To: "Inkscape User Community" inkscape-user@lists.sourceforge.net Date: Thursday, February 9, 2012, 12:49 PM Hi Ferdinand,
On Thu, 2012-02-09 at 10:05 -0800, Ferdinand Ramirez wrote:
This is related to the previous post I made.
Is there a way to convert from the command line, a
string to an svg file containing the outline of the glyphs that represent the string?
This should be possible but as Matt mentioned, it might take use of a python script.
The general recipe I'd approach it with:
- Create an SVG with some sample text in it, using the font
/ font size / canvas size you're interested in
- Give the sample text a recongizable ID... e.g., "mytext"
- Save the sample SVG
- Write a python script using one of the available XML
libraries in python to open up the SVG, look up item with ID "mytext", and replace the string in that item with whatever string you want in there
- Write out the SVG
- Rinse and repeat until you have a series of SVGs that have
the strings in them that you want
- Run command-line inkscape with the -T or
--export-text-to-path option on all of the SVGs to get the glyph outlines
This is just what I would think to do. It might not be the best possible way but it should work. I've done similar python scripts before, using the XML DOM to look up a specific element and replacing the string (we use this process to translate graphical banners in Fedora.) I've not relied on the -T / --export-text-to-path option on the command line before but have no reason to suspect it wouldn't work the way you're looking for it to.
Good luck, ~m
Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
participants (3)
-
Ferdinand Ramirez
-
Matt Hines
-
Máirín Duffy