This is an old revision of the document!
TheDraw Fonts (TDF)
TheDraw fonts or tdf for short, are packages of graphical fonts created for use with TheDraw, an ANSI art program for MSDOS.
Synchronet can natively use these font packages in menus and other files without the need for an external program.
The .tdf files may contain single or multiple fonts. They can be accessed by zero-based index number. If a font with a given index doesn't exist then the first font found will be used. Up to 34 fonts can exist in a single .tdf file but, in reality, that's not usually the case.
Examples
Please keep in mind the interface may to the library may change since this is a new feature.
// Load the tdf library
var tdf = load({}, "tdfonts_lib.js");
// Set various options (explained below)
tdf.opt = {
justify: tdf.LEFT_JUSTIFY,
width: tdf.DEFAULT_WIDTH,
ansi: false, // Default: Synchronet Ctrl-A attribute codes
utf8: false, // Default: CP437 character set/encoding
random: false,
info: false,
index: 3
};
// Choose the font file
// These are installed in ctrl/tdfonts
var fontfile = "voidx.tdf";
// You can read the font-encoded output into a variable to
// be manipulated or displayed later.
var output = tdf.output("TEST", fontfile);
writeln(output);
Options
You can pass several options to tdfonts using the opt object.
| Property | Description | Default |
|---|---|---|
| justify | Determine the position of the text on the screen. You can use LEFT_JUTIFY RIGHT_JUSTIFY or CENTER_JUSTIFY | LEFT_JUSTIFY |
| width | Define the screen width | 80 |
| ansi | Determines if output should use ANSI terminal escape sequences | false (use Synchronet Ctrl-A attribute sequences) |
| utf8 | Whether output encoding should use UTF-8 | false (use CP437 character set/encoding) |
| info | Print information about the font such as its name and available characters | false |
| random | Use a random font. A fontname need to be specified when using random | false |
| index | 0 based index of the font within the font file | 0 |