Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!pa.dec.com!nntpd.lkg.dec.com!engage!3d.enet.dec.com!davis From: davis@3d.enet.dec.com (Peter Davis) Newsgroups: comp.lang.postscript Subject: Re: letter height Message-ID: <1991May28.134420.3951@engage.pko.dec.com> Date: 28 May 91 13:40:27 GMT Sender: newsdaemon@engage.pko.dec.com (USENET News Daemon) Distribution: comp.lang.postscript Organization: Digital Equipment Corporation Lines: 27 In article , kl88a@ecs.soton.ac.uk (Kris Lockyear) writes... > >I want a short piece of code to find out the dimensions of a single >character. More specifically, the height from the baseline to the top >of the letter. This is because I want to occaisionally invert a >letter in a word eg HELEN with the N upside down. I have written the >code so that I can invert the letter, but not so I know how much >upwards I have to move it ( the textheight used in scalefont is the >maximum height from the tail of a letter like y to the top of a >capital.) > This is very simple: (N) true charpath flattenpath pathbbox /y2 exch def /x2 exch def /y1 exch def /x1 exch def /height y2 y1 sub def newpath If all you care about is the height, you could do: (N) true charpath flattenpath pathbbox exch pop exch sub /height exch def pop newpath Note that you must have a current point somewhere for this to work.