lipa@POLYA.STANFORD.EDU (William Lipa) (08/06/88)
I am writing a plotting program and I would like to find the height of an arbitrary character in an arbitrary font so that I can center it vertically on a line. That means I need a different height for the letter "o" than the letter "O", even if they are in the same font and size. Is there any nice, compatible way to do this? Right now I just assume characters are a certain percentage of the fontAscent + fontDescent (about two-thirds seems about right). Of course, this is inaccurate and might lead to internationalization problems. Help much appreciated... Bill Lipa lipa%polya@forsythe.stanford.edu
casseres@Apple.COM (David Casseres) (08/06/88)
In article <CMM.0.87.586818538.lipa@polya.stanford.edu> lipa@POLYA.STANFORD.EDU (William Lipa) writes: >I am writing a plotting program and I would like to find the height of an >arbitrary character in an arbitrary font so that I can center it vertically on >a line. That means I need a different height for the letter "o" than the >letter "O", even if they are in the same font and size. Macintosh fonts contain no information on the dimensions of the glyphs (i.e. the black-pixel sets) of individual characters. I think about the best you can do is draw the character into a little offscreen bitmap, then find the first and last rows in the bitmap that contain non-0 bits. David Casseres
lipa@polya.Stanford.EDU (William J. Lipa) (08/06/88)
In article <15215@apple.Apple.COM> casseres@apple.apple.com.UUCP (David Casseres) writes: >Macintosh fonts contain no information on the dimensions of the glyphs (i.e. >the black-pixel sets) of individual characters. IM volume IV says that the Font Manager calculates the image-height table, "which speeds the drawing of characters", and sticks it somewhere off in memory. It would be nice if there was an official way to get at this table! Bill Lipa lipa%polya@forsythe.stanford.edu