Overview

The RTF Printer Driver is the driver associated with the LP device in the default configuration.
This driver isn't a real driver since it does not deal with a printer but rather passes a Rich Text Formatted file to WORDPAD.EXE and WORDPAD.EXE prints the file. The sequence is as follows:
 OPEN(X)"LP"  A temp file called temprtf.rtf is created (unless LTF <> "" see LISTFILE below). Wordpad's current margins are saved. An RTF header is placed in the file.
 PRINT(X)DATA$,  The string DATA$ is placed in the temp file.
 PRINT(X)'XX',  The XX Mnemonic is processed and the required RTF commands and placed in the temp file.
 CLOSE(X)  An RTF trailer is added to the file. The temp file is closed. Wordpad's margins are set based on the 'MARGINS' mnemonic. Wordpad is then executed with a command simalar to:
WORDPAD.EXE /P temprtf.rtf
If 'PT'(P$) [the PRINT TO mnemonic] had been used instead Wordpad is then executed with a command simalar to:
WORDPAD.EXE /PT temprtf.rtf + P$
SM32 waits for WORDPAD.EXE to close.
The temp file is deleted
Paragraph - 'LF': The RTF driver uses $0A$ and 'LF' as an end of paragraph RTF command which causes a line feed as the programmer would expect. However if you end your PRINT's with a comma WORDPAD will fit your printed data within the page margins.

Special Conditions/Mnemonics

FIN function

The fin function returns 2 $00$ terminated strings. The 1st string is the RTF header. This string is usefull in that it contains all the valid font facenames (see $__GETFONTS). The 2nd string is the full path of WORDPAD.EXE. If this contains WRITE.EXE instead of the WORDPAD.EXE path SM32 was unabled to find the correct path. This path can be overridden by placing a pathname in the Driver Info: line of the device configuration. The 2 strings can be broken out as follows:

OPEN(1)"LP";A$=FIN(1);PRINT(1)'ABORT',;CLOSE(1)
P=POS($00$=A$);W$=A$(P+1);W$=W$(1,LEN(W$)-1);H$=A$(1,P-1)

LISTFILE - LTF

The LTF variable only applies the device named LP. For the RTF driver if the LTF system variable is <> "" then WORDPAD.EXE is not executed at CLOSE time. The printed information is simply stored in the file specified by LTF. Note that this file is emptied at OPEN time. Example:

LISTFILE "MYLISTING.RTF"
LOAD "MYPROG"
OPEN (1)"LP"
LIST(1)
STOP

'ABORT' - Abort Print

Use this mnemonic to prevent WORDPAD from being executed. This can be usefull while debugging. If a program goes to console mode, a:

PRINT(X)'ABORT',
STOP
will prevent the print that would normally occur with the STOP (closing channel X). Also see $__GETFONTS program that just wants to do a FIN and not print anything.

'PT' - Print To

In stead of printing the temp file to the default printer at close time another printer is selected.

LOAD "MYPROG"
OPEN (1)"LP"
PRINT(1)'PT'("HP DESKJET 920C"),
LIST(1)
STOP

'PV' - PreView

In stead of printing the temp file at close time, the temp file is simply OPENED in WORDPAD. A command similar to:
WORDPAD.EXE temprtf.rtf
is executed. Note that SM32 will hang until the user closes WORDPAD and the temp file is then deleted. This option gives the user a chance to use any of WORDPAD features. (one would be to change the paper to Landscape an option not available from SM32) Example:

LOAD "MYPROG"
OPEN (1)"LP"
PRINT(1)'PV',
LIST(1)
STOP

Regular Mnemonics

@(col) - Space Right

Single @ position is not always accurate with this driver as it may not always know the current position. It uses a space character to move the to right and does NOT attempt to move left.

'BG' and 'EG' - Begin/End Error 29

Once the 'EG' is output no ERROR 29's will be generated for invalid MNEMONICS. The 'BG' restores the generation of ERROR 29's

'AQUA' - Aqua

Next Character is printed in aqua.

'BLACK' - Black

Next Character is printed in black.

'BLUE' - Blue

Next Character is printed in blue.

'BO' and 'EO' - Begin/End Output Transparency

RTF commands use:
\,{ and }
as special characters. If they occur in the printing data they are escaped to:
\\,\{ and \}
So if the programmer wants to pass in some RTF commands he must set output transparency. The following example uses the RTF Superscript command:

10 BEGIN 
20 OPEN (1)"LP"
30 PRINT (1)'PV','fs'(18),
40 PRINT (1)"W=X",;CALL SUPER,"2"
50 PRINT (1)" + Y",;CALL SUPER,"3"
60 STOP 
70 SUPER: ENTER A$
80 PRINT (1)'BO',"\up14 "+A$+"\up0 ",'EO',
90 EXIT 

'BU' and 'EU' - Begin/End Character Underline
'US' and 'UT' - Underline Start/Terminate

Turns ON/OFF underlining.

'CENTER' - Center

Centers the current paragraph.

'CP' - Compressed Print

Set the font size to 8
NOTE:
Same as 'FS'(8)

'EP' - Expanded Print

Set the font size to 16
NOTE:
Same as 'FS'(16)

'FS' - Font Size

Sets the font size:
'FS'(P) - where P is the font size in Points.

Example: PRINT (7)'FS'(24),

'FUSHIA' - Fushia

Next Character is printed in fushia.

'GRAY' - Gray

Next Character is printed in gray.

'GREEN' - Green

Next Character is printed in Green.

'IS' and 'IT' - Italics Start/Terminate

Start or End Italics printing.

'LEFF' - Left Align

Left aligns the current paragraph.

'LF' - Line Feed

Ends a paragraph.

'LIME' - Lime

Next Character is printed in lime.

'MARGINS' - Set Page Margins

Set the WORDPAD page margins. The nmemonic requires 4 numeric arguments:
Left,Right,Top and Bottom margin
Example:

OPEN (1)"LP"
PRINT(1)'PV',
PRINT(1)'MARGINS'(.5,.5,.5,.5),
PRINT(1)"Testing Set Margins"
STOP

'MAROON' - Maroon

Next Character is printed in maroon.

'NAVY' - Navy

Next Character is printed in navy.

'OLIVE' - Olive

Next Character is printed in olive.

'PURPLE' - Purple

Next Character is printed in purple.

'RED' - Red

Next Character is printed in Red.

'Right' - Right Align

Right aligns the current paragraph.

'SB' and 'SF' - Set Low/High Intensity
'BB' and 'EB' - Begin/End Bold

'BB' or 'SF' cause following characters to print in bold.
'EB' or 'SB' cause following characters to print in normal.

'SILVER' - Silver

Next Character is printed in silver.

'SP' - Standard Print

Set the font size to 10
NOTE:
Same as 'FS'(10)

'TEAL' - Teal

Next Character is printed in teal.

'YELLOW' - Yellow

Next Character is printed in yellow.