gst@gnosys.UUCP (Gary S. Trujillo) (03/19/89)
(This article is a replacement for one mistakenly posted earlier to unix-pc.sources. It contains a couple of paragraphs not found in the previous article, which has been cancelled.) 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. My test procedure has been to run the command: nroff testfile | od -c where "testfile" contains things like: alpha \(*a beta \(*b etc. after I have created the definitions in my /usr/lib/nterm/tab.nec table: *a 1 \340 *b 1 \341 What has been happening is that sequences with octal values representing characters with their high bits set (e.g., "\340") have been replaced by spaces in the nroff output. If I replace these characters with characters without their high bits set, the mapping is done properly. The other NEC P2200-specific problem has to do with the fact that it is necessary to send an 8-bit zero character in connection with the setting of certain modes. For example, to select the Courier font after some other font has been selected, it is necessary to send the sequence "\033k\0" (<ESC>k<true-binary-zero>). Problem is, I know of no way to represent a zero byte by means of an nroff driver table. (The obvious "\0" does not work; neither does a true-binary-zero in the driver table file (you can see I've gone to extreme lengths).) I'd dearly love to have a chat with the person who laid out the tables for the P2200 control functions. Grrr. Any ideas would be appreciated! -- Gary S. Trujillo {linus,bbn,m2c}!spdcc!gnosys!gst Somerville, Massachusetts {icus,ima,stech,wjh12}!gnosys!gst -- Gary S. Trujillo {linus,bbn,m2c}!spdcc!gnosys!gst Somerville, Massachusetts {icus,ima,stech,wjh12}!gnosys!gst
gst@gnosys.UUCP (Gary S. Trujillo) (03/19/89)
In article <130@gnosys.UUCP> gst@gnosys.UUCP (Gary S. Trujillo [me]) writes: > ... > My test procedure has been to run the command: > > nroff testfile | od -c Of course, I meant to say: nroff -Tnec testfile | od -c -- Gary S. Trujillo {linus,bbn,m2c}!spdcc!gnosys!gst Somerville, Massachusetts {icus,ima,stech,wjh12}!gnosys!gst
ilan343@violet.berkeley.edu (03/19/89)
In article <130@gnosys.UUCP> gst@gnosys.UUCP (Gary S. Trujillo) writes: >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". I don't know if this will work in every version of nroff. This came from a 3B2 running the nroff in DWB 2.0. There is an undocumented trick to enter 8-bit in charset table. It consists of preceding the octal by "%". Here is a sample from the table I use for a printer with then an IBM character set. charset C, 1 %\200 u: 1 %\201 e' 1 %\202 a^ 1 %\203 a: 1 %\204 a` 1 %\205 *a 1 %\340 *b 1 %\341 *g 1 %\342 *d 1 %\353 *e 1 %\356
wnp@killer.Dallas.TX.US (Wolf Paul) (03/20/89)
In article <130@gnosys.UUCP> gst@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@killer.dallas.tx.us TLX: 910-380-0585 EES PLANO UD
mark@jhereg.Jhereg.MN.ORG (Mark H. Colburn) (03/20/89)
In article <130@gnosys.UUCP> gst@gnosys.UUCP (Gary S. Trujillo) writes: >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 The key is to add a % before 8 bit values. I found this out by digging through the source code for ditroff. It was not in the manual anywhere, *sigh*. I got this far on the P2200 driver before I gave up. I has a previous version which did a lot more, but lost it in a disk crash and had no back up. It does most of the stuff that I want it to do, since I don't use the special characters that much. If someone would like to polish it up, I would love to see a copy back... p2200 bset 0 breset 0 Hor 24 Vert 20 Newline 40 Char 24 Em 24 Halfline 20 Adj 24 twinit "\033@\033%\000" twrest "\033@" twnl "\n" hlr "\0338" hlf "\0339" flr "\0337" bdon "\033E\033G" bdoff "\033F\033H" iton "\0334" itoff "\0335" ploton "" plotoff "" up "" down "" right "" left "" charset em 1 - hy 1 - \- 1 - bu 1 %\371 sq 2 [] bx 1 %\376 ru 1 _ 14 1 %\254 12 1 %\253 34 3 3/4 fi 2 fi fl 2 fl ff 2 ff Fi 3 ffi Fl 3 ffl de 1 %\370 dg 1 |\b- fm 1 ' ct 1 c\b/ rg 3 \033S(r)\033T co 3 \033S(c)\033T tm 2 \033STM\033T pl 1 + mi 1 - eq 1 = ** 1 * sc 1 \033R]\033r aa 1 ' ga 1 ` ul 1 _ sl 1 / *a 1 %\340 *b 1 %\341 *g 1 y\b/ *d 1 %\353 *e 1 %\356 *z 1 ,\bL *y 1 %\374 *h 1 -\b0 *i 1 ,\bi *k 1 k *l 1 \\\b> *m 1 %\346 *n 1 ,\bv *c 1 ,\b3 *o 1 o *p 1 %\343 *r 1 p *s 1 %\345 *t 1 %\347 *u 1 u *f 1 %\355 *x 1 x *q 1 |\bu\b, *w 1 w *A 1 A *B 1 B *G 1 %\342 *D 2 _\b/_\b\\ *E 1 E *Z 1 Z *Y 1 H *H 1 %\351 *I 1 I *K 1 K *L 2 /\\ *M 1 M *N 1 N *C 1 _\b-\b\0338-\0339 *O 1 O *P 2 ||\b\b\0337__\0339\0339 *R 1 P *S 1 %\344 *T 1 T *U 1 Y *F 1 %\350 *X 1 X *Q 1 |\bU\b, *W 1 %\352 ts 1 s sr 2 \\/ rn 1 \0337_\0339\0339 >= 1 %\362 <= 1 %\363 == 1 %\360 ~= 1 %\367 ap 1 ~ != 1 =\b/ -> 2 -> <- 2 <- ua 1 |\b^ da 1 |\bv mu 1 x di 1 %\366 +- 1 %\361 cu 1 U ca 1 %\357 sb 2 (\0338-\0339\b_ sp 2 _\0338\b-\0339) ib 2 (\0338-\b\0339\0339=\0338 ip 2 \0338-\b\0339\0339=\0338) if 1 %\354 pd 1 6 gr 1 V\b\0338-\0339 no 1 - is 1 '\b,\bI pt 2 oc es 1 /\bO mo 1 -\bC br 1 |\b\0338|\0339 dd 1 |\b= rh 2 => lh 2 <= or 1 | ci 1 O lt 1 (\b\0339|\0338 lb 1 (\b\0338|\0339 rt 1 )\b\0339|\0338 rb 1 )\b\0338|\0339 lk 1 |\b\0338|\0339 rk 1 |\b\0338|\0339 bv 1 |\b\0338|\0339 lf 1 \0339|\0337\b|\0339\b| rf 1 \0339|\0337\b|\0339\b| lc 1 \0338|\0339\b| rc 1 \0338|\0339\b| ag 1 %\217 >~ 1 >\b\0339~\0338 <~ 1 <\b\0339~\0338 b* 1 |\bX\b- an 1 /\b_ ra 2 |_ tf 3 .\0338.\0339. 3d 1 :\b\0338.\0339 -~ 1 -\b~ os 1 v as 1 ^ =D 2 ==\b\b\0338/\\\0339 oA 1 V\b- oE 1 E\b/ || 2 || hb 1 h\b- pp 1 |\b_ sL 1 /\b( <> 3 <-> df 3 <=> ic 1 C\b_ c+ 1 O\b+ cx 1 O\bX =. 1 =\b\0338.\0339 nm 1 C\b-\b/ ll 1 < rl 1 > -- Mark H. Colburn "Look into a child's eye; Minnetech Consulting, Inc. there's no hate and there's no lie; mark@jhereg.mn.org there's no black and there's no white."