mende@athos.rutgers.edu (Bob Mende Pie) (06/07/91)
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 notes: string stringheight => int % returns height of string Output: string 2 string 1 The stringwidth operator return s X and a Y value, but the y seems only 0 unless the font is rotated. 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. /Bob... {...}!rutgers!mende mende@cs.rutgers.edu mende@zodiac.bitnet -- /Bob... {...}!rutgers!mende mende@cs.rutgers.edu mende@zodiac.bitnet
kevin@kosman.UUCP (Kevin O'Gorman) (06/07/91)
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.