Loading

OpenSCAD Font Importer

by pipakin, published

OpenSCAD Font Importer by pipakin Jun 8, 2011

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.

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.

UPDATE: Removed the arial font (forgot about licensing), and substituted FreeSerif

Recent Comments

view all

You could just try using fonts that were made for stencils:

http://www.urbanfonts.com/font...

Oh right, duh. yes, this would also be nice.

Liked By

view all
wulfCard1024x768

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)

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!");

Comments

You must be logged in to post a comment.

Synchron on Jun 9, 2011 said:

awesome!

Only an idea:

To print Objekt with more than one piece like "i" there could be a little "connector" or something...the same for "negative" letters. (middle of "O" )

(sorry for bad english)

polymaker on Oct 25, 2011 said:

You could just try using fonts that were made for stencils:

http://www.urbanfonts.com/font...

pipakin on Jun 9, 2011 said:

Could be a nice addition. Why would O need connectors?

donb on Jun 9, 2011 said:

awesome!

pipakin on Jun 9, 2011 said:

It isn't quite arbitrary strings, but we're getting there. :) Now we just need some features that don't exist in openSCAD.

freakinhuge on Jun 8, 2011 said:

SWEET! :-D

Top