Inkscape font4OpenSCAD extension
by sawdusty, published
I really like the Write extension for OpenSCAD thingiverse.com/thing:16193, but as soon as I used it I wanted different fonts.
I work with Inkscape a lot and I like the text fonts it has built in. This Inkscape extension is a python script to begin the process of creating a font face (a DXF file) for OpenSCAD and the Write extension. Some manual work is necessary in Inkscape to finish the process, but it's worth it.
Recent Commentsview all
Thank you for all of your work! Your directions were very good, and I was able to write using the font file I chose from Inkscape. A few notes: on the Mac, the dialog boxes do not seem to close on there own. Also, for some reason, TestWrite would not render my font, but I was able to use the font with Write without any issues. Thanks again!
Thanks works fine. Only the curves where not reduce to lines. So i did this by hand. For a Stencil Gothic Font.
Liked Byview all
Give a Shout Out
2. Copy the two files, font4OpenSCAD.inx and font4OpenSCAD.py to the extensions folder of Inkscape. For Windows users this is (probably) found at c:/Program Files/Inkscape/share/extensions. If you're running Linux, see the Inkscape website for help in finding this folder, it varies with the version you installed.
3. Open Inkscape with a new document.
4. Go to the Text menu, select Text and Font... and decide which font you want to work with. Remember the name, exactly as shown in the Font Family list.
5. Close the Text and Font dialog.
6. Go to the Exensions menu, select Text > Font4OpenSCAD.
7. In the dialog box, type in the name of the font you want to use.
8. Click the Apply button.
Once the "Font4OpenSCAD is working" message disappears, you have to finish the process manually. I hope to find a way to do this in the script later, but only time will tell whether I succeed.
To finish and create the DXF output:
1. Press Ctrl + Alt + A to select all elements on all layers of the file.
2. Go to the Path menu and select Stroke To Path. This will take a few seconds to finish. You will know it is done when the Path menu returns to its normal appearance instead of being highlighted.
3. Go back to the Extensions menu and select Modify Path > Flatten Beziers...
4. Enter a value of 0.2 in the Flatness field. You can try making this smaller, but the OpenSCAD rendering time will increase greatly.
5. Click the Apply button. Again, Inkscape will take a few seconds to process all of the elements.
6. Close the Flatten Beziers dialog.
7. Go to the File menu and click Save As... and choose DXF as the file type.
8. Enter your fonts name, with .dxf at the end (Inkscape will not add this for you).
9. Click the Save button.
10. In the "Desktop Cutting Plotter" dialog, enable the "Use LWPOLYLINE" option, but disable the "use ROBO-Master" option.
11. Click OK.
12. I recommend saving the SVG file of the font too. In case one or more characters do not appear, you can fix them in the SVG file and re-export, but Inkscape will not read the DXF file back in. (Note the missing "M" in the font image shown. It has an internal path that has to be "reversed". It works nicely after that. BTW, the font in the image is "Pristina".)
Use the resulting DXF file in OpenSCAD with the Write extension as you would one of the default fonts. The file TestWriteFont.scad is a slightly modified SCAD file from the excellent Write.scad thing by HarlanDMii thingiverse.com/HarlanDMii that lets you set the font name in a variable and then test all of the charcters in the font.
1. The DXF output files should not be posted as "things" unless you KNOW the original font is open source, or public domain. Most computer fonts are not, but I believe the ones with Inkscape are. Please proceed carefully and knowledgeably.
2. The output of this extension will not create "solid" letters like those in the default fonts packaged with the Write extension. The output is mostly "hollow" characters. You can edit the individual letters to make them "solid". It is not difficult, and can be done pretty quickly in the XML editor in Inkscape if you're familiar with that program. You need to break the characters into separate paths first, then it's pretty easy, but time consuming. Again, this is something I hope to automate, or maybe someone else will beat me to it. (I will try to add steps for this manual process later.)
3. Font size and positioning will vary with the font you choose.
4. While I have printed a couple of items with characters produced with fonts created as described, I cannot test this exhaustively. Please don't ask me about problems, I probably will not be able to help.
5. Last, this is the first Inkscape extension I have created and the first program I have ever written in Python. While it was not difficult, it is by no means an example of great code.
You must be logged in to post a comment.