Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!apple!well!shiva From: shiva@well.sf.ca.us (Kenneth Porter) Newsgroups: comp.lang.postscript Subject: Re: Variable characters Summary: stringwidth return values Keywords: font, character size Message-ID: <21226@well.sf.ca.us> Date: 17 Oct 90 07:50:52 GMT References: <1902@fcs280s.ncifcrf.gov> <21131@well.sf.ca.us> <122961@linus.mitre.org> Lines: 23 marsh@linus.mitre.org (Ralph Marshall) writes: > Of course, you can also get the height of the string from > stringwidth... This is not true. stringwidth returns the change in current point after a show of the specified string. For Roman typefaces, only the x component is non-zero. The y component is zero because the baseline doesn't change (as it might in a Japanese font). Actually, the resulting width is NOT the bounding box; it must be adjusted by the side bearings of the first and last characters. This is only a problem, however, if you need a pretty close fit around the string. If metric info is not available in the font dictionary, you can use "charpath flattenpath pathbbox", but I think the resulting bounding box is relative to device coordinates, so you want to do the pathbbox in a coordinate system that is aligned to device space (ie. not rotated or skewed). Ken (shiva@well.sf.ca.us)