Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printer wide-font problem

Status
Not open for further replies.

aharrisreid

Programmer
Nov 17, 2000
312
GB
I am outputting a (very old, hand-coded) report directly to a printer using ??? for print commands and @ SAY for text posisitioning. I want some lines to be output in double-width font. The code looks something like this...

SET DEVICE TO PRINT
SET PRINT TO
??? CHR(27)+'@' && reset printer (necessary, but can't work-out why)

??? CHR(27)+'W1' && set wide font on
@0,0 SAY "Double-width text"
??? CHR(27)+'W0' && set wide font off
@1,0 SAY "Back to normal width"
@2,0 SAY "Further text in normal width"

SET PRINT TO
SET DEVICE TO SCREEN

This doesn't work - all printed text is in normal width. However, I found some very old code and discovered that the following code-block replacement works...

@0,0 SAY "Double-width text"
??? CHR(27)+'W1'
@1,0 SAY "Back to normal width"
??? CHR(27)+'W0'
@2,0 SAY "Further text in normal width"

Can anyone explain what might be going on, and what is the neatest way around this problem? Ideally I want the double-width lines 'wrapped' between the wide-font on/off commands, but it seems that the ??? wide on/off is required *after* the @ SAY... line. This doesn't make sense to me.

Any help would be appreciated.

Alan
 
I'm not a printer expert, but I believe that printer codes are printer specific. I'd recommend posting the make/model of the printer you are using too.

Brian
 
baltman, thanks for the reply.

>... I believe that printer codes are printer specific.
> I'd recommend posting the make/model of the printer you
> are using too.

In this case I am using an Epson LQ-300, but it uses the ESC/P2 codes which are common to most Epson dot-matrix printers.

I know that the codes I am using are correct to set wide-font on/off, but I would expect to set it ON before the double-width line, then OFF after the line is output, but it is not behaving this way.

Regards,
Alan

 
Alan,

The codes you are using are indeed correct for the LQ series (they are two of the few codes I happen to remember).

There are two possible problems:

- I'm not sure, but I believe @0,0 is a special case, which does some sort of printer reset. It might be worth trying your original code, but printing to, say, @1,1 rather than @0,0, just to see what happens.

- It's always a bit risky to mix @.. SAY and ??? commands. I don't see why that should cause this particular problem, but it might be worth keeeping in mind.

Apart from that, I can't see any reason for the behaviour you are describing.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Hi Mike,

>...I believe @0,0 is a special case, which does some sort >of printer reset. It might be worth trying your original >code, but printing to, say, @1,1 rather than @0,0

I tried that, but unfortunately there was no change.

>It's always a bit risky to mix @.. SAY and ??? commands.

I know, but unless the client puts hand in pocket and agrees to haul the reports into 2004, I'm stuck with making the best of a bad job :-(

Regards,
Alan
 
Try the following
??? chr(14)+'Big wide print'

The effect of chr(14) applies for only one line and is self retiring.
 
Cricket, thanks for the reply.

>Try the following
>??? chr(14)+'Big wide print'

>The effect of chr(14) applies for only one line and is >self retiring.

You're right. I missed that one in the manual! It works, but in my tests it doesn't allow a mixture of wide-font and normal-font on the same line. Still, it may be useful in the future.

I also notice that CHR(20) switches wide-font off (one line only), but I can't understand the point if CHR(14) is self-retiring.

Regards,
Alan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top