[comp.lang.postscript] LaserWriter bug??

daved@physiol.su.oz.au (Dave Davey) (06/11/91)

The PostScript program below is part of the output of a histogram
drawing program.  The Postscript just draws a line, as a series of
segments.  On our LaserWriter Plus and LaserWriter NTX printers,
some of the line segments are thicker than others, by about 50%.
As there is only one setlinewidth request, I am puzzled by
this behaviour.  Any advice on how to fix this would be appreciated.
Incidently, if you duplicate the fault, I think you will find it is
the thin segments that are correct.


%!PS-Adobe-1.0
erasepage
initgraphics
initclip
clear
/l { lineto currentpoint stroke moveto } bind def
/m { moveto } def
/cma 0 def
/trm 6 array def
/cmrot { dup /cma exch def cos cma sin dup neg cma cos 0 0 trm astore pop
 currfont trm makefont currentsize scalefont setfont } def
/ft { findfont dup /currfont exch def currentsize scalefont setfont } def
/currfont /Times-Roman findfont def
/currentsize 10 def
72 300 div dup scale
90 rotate
clippath pathbbox
pop pop
20 add exch 20 add exch
translate
2 setlinecap 0 setlinejoin
newpath 0 0 moveto
0 0 m
6 setlinewidth
249 1261 m
249 1843 l
287 1843 l
287 1479 l
325 1479 l
325 1407 l
363 1407 l
363 1479 l
402 1479 l
402 1370 l
440 1370 l
440 1370 l
478 1370 l
478 1334 l
517 1334 l
517 1443 l
555 1443 l
555 1297 l
593 1297 l
593 1297 l
632 1297 l
632 1297 l
670 1297 l
670 1334 l
708 1334 l
708 1334 l
747 1334 l
747 1334 l
785 1334 l
785 1334 l
823 1334 l
823 1334 l
861 1334 l
861 1334 l
900 1334 l
900 1297 l
938 1297 l
938 1297 l
976 1297 l
976 1297 l
1015 1297 l
1015 1297 l
1053 1297 l
1053 1334 l
1091 1334 l
1091 1297 l
1130 1297 l
1130 1261 l
0 0 m
showpage
%%Trailer

woody@chinacat.unicom.com (Woody Baker @ Eagle Signal) (06/12/91)

The problem lies with the pixel painting method used by the interpreter.
One way to handle this is to use  this fragment (from the original red book
p 187)

transform round exch round exch itransform

This locks the line to the nearest pixel by converting from userspace
to machine space, rounding and then converting back to user space.
Level II has addressed this problem.

Cheers
Woody