Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!aplcen!haven!udel!mmdf From: webb@udel.edu (David Webb) Newsgroups: comp.sys.amiga Subject: (none) Message-ID: <2060@nigel.udel.EDU> Date: 19 Oct 89 14:33:12 GMT Sender: mmdf@udel.EDU Lines: 100 ------- Forwarded Message Received: from louie.udel.edu by louie.udel.edu id aa11094; 18 Oct 89 20:51 GMT Received: by cbmvax.UUCP (5.57/UUCP-Project/Commodore 12/21/87)) id AA11581; Wed, 18 Oct 89 16:43:55 EDT Date: Wed, 18 Oct 89 16:43:55 EDT From: Ewout Walraven - CATS Message-Id: <8910182043.AA11581@cbmvax.UUCP> To: mmdf@udel.edu Subject: Re: Printer drivers Newsgroups: comp.sys.amiga In-Reply-To: <1663@nigel.udel.EDU> Organization: Commodore Technology, West Chester, PA Cc: In article <1663@nigel.udel.EDU> you write: >I have an old C.Itoh Starwriter F10 for which I've cobbled up a driver. >It's a daisy wheel printer, and the driver handles spacing and the >like just fine. However, there are no abilities in the printer itself >to do automatic underlines, bolding, etc. These can be done (and are >done by some software like Word Perfect) by using backspace-underline >to underline text, or double striking to get bolding. > I'd like to get these effects by modifying the printer driver, as it >seems Nature (should have?) intended. The RKMs I have are however not Yes this can be done. Hope you wrote a V1.3 driver. What you'll have to do is the following: In printertag.asm: import the _ConvFunc name (ie add XREF _ConvFunc) export some flag(s) to indicate you wanna do underlining, bold or whatever. (ie XDEF _UnderlineFlag, XDEF _BoldFlag etc) Have the field after the printmode point to your ConvFunc() (ie change "DC.L 0" to "DC.L _ConvFunc") Define your flags below this. For example _UnderlineFlag: DC.W 0 and _BoldFlag: DC.W, to makethem words. (since your flags must be in the code section, NOT in the data section you have to define them here) In dospecial.c (or anywhere actually) you now can add 'extern short UnderlineFlag, BoldFlag as globals and your own ConvFunc() routine. Something like this int ConvFunc(buf, c, flag) char *buf, c; /* the buffer and char to process */ int flag; /* actually the crlfFlag issued by the printer device */ /* which you don't need */ { int nr; /* number of bytes we added to buffer, or -1 if no * conversion done */ if (UnderlineFlag && (c >= 'a' && c <= 'z' || c >= 'A' && c < 'Z') { /* anyway something to test yes user wants to underline, yes i can underline this char DON'T change 0x1b and 0x9b! */ *buf++ = c; /*char itself */ *buf++ = 0x08; /* backspace */ *buf++ = '_'; /* 'some' underlining char */ nr = 3; /* we added 3 chars to the buffer */ /* lots of fake capabilities can be added, make sure that nr REALLY reflects the TOTAL number of chars added by all enhancements */ } else nr = -1; /* nothing added. If you return 0 the char will be skipped */ return(nr); } Now in DoSpecial() add support for all printer command exceptions you want to have and set the flags accordingly, like: if (*command == aSGR4) /* underline */ UnderlineFlag = 1; if (*command == aSGR24) /* underline off */ UnderlineFlag = 0; if (*command == aSGR1) /* bold */ BoldFlag = 1; if (*command == aSGR22) /* bold off */ BoldFlag = 0; if (*command == aSGR0){ /* plain text BoldFlag = 0; UnderlineFlag = 0; } Set all printercommands NOT supported by your printer to \377 in data.c's CommandTable structure. That's all there is to it. ConvFunc() gets called automatically by the printer device, once you've set the pointer in printertag.asm. Hope this helps. EC - -- Ewout Walraven - CATS Commodore Business Machines, Inc. PHONE: 215-431-9426 UUCP: {uunet|rutgers}!cbmvax!ewout ------- End of Forwarded Message