Article View: comp.lang.postscript
Article #3849Re: Determining the height of a string ?
From: Dick Dunn
Date: Sat, 26 Sep 1992 06:49
Date: Sat, 26 Sep 1992 06:49
31 lines
2071 bytes
2071 bytes
pererik@cmi.no (Per-Erik Nordbo) writes: >rcd@raven.eklektix.com (Dick Dunn) writes: >|> pererik@cmi.no (Per-Erik Nordbo) writes: >|> >I would like to fill the bounding box of a string before I 'show' ... ...[stringwidth doesn't give the right info]... >|> What you want is a bounding box for the string, which you can get using the >|> charpath and pathbbox operators. ... >The pathbbox operator has some drawbacks, however... ... >"If the user coordinate system is rotated (other than by multiples of 90 degrees) or skewed, 'pathbbox' may return a bounding box that is larger than expected." Yes, because pathbbox's bounding box is calculated in device space and transformed back into user space. One way around this is to get the bounding box while the axes are aligned and hang on to it--for example, with aligned axes, put yourself at the origin and get the bounding box, then delta-transform it. Move and rotate to where you want to be, then inverse-delta-transform it to get the box you want. This is sounding heavy-handed. (I'm waiting for somebody like Henry or Glenn to step in with a simple, obvious solution and make me feel like a dolt.:-) If you'd rather do the computation upstream of the printer, use .afm files, since those have the bounding boxes. It's more work for you, since you've got to write a small gob of code to get the afm data and walk down the string building the bounding box. But it ends up being a lot less computation than the charpath ritual. -- Dick Dunn rcd@raven.eklektix.com -or- raven!rcd Boulder, Colorado Clowns are necessities, not luxuries.
Technical Details
Message-ID:
<1992Sep26.064953@eklektix.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!purdue!yuma!csn!raven!rcdReferences:
<1992Sep22.111733.1226@alf.uib.no> <1992Sep23.023715@eklektix.com> <1992Sep23.081106.573@alf.uib.no>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!purdue!yuma!csn!raven!rcd From: rcd@raven.eklektix.com (Dick Dunn) Newsgroups: comp.lang.postscript Subject: Re: Determining the height of a string ? Message-ID: <1992Sep26.064953@eklektix.com> Date: 26 Sep 92 06:49:53 GMT References: <1992Sep22.111733.1226@alf.uib.no> <1992Sep23.023715@eklektix.com> <1992Sep23.081106.573@alf.uib.no> Organization: eklektix - Boulder, Colorado Lines: 31