Forum: Inkscape Script to grab outline and create svg files?

47c264b790b5ff7b3b466be8ad242596?d=identicon&s=25 Ferdinand Ramirez (Guest)
on 2012-02-08 22:11
(Received via mailing list)
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
47c264b790b5ff7b3b466be8ad242596?d=identicon&s=25 Ferdinand Ramirez (Guest)
on 2012-02-09 19:06
(Received via mailing list)
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
8b55c84e6a36fc1ab7a1d2b9c6563ff8?d=identicon&s=25 Matt Hines (Guest)
on 2012-02-09 19:13
(Received via mailing list)
You might be able to do it via a python script
On Feb 9, 2012 1:06 PM, "Ferdinand Ramirez"
<ramirez.ferdinand@yahoo.com>
Aca6f054b2112b41afb84dca542ce143?d=identicon&s=25 "Máirín Duffy" <duffy@fedoraproject.org> (Guest)
on 2012-02-09 22:15
(Received via mailing list)
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
47c264b790b5ff7b3b466be8ad242596?d=identicon&s=25 Ferdinand Ramirez (Guest)
on 2012-02-10 04:19
(Received via mailing list)
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
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.