vbob@umd5.umd.edu (Bob Shields) (06/10/90)
I seem to be having problems with SetLineWidth as described in Tech Note #175
on the HP DeskWriter. The program below is a translation of the example
code from the Tech Note (in Pascal) to Think C 4.0. When run with the
DeskWriter printer, the third line printed, which should be 1 point
in thickness, gets printed as a hairline (0.25 in thickness). However, the
other three lines come out correctly. Can anyone explain what is happening?
(I am using Rev A.01.00 of the DeskWriter driver.)
Bob Shields vbob@umd5.umd.edu
/* linetest.c */
#include <stdio.h>
#include <PrintTraps.h>
#define SetLineWidth 182
typedef Point widthPt;
typedef widthPt *widthPtr;
typedef widthPtr *widthHdl;
drawtest()
{
widthHdl theWidth;
theWidth = (widthHdl) NewHandle(sizeof(widthPt));
SetPt(*theWidth, 1, 1);
PicComment(SetLineWidth, sizeof(widthPt), theWidth);
PenSize(1, 1);
MoveTo(50, 100);
LineTo(500, 100);
MoveTo(50, 125);
DrawString("\p1 point thickness.");
SetPt(*theWidth, 1, 5);
PicComment(SetLineWidth, sizeof(widthPt), theWidth);
MoveTo(50, 200);
LineTo(500, 200);
MoveTo(50, 225);
DrawString("\p5.0 times 1 point pen size = 5 point thickness.");
SetPt(*theWidth, 5, 1);
PicComment(SetLineWidth, sizeof(widthPt), theWidth);
MoveTo(50, 300);
LineTo(500, 300);
MoveTo(50, 325);
DrawString("\p0.2 times 5 point pen size = 1 point thickness.");
SetPt(*theWidth, 1, 1);
PicComment(SetLineWidth, sizeof(widthPt), theWidth);
PenSize(1, 1);
MoveTo(50, 400);
LineTo(500, 400);
MoveTo(50, 425);
DrawString("\p1.0 times 1 point pen size = 1 point thickness.");
DisposHandle(theWidth);
}
main()
{
THPrint hPrint;
TPPrPort pPort;
TPrStatus statRec;
puts("Starting test...");
hPrint = (THPrint)NewHandle(sizeof(TPrint));
PrOpen();
if (PrStlDialog(hPrint) && PrJobDialog(hPrint)) {
pPort = PrOpenDoc(hPrint, NULL, NULL);
if (PrError() == noErr) {
PrOpenPage(pPort, NULL);
if (PrError() == noErr)
drawtest();
PrClosePage(pPort);
}
PrCloseDoc(pPort);
if ((PrError() == noErr) &&
((*hPrint)->prJob.bJDocLoop == bSpoolLoop))
PrPicFile(hPrint, NULL, NULL, NULL, &statRec);
}
PrClose();
DisposHandle(hPrint);
}
--
-----------
Bob Shields vbob@umd5.umd.edu