[comp.windows.ms.programmer] Printers in text mode

alan@comp.lancs.ac.uk (Alan Phillips) (01/23/91)

I'm building an application that will print program listings with configurable
tab sizes, line numbering etc (it will be PD when done). It's working
well if I simply get a printer device context and TextOut the text, but
GDI runs the printer in graphics mode, so it's terribly _slow_ and the
spool files are ginormous.

What I think I ought to be able to do (it's hinted at in Petzold and in the
SDK Programming Guide) is to select a font that the driver knows is built in
to the device, and so output in text mode. The books imply that in this case
GDI writes simple text to the printer. I guess I need to EnumFonts and
look for the DEVICE_FONT(?) flag to choose a suitable one.

If I select DEFAULTDEVICE_FONT into the printer DC (this is working to
a DeskJet 500, by the way, using the new HP DJ500 scalable font driver) the
stuff prints in what appears to be the inbuilt Courier font. But the spool
file is still huge; and if I print to file instead I get a file containing
a few hundred null bytes, lots of (mostly repeated) escape sequences, and
nothing resembling the text I've printed. Copying _that_ to the printer
from DOS results in the page loading, but nothing else.

Can anyone give me some simple steps to get where I need to go? Am I asking
the impossible anyway?

Alan Phillips
Lancaster University Computer Centre, UK