TDF

page

TheDraw fonts

Native TDF commands load the TheDraw (.TDF) fonts seeded in A:/fonts/tdf/ (categories mono/, color/ and deco/) and draw banner text using the normal text console. No include file is needed:

TDF LOAD "A:/fonts/tdf/mono/STANDARD.TDF"
TDF PRINT 0, 3, "HELLO"
TDF CLOSE

TDF PRINT x, y, s$ draws at character cell x (column, 0-based) and y (row, 0-based) and leaves the cursor after the last glyph. Glyphs are ASCII 33 to 126; a space advances by the font’s letter spacing.

TDF PRINT honours PAGE WRITE: with a graphics mode and a write target other than the page on screen it stamps each glyph cell into that page’s buffer, so PAGE DISPLAY or PAGE COPY shows it and an offscreen write leaves the visible frame untouched. With no explicit page, or when the write target is the displayed page, it draws to the normal text console as before. TDF PRINT is a character-cell command, so its page output stays top-down even under OPTION Y_AXIS UP.

Commands

TDF LOAD path$ [, variant%] [, slot%] load a font (variant 0 by default) TDF NAMED path$, name$ [, slot%] load a font by name TDF USE slot% make a loaded slot active TDF PRINT x, y, s$ [, slot%] draw a string at a character cell TDF CLOSE [slot%] free a slot (default: active font)

Functions

TDF.WIDTH(s$ [, slot%]) columns TDF PRINT would advance TDF.NAME$([slot%]) font name TDF.TYPE%([slot%]) 0 Outline, 1 Block, 2 Color TDF.SPACING%([slot%]) letter spacing TDF.HEIGHT([slot%]) maximum glyph height TDF.VARIANTS%([slot%]) variations in the file TDF.VARIANT%([slot%]) index of the loaded variation TDF.VARIANTNAME$(n% [, slot%]) name of variation n%

Slots

Up to four fonts can be loaded at once. The slot% argument is a 0-based index into that pool; an omitted slot uses the active font, and LOAD/NAMED without a slot default to slot 0. A reload replaces the font already in its slot (slot 0 is freed and reused), so repeated loads never run out of slots. An explicit slot outside 0-3 errors. The first load becomes active.

TDF LOAD "A:/fonts/tdf/mono/STANDARD.TDF", 0, 0
TDF LOAD "A:/fonts/tdf/color/BLOCK.TDF", 0, 1
TDF USE 0 : TDF PRINT 0, 3, "HELLO"
TDF USE 1 : TDF PRINT 0, 10, "WORLD"
PRINT TDF.NAME$(0); " / "; TDF.NAME$(1)
TDF CLOSE 0
TDF CLOSE 1

Variations

A .TDF can pack several variations of one font (same glyphs, different colour palettes). TDF.VARIANTS% counts them and TDF.VARIANTNAME$(n%) names one; pass the variant index to TDF LOAD to choose one, and read TDF.VARIANT% afterwards. For example:

TDF LOAD "A:/fonts/tdf/color/ACIDSC2X.TDF", 2
PRINT TDF.VARIANTNAME$(2); " ("; TDF.VARIANT%; ")"

Font types

Block glyphs hold CP437 characters. Color glyphs store a (character, attribute) pair per cell; the attribute nibbles select the background and foreground, and an attribute of 00 is a legal colour, so only a NUL character ends the glyph. Outline glyphs store letters A-O plus @ and & that are remapped to CP437 box-drawing cells (the Roy/SAC mapping); @ is a leading-space filler and & marks a descender line.

A missing file, a bad header, or an unknown font name stops the program with a TDF error. Font rows are read to the NUL terminator, so descender lines are kept even when the Max Height header under-counts them.

See also: FILES

Source: docs/help/tdf.txt inmmcore. On the computer, typeHELP TDF.