Friday, 6 September 2013

How to convert to then create union using command line?

How to convert to then create union using command line?

I'm currently using Inkscape "CLI" mode to do that but it's terribly slow.
Code (slow)
You'll notice that I open/quit Inkscape (FileQuit) at each iteration which
may cause huge slow down as it reload fonts and others resources.
for f in "$HPF_SVGTEXT_DIR"/*.svg;
do
nf="$HPF_SVGFONT_DIR/${f##*/}"
cp "$f" "$nf" ;
printf "creating SVG-font: %s\n" "$nf"
inkscape -f "$nf" \
--select=canvas --select=hanzi \
--verb=AlignHorizontalLeft \
--verb=EditDeselect \
--select=canvas --select=pinyin \
--verb=AlignHorizontalRight \
--verb=EditDeselect \
--select=canvas --verb=EditDelete \
--select=hanzi --select=pinyin \
--verb=AlignVerticalCenter \
--verb=SelectionUnion \
--verb=FileSave --verb=FileQuit
done
I also provide input/output files if you wish to test.
Benchmarking
Conversion took ~3-4s per file which is problematic as I need to repeat
the operation on over 20k files. So approximatively 23 hours.
Question
What tool can I use to speed things up to:
convert <svg:text> elements to <svg:path> ;
then create a union of s using command line.

No comments:

Post a Comment