txt2dat - Create LDraw files from text

This is a utility I wrote basically to be able to produce virtual stickers for
my LDraw models. It allows you to choose any scalable typeface, and create a
LDraw file containing a representation of any string in that typeface.

This is currently beta software. Use it at your own risk. Please send any
comments/suggestions/bugs to This email address is being protected from spambots. You need JavaScript enabled to view it..


Copyright 2005
R. Crawford


Copyright 1993, 1995, 1997, 1998, 2002, 2004
Jonathan Richard Shewchuk
2360 Woolsey #H
Berkeley, California 94705-1927
This email address is being protected from spambots. You need JavaScript enabled to view it.

The FreeType Project

Copyright (C) 1996-2000
David Turner, Robert Wilhelm, and Werner Lemberg.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

By default, txt2dat produces a box oriented as per the LDraw Official Library
Standard for Sticker Parts. Many attributes of the final LDraw object can be
adjusted, using the options below.

The LDraw commands are output to stdout, and all other output is to stderr, so
the LDraw file can be captured by re-directing stdout to a file.

Usage: txt2dat.exe [options] [fontfile]

-a Add an ASCII character to the output.
Characters are added in the order they appear on the command line.
-b Specify standard LDraw background colour or - for transparent.
Default background colour is 15 (white).
-c Specify standard LDraw font colour or - for transparent.
Default font colour is 0 (black).
-h Specify height of bounding box (in LDU).
Default height is least multiple of 8 LDU (one plate)
greater than total height of characters.
The font baseline will be on the x axis
-l Don't draw edge lines on glyphs or bounding box.
-p Specify point size for text.
Default point size is 12.
-r Spline Resolution. Must be 0 or greater.
0 = Best guess (default)
1 = Maximum
>1 = Reduces resolution.
-s Add a string of characters to the output.
Characters are added in the order they appear on the command line.
-w Specify width of bounding box (in LDU).
Default width is least multiple of 20 LDU (one stud)
greater than total width of characters.
The text will be centred in the bounding box, and about the z axis
-x Don't create bounding box.

fontfile is the full path to an existing scalable font file. If omitted, the
internal default font will be used.


txt2dat -s Hello -c 4 -p 72 c:\windows\fonts\arial.ttf >hello.dat

Produces the file "hello.dat" containing the string "Hello" in red 72 point Arial
on a white background.


  1. You can use colours not defined by the LDraw spec, by choosing a user-defined
    colour number, and defining it as you wish in your LDraw file.
  2. Bold and italic fonts are usually in different font files, so you have to
    choose the appropriate file - txt2dat can't automatically do bold & italic.
    For example: The Arial family consists of: arial.ttf, arialbd.ttf, ariali.ttf
    and arialbi.ttf
  3. Selecting transparent font or background colour is different to choosing LDraw
    colour 47 (trans-white). The former does not fill the area with triangles, the
    latter fills with colour 47 triangles.
  4. The bounding box has no back face! But it's easy to add one manually if you
    need one. I could make it an option if enough people want it.
  5. Spline resolution: The best resolution for each spline depends on the point
    size. Bigger point sizes result in more segments. More segments results in
    longer processing time, and much higher memory use. The default option
    generally produces good results, except for very small point sizes. I don't
    recommend using high spline resolutions (low -r values) with point sizes
    greater than about 64, but feel free to experiment ;)
  6. The internal default font supplied is generated from the LDraw 1x1 bricks with
    letters, by Tore Eriksson. It only contains glyphs for space, digits 0-9, and
    upper case A-Z, although lower case a-z are mapped to their upper case versions.
    I chose this font because it is fairly small, and I didn't want to increase the
    size of the executable too much. It can only be changed by rebuilding from
    source - instructions are in build.txt, included with the source distribution.


The current version is 0.2.3

Note: This is not currently maintained, and the executable files may cause damage to your computer. Use at your own risk!

MacOS Darwin: Download

Linux: Download

Windows: Download

Source: Download