Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!know!zaphod.mps.ohio-state.edu!ub!uhura.cc.rochester.edu!rochester!pt.cs.cmu.edu!g.gp.cs.cmu.edu!fryd From: fryd@g.gp.cs.cmu.edu (Michael Fryd) Newsgroups: comp.lang.postscript Subject: Re: printing thin lines on 300dpi printer Keywords: thin lines Message-ID: <10676@pt.cs.cmu.edu> Date: 5 Oct 90 22:48:39 GMT References: <1990Oct1.222116.14508@applga.aa.cad.slb.com> Organization: Carnegie-Mellon University, CS/RI Lines: 47 > Newsgroups: comp.lang.postscript > Date: 1 Oct 90 22:21:16 GMT > Sender: dsmith@applga.aa.cad.slb.com (J. Daniel Smith) > Reply-To: smithda@buster.cps.msu.edu > > I'm trying to print 1 pixel wide lines on a 300dpi PS printer. > Following the techniques on page 62-63 of _Real World PostScript_, > I have the code shown below. > > The problem is that the top line of the box is thicker than the other > sides. I tried printing this file on two different Apple PS printers, > and the result was the same on both of them. I also tried different > values for "setlinewidth" (0.24, 0.12 and 0.003). And I tried putting > the SnapToPixel before the "rmoveto". None of this worked! There > must be a way to do this properly (i.e. *not* doing everything in > 1/300 inch units). The problem is that the endpoints for each line segment must be properly alligned with the device pixels. The Solution is to use SnapToPixel on each corner of the box. This requires a slight rewrite to the code because SnapToPixel only works with absolute coordinates, not relative moves. the solution is to change: 0 boxy SnapToPixel moveto boxlength 0 rlineto 0 logoheight rlineto boxlength neg 0 rlineto closepath to: 0 boxy SnapToPixel moveto boxlength boxy SnapToPixel lineto boxlength logoheight boxy add SnapToPixel lineto 0 logoheight boxy add SnapToPixel lineto closepath Michael Fryd President Voice: (412) 751-5557 MEFCO, Inc. Fax: (412) 751-8403 2401 Coulter Road Email: Michael.Fryd@CS.CMU.EDU McKeesport, PA 15131-4251