Path: utzoo!utgpu!watmath!clyde!att!rutgers!tut.cis.ohio-state.edu!bloom-beacon!bu-cs!dartvax!eleazar.dartmouth.edu!earleh
From: earleh@eleazar.dartmouth.edu (Earle R. Horton)
Newsgroups: comp.sys.mac.programmer
Subject: patStretch ?
Keywords: Printing, again.
Message-ID: <11256@dartvax.Dartmouth.EDU>
Date: 30 Nov 88 18:56:36 GMT
Sender: news@dartvax.Dartmouth.EDU
Reply-To: earleh@eleazar.dartmouth.edu (Earle R. Horton)
Organization: Thayer School of Engineering
Lines: 48

I am writing a dot matrix printer driver so I can print graphics on my
Tandy printer from my Macintosh.  It saves application drawing
commands in a QuickDraw picture.  After the application has drawn a
page, my PrClosePage routine rescales the portRect of my printing port
to match the printer's Rect, which is 120 DPI on letter-size paper,
1/4 inch margins all around.  It then calls DrawPicture to draw the
expanded image, and sends the bits on to the printer.  I have font
scaling and fractional font widths enabled when the application draws
into my printing port, so text justification comes out right. The
device field of my printing port is set to zero, so that QuickDraw
will scale things as if drawing to the screen.

I am happy to report that I have thus printed several MicroSoft Word
documents, a HyperCard card, a Finder directory listing, and a few
screen dumps.  Results are just about WYSIWYG, if I have the right
fonts installed.  Scaling is a 50% increase (80 DPI in application's
portRect and 120 DPI in output portRect), so not all font families
have fonts which will scale properly.  I also have an "exact bits"
mode which I use when doing screen dumps or if I want dot-addressible
graphics in a drawing or paint program.

There is a "patStretch" field in the GrafPort data structure, which
Inside Macintosh assures me "is used during output to a printer to
expand patterns if necessary."  I need to know how to use this field
to control pattern scaling.  Right now, patterns are not scaled when
they come out on the printer, which means they are reduced 33% in
size, relative to other objects in a drawing.  If I could double the
size of output patterns, then they would be increased in size by 33%,
which might look better.  On another printer with higher resolution,
patterns might come out exactly to scale with the rest of the drawing
if scaled by the same amount as the picture.

On a related note, I call SetFractEnable(true) and
SetFScaleDisable(false) before the application starts drawing into my
printing port.  When my PrCloseDoc routine is called, I call these
routines to reset the default values for fractional fonts and font
scaling.  Is there a way I can find out what the previous state is,
short of reading the low memory globals directly?  Should I just
assume that if an application developer is savvy enough to want font
scaling and fractional font widths, he will set things up when he is
done printing?

I am soliciting all opinions on the patStretch thing.  Documented,
undocumented, even hearsay are welcome.

Earle R. Horton. 23 Fletcher Circle, Hanover, NH 03755
(603) 643-4109
Sorry, no fancy stuff, since this program limits my .signature to three