printing underlined text

Peter Holzer hp at vmars.tuwien.ac.at
Wed Nov 21 03:32:03 AEST 1990


pjh at mccc.uucp (Pete Holsberg) writes:

>In article <1990Nov12.183213.8920 at ssd.kodak.com> weimer at ssd.kodak.com (Gary Weimer) writes:
>=Another improvement:
>=
>=printf( "_^HU_^Hn_^Hd_^He_^Hr_^Hl_^Hi_^Hn_^He_^Hd _^Ht_^He_^Hx_^Ht\n" );
>=
>=Although this is much less readable, most "smart" terminals, as well as
>=printers will know how to handle this (see nroff output).

>Only "smart" printers can handle "real-time" backspacing.  Our dot
>matrix printers won't so we like the "print the underline, return the
>carriage, print the text" approach.  I don't think that lasers are smart
>enough, either.

Huh? What does the printf above print on your printer?
It works on any matrix printer I have seen and in the worst case it
should print ``Underlinedtext'' non-underlined as many terminals do.
Many Matrix-Printers will slow down very much on such output because
they have to
start, print underscore, stop,
start backwards, stop,
start, print character, stop
for each character. Underline\rText is certainly faster on such 
printers.

I certainly see no reason why it should not work on a laser printer.
Laser printers are usually quite ``smart''.

Note however that there are two backspace characters in the ASCII.
BS (0x08, ^H) just moves the cursor to the left, while DEL (0x7F, ^?)
deletes the previous character from the print queue (if it exists).

The REAL SOLUTION(TM) however is to have a database of means how to 
get underlining, bold, etc from all your printers, terminals etc.
(If you have a UNIX-system, use termcap or termlib) and use this.
--
|    _  | Peter J. Holzer                       | Think of it   |
| |_|_) | Technical University Vienna           | as evolution  |
| | |   | Dept. for Real-Time Systems           | in action!    |
| __/   | hp at vmars.tuwien.ac.at                 |     Tony Rand |



More information about the Comp.lang.c mailing list