OpenSCAD Font Importer 1.1
by pipakin, published
0
Share
5462
1148
Report Thing as Inappropriate
Description
I needed to layout full strings for a project so I extended donb's wonderful DraFont library. This version will dump all ascii characters from a font by default, and provide a method for laying out strings.
New in version 1.1: String spacing settings!
For the brave, there is a git repo at github.com/pipakin/OpenSCAD-Font-Importer (This is not for the faint of heart, my python skills are substandard at best)
NOTE: Complicated glyphs can take a long time to render, and I've managed to crash OpenSCAD a LOT by using long strings. For example, "FONTZ!" takes 1 minute 30 seconds to render, while "This is a test string." takes significantly longer (on the order of 13 minutes). So if you are going to use this for something, I recommend generating your string, rendering it, and then outputting an STL to use in your design with import_stl.
New in version 1.1: String spacing settings!
For the brave, there is a git repo at github.com/pipakin/OpenSCAD-Font-Importer (This is not for the faint of heart, my python skills are substandard at best)
NOTE: Complicated glyphs can take a long time to render, and I've managed to crash OpenSCAD a LOT by using long strings. For example, "FONTZ!" takes 1 minute 30 seconds to render, while "This is a test string." takes significantly longer (on the order of 13 minutes). So if you are going to use this for something, I recommend generating your string, rendering it, and then outputting an STL to use in your design with import_stl.
Recent Comments
view all
5462
1148
Report Thing as Inappropriate
Remixed From
Tags
License
OpenSCAD Font Importer 1.1 by pipakin is licensed under the Creative Commons - Attribution - Share Alike license.
Give a Shout Out
If you print this Thing and display it in public proudly give attribution by printing and displaying this tag.
Print Thing Tag
Instructions
Prerequisites:
- Python
- Freetype (2.4.4)
- Freetype-py
USAGE: python full_ddump -f [font file] -o [output file] -m [module name]
Optional Parameters:
--strings [name of strings file] (default none)
--size [size of characters] (default 12)
--height [z height of characters] (default 10)
--startcode [hex unicode value to start at] (default 021)
--endcode [hex unicode value to end at] (default 07E)
--spacing [size in mm of spacing between letters] (default 0)
--space [character to base the size of spaces after] (default 'x')
--spacewidth [specific size of the space character in mm] (default none)
Your scad file must include the produced scad. The produced scad references the font_base.scad file, so you'll need it too.
example: include <FreeSerif.scad>
To render a letter, you call the module with that letter (or ordinal)
Example: FreeSerif("S"); or FreeSerif("0x41"); or FreeSerif(65);
To use string layouts, you have to provide a string file. This file is a list of strings (separated by newlines). To use a string, it must match this file exactly. Then you can call the module with those strings.
Example: FreeSerif("FONTZ!");
- Python
- Freetype (2.4.4)
- Freetype-py
USAGE: python full_ddump -f [font file] -o [output file] -m [module name]
Optional Parameters:
--strings [name of strings file] (default none)
--size [size of characters] (default 12)
--height [z height of characters] (default 10)
--startcode [hex unicode value to start at] (default 021)
--endcode [hex unicode value to end at] (default 07E)
--spacing [size in mm of spacing between letters] (default 0)
--space [character to base the size of spaces after] (default 'x')
--spacewidth [specific size of the space character in mm] (default none)
Your scad file must include the produced scad. The produced scad references the font_base.scad file, so you'll need it too.
example: include <FreeSerif.scad>
To render a letter, you call the module with that letter (or ordinal)
Example: FreeSerif("S"); or FreeSerif("0x41"); or FreeSerif(65);
To use string layouts, you have to provide a string file. This file is a list of strings (separated by newlines). To use a string, it must match this file exactly. Then you can call the module with those strings.
Example: FreeSerif("FONTZ!");
OpenSCAD Font Importer 1.1 by pipakin is licensed under the Creative Commons - Attribution - Share Alike license.
Download All Files
(7 kb zip file)
Comments
You must be logged in to post a comment.
pipakin
on
Jun 23, 2011
said:
I came up with a method that dumps every letter to an stl file, which allows you to render files using the font scad instantly (0 second render times), but takes A LONG TIME to create the initial font scad/stls. Do you guys think it's worth uploading?
essentially, you just call the python script with the same arguments, but add --stlmode. if you want to regenerate the string layout stuff and use stls you already created you can just use the same parameters with --stlmode --nostl
It did take 10 hours to process FreeSerif, though...
ralphzoontjens
on
Jul 9, 2013
said:
That sounds exactly like what I need actually! It doesn't matter to me that it takes hours to preprocess. Have you already uploaded it?

is there any way to add a new font?