Guardian Programmer's Guide

Table Of Contents
Communicating With Printers
Guardian Programmer’s Guide 421922-014
11 - 28
Printing Text
Print groups of adjacent characters on top of each other by inserting backspace
control codes.
Using SETMODE 6 to Overstrike Characters
You can use SETMODE function 6 to print a line on top of another line. SETMODE
function 6 controls the spacing after you write a line to the printer. By default, a line
feed and carriage return are performed after each line is printed. By calling SETMODE
function 6, you can suppress the line feed.
The method for overstriking lines using SETMODE function 6 is as follows:
1. Call SETMODE function 6 specifying suppression of the line feed after printing a
line. (Note that you do this before printing the line that you want to overstrike.)
2. Call the WRITE procedure to print the first line.
3. Call SETMODE function 6 to turn off suppression of the line feed.
4. Call the WRITE procedure to print the second line. The second line is printed on
top of the first.
The following example shows the use of SETMODE function 6 to overstrike a line of
text:
LITERAL SPACE^MODE = 6, NO^LF = 0, LF = 1;
.
.
!Suppress the line feed:
CALL SETMODE(PRINTER^NUM,SPACE^MODE,NO^LF);
IF <> THEN ...
SBUFFER ':=' "Denote blanks by b. " -> @S^PTR;
CALL WRITEX(PRINTER^NUM,SBUFFER,@S^PTR '-' @SBUFFER);
IF <> THEN ...
!Turn on automatic line feed:
CALL SETMODE(PRINTER^NUM,SPACE^MODE,LF);
IF <> THEN ...
!Print the second line:
SBUFFER ':=' " / " -> @S^PTR;
CALL WRITEX(PRINTER^NUM,SBUFFER,@S^PTR '-' @SBUFFER);
IF <> THEN ...
.
.
The “/” character in the second line overstrikes the “b” character of the first line.
Using Backspace Control Codes to Overstrike Characters
To overstrike a single character or small group of characters in a line, it might be easier
to insert the backspace control code into the output buffer. The backspace control
code has the ASCII value %10.