Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #950

Strange (to me) stringwidth behavoir

From "Jeffrey H. Coffield" <jeffrey@digitalsynergyinc.com>
Newsgroups comp.lang.postscript
Subject Strange (to me) stringwidth behavoir
Date 2012-09-08 08:39 -0700
Organization A noiseless patient Spider
Message-ID <k2form$ump$1@dont-email.me> (permalink)

Show all headers | View raw


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

Back to comp.lang.postscript | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Strange (to me) stringwidth behavoir "Jeffrey H. Coffield" <jeffrey@digitalsynergyinc.com> - 2012-09-08 08:39 -0700
  Re: Strange (to me) stringwidth behavoir Helge Blischke <h.blischke@acm.org> - 2012-09-08 18:51 +0200
  Re: Strange (to me) stringwidth behavoir SaGS <sags5495@gmail.com> - 2012-09-08 10:22 -0700
    Re: Strange (to me) stringwidth behavoir deedubman@gmail.com - 2012-09-09 12:54 -0700
  Re: Strange (to me) stringwidth behavoir tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-09-08 21:56 -0400

csiph-web