Synchronet v3.21e-Win32 (install) has been released (Mar-2026).

You can donate to the Synchronet project using PayPal.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
custom:thedrawfonts [2025/04/23 17:26] – created - needs work but it's a start. nelgincustom: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 single and multiple fonts. They can be accessed by index number. If a font with a given index doesn't exist then the first font found will be used. Upto 34 fonts can exist in a single .tdf file but, in reality, that's not usually the case.+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 ===== +===== 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 "figlets"), e.g. executable using [[util::JSexec]] or the ''exec'' sysop command.
  
 <code> <code>
-'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/offset (for left or right justification).
 +    -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.
 +</code>
 +
 +===== 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.
 +
 +<code>
 // Load the tdf library // Load the tdf library
 var tdf = load({}, "tdfonts_lib.js"); var tdf = load({}, "tdfonts_lib.js");
  
 // 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,
-    colortdf.COLOR_ANSI, // Default to ANSI +    ansifalse, // Default: Synchronet Ctrl-A attribute codes 
-    encodingtdf.ENC_ANSI, // Default to ANSI+    utf8false, // Default: CP437 character set/encoding
     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/tdfonts // These are installed in ctrl/tdfonts
-fontfile = "voidx.tdf"; +var fontfile = "voidx.tdf";
- +
-// 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 = tdf.output("TEST", font); +// You can read the font-encoded output into a variable to 
-writeln(fontstr);+// be manipulated or displayed later. 
 +var output = tdf.output("TEST", fontfile); 
 +writeln(output);
  
-// Or you can just write out your text 
-// directly. 
-// tdf.output(mystr, font); 
 </code> </code>
  
-===== 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 RIGHT_JUSTIFY or CENTER_JUSTIFY | LEFT_JUSTIFY | +^ Property ^ Description                                                                                               ^ Default ^ 
-| width | Define the screen width | 80 | +| justify | Determine the position of the text on the screen. You can use LEFT_JUSTIFY RIGHT_JUSTIFY or CENTER_JUSTIFY | ''LEFT_JUSTIFY''
-color | Determines if output should be ANSI color characters or mIRC escape codes. Options are COLOR_ANSI or COLOR_MIRC COLOR_ANSI +| margin  | Offset (in columns) from edge of terminal. For use with LEFT or RIGHT justification.                       | ''0'' 
-encoding | Whether output encoding should be ANSI or Unicode. Options are ENC_ANSI or ENC_UNICDE ENC_ANSI +| width   Specify the screen width. For use with CENTER or RIGHT justification.                                      //auto-detect// or ''80'' 
-| info | Print information about the font such as its name and available characters | none +ansi| Determines if output should use ANSI terminal escape sequences ''false'' (use Synchronet Ctrl-A attribute sequences) 
-| random | Use a random font. A fontname need to be specified when using random. | none +utf8 | Whether output encoding should use UTF-8 ''false'' (use CP437 character set/encoding) 
-| 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 | ''false'' 
 +| random | Use a random font. A fontname need not be specified when using the random option. | ''false'' 
 +| index | 0 based index of the font within the font file | //random// or ''0'' |
  
 +===== See Also =====
 +  * [[:custom:|Customization]]
 +  * [[:util:ans2asc|ANS2ASC Utility]]
 +  * [[:util:asc2ans|ASC2ANS Utility]]
 +  * [[:Resource:ANSI Editors]]
  
 +{{tag>ansi}}