Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| custom:thedrawfonts [2025/04/23 17:26] – created - needs work but it's a start. nelgin | custom:thedrawfonts [2026/02/19 09:18] (current) – [Example] fix small typo nelgin | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| Synchronet can natively use these font packages in menus and other files without the need for an external program. | Synchronet can natively use these font packages in menus and other files without the need for an external program. | ||
| - | The .tdf files may contain | + | The .tdf files may contain single |
| - | ===== Examples | + | ===== tdfiglet.js |
| - | Please keep in mind the interface may to the library may change since this is a new feature. | + | There is a utility script included with Synchronet for using TheDraw Font files to generate ornamental text output (so-called " |
| < | < | ||
| - | 'use strict'; | + | usage: tdfiglet [options] input |
| + | -f [font] Specify font file used. | ||
| + | -j l|r|c Justify left, right, or center. Default is left. | ||
| + | -w n Set screen width. Default is auto-detect or 80. | ||
| + | -m n Set margin/ | ||
| + | -a Color sequences: ANSI. Default is Synchronet Ctrl-A. | ||
| + | -u Encode charaters as UTF-8. Default is CP437. | ||
| + | -x n Index to font within file. Default is 0. | ||
| + | -i Print font details. | ||
| + | -r Use random font. | ||
| + | -h Print usage. | ||
| + | </ | ||
| + | |||
| + | ===== tdfonts_lib.js ===== | ||
| + | There is a JavaScript library included with Synchronet for using TheDraw Font files. | ||
| + | |||
| + | ==== Example ==== | ||
| + | Please keep in mind the interface to the library may change since this is a new feature. | ||
| + | |||
| + | < | ||
| // Load the tdf library | // Load the tdf library | ||
| var tdf = load({}, " | var tdf = load({}, " | ||
| // Set various options (explained below) | // Set various options (explained below) | ||
| - | opt = { | + | tdf.opt = { |
| justify: tdf.LEFT_JUSTIFY, | justify: tdf.LEFT_JUSTIFY, | ||
| width: tdf.DEFAULT_WIDTH, | width: tdf.DEFAULT_WIDTH, | ||
| - | | + | |
| - | | + | |
| random: false, | random: false, | ||
| info: false, | info: false, | ||
| Line 28: | Line 47: | ||
| // Choose the font file | // Choose the font file | ||
| // These are installed in ctrl/ | // These are installed in ctrl/ | ||
| - | fontfile = " | + | var fontfile = " |
| - | + | ||
| - | // Load in the font from the fontfile | + | |
| - | var font = tdf.loadfont(fontfile); | + | |
| - | + | ||
| - | // You can read the output into a variable to | + | |
| - | // be manipulated later. You can pass a static | + | |
| - | // string or a variable, of course. | + | |
| - | var fontstr | + | // You can read the font-encoded output into a variable to |
| - | writeln(fontstr); | + | // be manipulated or displayed later. |
| + | var output | ||
| + | writeln(output); | ||
| - | // Or you can just write out your text | ||
| - | // directly. | ||
| - | // tdf.output(mystr, | ||
| </ | </ | ||
| - | ===== Options | + | ==== Options ==== |
| You can pass several options to tdfonts using the opt object. | You can pass several options to tdfonts using the opt object. | ||
| - | | justify | Determine the position of the text on the screen. You can use LEFT_JUTIFY | + | ^ Property ^ Description |
| - | | width | Define | + | | justify | Determine the position of the text on the screen. You can use LEFT_JUSTIFY |
| - | | color | Determines if output should | + | | margin |
| - | | encoding | + | | width |
| - | | info | Print information about the font such as its name and available characters | none | | + | | ansi| Determines if output should |
| - | | random | Use a random font. A fontname need to be specified when using random. | none | | + | | utf8 | Whether output encoding should |
| - | | index | 0 based index of the font within the font file. | 0 | | + | | info | Print information about the font such as its name and available characters | '' |
| + | | random | Use a random font. A fontname need not be specified when using the random | ||
| + | | index | 0 based index of the font within the font file | //random// or '' | ||
| + | ===== See Also ===== | ||
| + | * [[: | ||
| + | * [[: | ||
| + | * [[: | ||
| + | * [[: | ||
| + | {{tag> | ||