UNIXpc nroff driver tables [REPOST]
Wolf Paul
wnp at killer.Dallas.TX.US
Mon Mar 20 19:31:41 AEST 1989
In article <130 at gnosys.UUCP> gst at gnosys.UUCP (Gary S. Trujillo) writes:
>While I discovered the following problem on my own peculiar printer,
>I think the problem to be of general concern, as it would seem to be
>a common situation for a printer to need to be sent characters outside
>the 7-bit ASCII range which represent the ordinary printable characters.
>
>I have been trying to follow the instructions in NTERM(5) of the 3.51
>Users' Manual (Volume 1) to construct a driver table to let me get at
>special characters on my NEC P2200 printer. The problem is that these
>characters commonly require output of a character whose magnitude is
>greater than those defined in the standard ASCII character set. In
>other words, the high (parity) bit is set. For example, I would like
>to be able to say something like:
>
> *a 1 \340
>
>to print the Greek character "alpha" in response to the nroff escape
>"\(*a". It would appear the problem is that nroff rejects non-ASCII
>characters. I tried fiddling with the "bset" flag in the driver table,
>thinking that perhaps the c_oflag field of the termio structure might
>have something to do with the problem, but I don't see any obvious bits
>to set to deal with the situation.
I believe that the best way to deal with this situation is to use
a post-processor. There is a set of tools to do this in Volume 15 of
Comp.Sources.Unix (v15i046 and v15i047, nroffgraphics), but the principle
is really rather simple.
Ideally, you find some control sequence which your printer does not use,
i.e. in the case of my printer (Epson FX-compat.) ESC '+', and use it
to construct your sequences for special characters. Thus, the Greek letters
would be defined thus,
*a 1 \033+a
*b 1 \033+b
etc.
Then, you write a simple program in C which reads its stdin, looking
for sequences beginning with "\033+", and outputting the appropriate
control codes (which are now no longer limited by nroff's notion of
what an ascii code looks like) to the printer. You can also let this
C program take care of some of the things col or other filters do,
like converting backspaces into line overstrikes with \r, etc. You can
even make it download custom character definitions, thus creating
some of the special *roff characters which most dot matrix printers
don't have.
Then, you would use this program in your lp interface script, so everything
gets filtered through it automatically.
If you would like to get the nroffgraphics package I mentioned above,
and can't find a c.s.u. archive near you, let me know and I can send
it to you. If there is sufficient demand, I could even post it
to u-pc.sources.
--
Wolf N. Paul * 3387 Sam Rayburn Run * Carrollton TX 75007 * (214) 306-9101
UUCP: killer!wnp ESL: 62832882
DOMAIN: wnp at killer.dallas.tx.us TLX: 910-380-0585 EES PLANO UD
More information about the Unix-pc.general
mailing list