Loading
Hey! This thing is still a Work in Progress. Files, instructions, and other stuff might change!

Drafont 0.5

by donb, published

Drafont 0.5 by donb May 30, 2011

Description

Drafont is a font system for the OpenSCAD program to have Unicode characters from scalable TrueType fonts.

Example Usage:

To make the Hi! greeting at left, do as follows:

1. Download freeserif_basiclatin.scad and freeserif_cherokee.scad (see below for download links)
2. Type this into Openscad:

use <freeserif_basiclatin.scad>;
use <freeserif_cherokee.scad>;

d=12; // detail level - use 1 or 12
freeserif_H(d)
freeserif_i(d);

translate([-800,-1600,0])
freeserif_13a3(d)
freeserif_13cf(d)
freeserif_13f2(d);

Features

1. Each character is a module. Chain them together for auto-positioning
2. Each character can be referred to by unicode, or a 'shorthand' name
3. At the top of each .scad file is a list of the characters available
4. Two detail levels: 1 and 12
5. You can generate your own .scad font from a Truetype font, with any detail level you want. Download the .py files, edit settings at the end of ddump.py, and run it as follows:

python ddump.py FreeSerif.ttf 0x0041-0x007a > freeserif_basiclatin.scad
python ddump.py FreeSerif.ttf 0x13a0-0x13f4 > freeserif_cherokee.scad

Bugs

1. If you use the same char twice in a word, you have to use two _ (underscore)
2. Some complicated characters won't render properly
3. It is slow
4. CJK characters in FreeSerif not working
5. Some fonts don't work, at all (Sawasdee)

Licenses

Drafont python code & all .stl files are released under the Creative Commons Share-Alike Attribution license 3.0.

FreeSerif.ttf and the FreeSerif .scad files are under the GPL 3 license. See gnu.org/software/freefont/license.html

The Nixish .scad files are under the GUST public license:
gust.org.pl/projects/e-foundry/licenses

Name

This project is named in honor of Thomas Drake, NSA Whistleblower, whom you can read about by clicking here: bit.ly/mrm4q9

Sample .stl

"Anna Akhmatova" is an example of Cyrllic and Latin text in FreeSans.

1234567890 is the font Nixish, which is derived exactly from LMRomansUnsl10

See Also

freetype.org/freetype2/docs/glyphs/glyphs-6.html FreeType manual, David Turner et al
code.google.com/p/freetype-py/ Freetype-py by Nicolas Rougier
fileformat.info/info/unicode/block/index.htm Unicode Blocks
en.wikipedia.org/wiki/Anna_Akhmatova

Fonts:

bit.ly/m9oJWh LMRomanUnsl10 from Polish LaTeX user group GUST
gnu.org/software/freefont/index.html GNU FreeFont

Bezier:

en.wikipedia.org/wiki/File:Bezier_2_big.gif Bezier Curve, Phil Tregoning, Wikipedia
thingiverse.com/thing:8443 William Adam's pub domain Bezier Curves
thingiverse.com/thing:8931 Conic Bezier Curve, donb

Changelog

0.5 pre-rendering
0.4 enable 'ranges' of unicodes to be dumped. use 'advance' from font
0.3 move openscad code
0.2 fix chunking
0.1 started

Recent Comments

view all

I love the new stuff! I may have to re-base my project on this new version so I can get your new code goodness in there :)

OpenScad can pretty much do Bezier 'natively'. At least, you can use the various Bezier functions as if they were built in with no real problem. As long as the libraries are widely distributed.

oh now i get what you are saying. very interesting.

of course if OpenSCAD could do beziers natively, and import them from DXF, i guess this whole thing would be a little redundant.

Liked By

view all

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

0. download .stl file
1. print

Comments

You must be logged in to post a comment.

pipakin on Jun 24, 2011 said:

I love the new stuff! I may have to re-base my project on this new version so I can get your new code goodness in there :)

WilliamAAdams on May 31, 2011 said:

Now that you have your Bezier support, font support was innevitable. I think this is a great step forward. I think it pushes even further the notion that .scad files themselves may be a viable distribution format, rather than .stl files. .stl files are like bitmap renderings, whereas here, you have the actual font outlines rendered as .scad.

donb on Jun 2, 2011 said:

oh now i get what you are saying. very interesting.

of course if OpenSCAD could do beziers natively, and import them from DXF, i guess this whole thing would be a little redundant.

donb on May 31, 2011 said:

thanks.

Top