Inkscape.org
Beyond the Basics Batch Convert Text to Stroke Font with Hershey Text Extension
  1. #1
    Maggi G Maggi G @madgg

    I have a couple hundred SVGs that contain text that I'd like to batch convert to stroke font to be plotted using a plotter. Is there anyway to do this in inkscape?

  2. #2
    inklinea inklinea @inklinea⛰️

    OS ?

  3. #3
    Maggi G Maggi G @madgg

    Mac OS Big Sur 11.4

    I've figured out that I can run the hershey.py file from command line by passing certain inputs. I'm still trying to figure out exactly what the inputs should be. Then I guess I should be able to write some sort of script to loop through the svgs I have. Any help would be much appreciated!

  4. #4
    inklinea inklinea @inklinea⛰️

    If can write a script, this line 

    inkscape --batch-process --actions="select-all:all;org.evilmad.text.hershey.noprefs;export-filename:hers.svg;export-do;" input_svg

    Should execute the hershey extension using the last settings you set in Inkscape after exiting Inkscape.

  5. #5
    Maggi G Maggi G @madgg

    Where is the file "hers.svg" saved when you run that command?

     

  6. #6
    Maggi G Maggi G @madgg

    I get the following warnings. It doesn't look like it finishes.

    ** (org.inkscape.Inkscape:1612): WARNING **: 15:33:51.978: Invalid value ('') for appearance of parameter 'setupType' in extension 'command.evilmadscientist.wcb.plot_rev_57'

    ** (org.inkscape.Inkscape:1612): WARNING **: 15:33:51.979: Attempting to translate an empty string in extension 'command.evilmadscientist.wcb.plot_rev_57', which is not supported.

    ** (org.inkscape.Inkscape:1612): WARNING **: 15:33:51.979: Invalid value ('') for appearance of parameter 'resumeType' in extension 'command.evilmadscientist.wcb.plot_rev_57'

     

    I was trying to run the following command:

    python3 /Applications/.../hershey.py --output=doc1.svg --tab=Render --fontface=HersheySans1 --preserve=false doc2.svg

    It keeps saying that it can't find the svg_fonts folder so I move the folder to the location it's using and run the command again. It completes, but no document is created.

  7. #7
    inklinea inklinea @inklinea⛰️

    It should be in the same folder as the input file I think . 

    I'm using Ubuntu 20.10. I don't have access to a mac, you do have to have used the extension at least once in Inkscape, applied and exited cleanly. Inkscape then saves those last settings for the extension in preferences.xml ( same for windows ) 

     

  8. #8
    inklinea inklinea @inklinea⛰️

    I might be an idea to ask in https://chat.inkscape.org/channel/inkscape_extensions

    If you scroll up a bit to 11pm last night GMT, a developer did post a short example of importing hershey.py into a python script.

  9. #9
    inklinea inklinea @inklinea⛰️

    I might be an idea to ask in https://chat.inkscape.org/channel/inkscape_extensions

    If you scroll up a bit to 11pm last night GMT, a developer did post a short example of importing hershey.py into a python script.

  10. #10
    Maggi G Maggi G @madgg

    Hmm that link doesn't seem to be working for me but I'll dig around a bit! Thank you so much for helping me. I'm still not getting anywhere just yet, but I know I'm very close.

  11. #11
    Maggi G Maggi G @madgg

    I was able to use joneuhauser's recommendation to run hershey.py from a separate python file. It completes with no errors, but an svg file is not created. I tried to login to the chat feature, but it wouldn't let me. Also tried sending an password reset to my email and that didn't work either, so that's why I'm back here asking you questions! If I can login to the chat feature I can ask joneuhauser directly!

  12. #12
    Maggi G Maggi G @madgg

    I was able to use joneuhauser's recommendation to run hershey.py from a separate python file. It completes with no errors, but an svg file is not created. I tried to login to the chat feature, but it wouldn't let me. Also tried sending an password reset to my email and that didn't work either, so that's why I'm back here asking you questions! If I can login to the chat feature I can ask joneuhauser directly!

Inkscape Inkscape.org Inkscape Forum Beyond the Basics Batch Convert Text to Stroke Font with Hershey Text Extension