🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #6244

Re: height of a string

#6244
From: Kevin O'Gorman
Date: Fri, 07 Jun 1991 06:17
46 lines
2183 bytes
mende@athos.rutgers.edu (Bob Mende Pie) writes:


>  If I have a string (String) how can I tell how high the font will be ...
>What I want to do is have do somthing like this (please escuse the pseudo
>postscript)

>100 100 moveto
>currentpoint (string 1) show moveto
>0 (string 1) stringheight rmoveto
>(string 2) show 

>   The stringwidth operator return s X and a Y value, but the y seems only
>0 unless the font is rotated.

Right.  Because what it's really returning is the amount of change to the
current position.

>If anyone knows how to use the information in the /fontBBox to get this I
>would like to know... it seems to return numbers that are no in any
>coordinate system that I can use.

It's in the character coordinate system.  This depends on the FontMatrix,
but in all cases I'm aware of, 1000 units in this system to the nominal
height of the font.  If you scale to 10 ( i.e. 10 scalefont ) 100 units
in the character system to one unit in the user coordinate system.

If FontBBox reports a height of 700, for instance, your 10 point font
should be actually 7 points high.

....

Alternatively, you could use the information in the .AFM files.  This is best
done in an application which is building the Postscript, rather than try to
pass that information to Postscript.  The AFMs are also in character
coordinates.

....

Or you could experiment with the results of 'charpath pathbbox'.  You would
probably have to do it a few characters at a time because of limits in the
postscript machinery.
-- 
Kevin O'Gorman ( kevin@kosman.UUCP, kevin%kosman.uucp@nrc.com )
voice: 805-984-8042 Vital Computer Systems, 5115 Beachcomber, Oxnard, CA  93035
Non-Disclaimer: my boss is me, and he stands behind everything I say.
Technical Details
Message-ID: <1364@kosman.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!gate.oxy.edu!nrc.com!kosman!kevin
References: <Jun.6.17.38.04.1991.29830@athos.rutgers.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!gate.oxy.edu!nrc.com!kosman!kevin
From: kevin@kosman.UUCP (Kevin O'Gorman)
Newsgroups: comp.lang.postscript
Subject: Re: height of a string
Message-ID: <1364@kosman.UUCP>
Date: 7 Jun 91 06:17:24 GMT
References: <Jun.6.17.38.04.1991.29830@athos.rutgers.edu>
Organization: K.O.'s Manor - Vital Computer Systems, Oxnard, CA 93035
Lines: 46