Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!nuzba.szn.dk!pnx.dk!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Helge Blischke Newsgroups: comp.lang.postscript Subject: Re: Strange (to me) stringwidth behavoir Followup-To: comp.lang.postscript Date: Sat, 08 Sep 2012 18:51:34 +0200 Lines: 47 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit X-Trace: individual.net jQIU2ApA5XsTY9NtI+pC/gArXqbjBvx3xK8sq9ijAsryvX766GYzEciF/bSmavEboC Cancel-Lock: sha1:BsZWbueXFag+4CA1q86cF03BzbA= User-Agent: KNode/0.99.01 Xref: csiph.com comp.lang.postscript:951 Jeffrey H. Coffield wrote: > I recently saw a problem in using stringwidth to determine when to break > a line in a paragraph. The following code demonstrates the problem: > ----------------------------------------------- > %!PS > > /Helvetica 24 selectfont > > 100 100 moveto > (somedata) stringwidth pop 10 string cvs show > > showpage > ----------------------------------------------- > > The problem is that the number shown changes with the output device. > > Using GPL Ghostscript 9.00 on Suse Linux 11.4: > > Running "gs x.ps" shows 105.367. > > Using emacs postscript mode shows 105.379. > > Using "gs -sOutputFile=x.jpg -sDEVICE=jpeg x.ps" shows 105.379 > > Using "gs -sOutputFile=x.pdf -sDEVICE=pdfwrite x.ps" shows 105.382 > > When I send it to a printer I get yet another number. > > This happens with any font even ones that are loaded from a .gsf file > that was also loaded on the printer. I also tested this on OpenVMS > Itanium 8.4 with AFPL Ghostscript 8.51 and I get different numbers. > > Why would the stringwidth vary depending on the output device? > > I am aware the PLRM recommends that the font metrics from the AFM file > be used instead of using PostScript, but that will be a big change and I > don't have the .AFM file for all the fonts I need to use. > > Jeff Coffield > www.digitalsynergyinc.com I suspect the reason is that, on different platforms, there are different variants of Helvetica implemented. Helge