Path: utzoo!attcan!uunet!husc6!think!ames!ncar!boulder!stan!garya From: garya@stan.com (Gary Aitken) Newsgroups: comp.windows.x Subject: Re: XFontStruct numbers useless? Message-ID: <282@stan.com> Date: 19 Nov 88 02:23:10 GMT References: <281@stan.com> <8811181451.AA20578@EXPO.LCS.MIT.EDU> Organization: Solbourne Computer Inc., Longmont, Co. Lines: 33 My appologies, the required font information is there; my original question, rephrased, is: How does one determine the size of a window to display an arbitrary string in a fixed width font, such that no characters will clip? The answer, I believe, is: XFontStruct *fp ; over_x_left = max(abs(min(fp->min_bounds.lbearing,0)),0) ; /* max # pixels to left of bounding box occupied by any character */ over_x_right = max(fp->max_bounds.rbearing-fp->max_bounds.width,0) ; /* max # pixels to right of bounding box occupied by any character */ over_y_top = max(fp->max_bounds.ascent-fp->ascent,0) ; /* max # pixels above bounding box occupied by any character */ over_y_bottom = max(fp->max_bounds.descent-fp->descent,0) ; /* max # pixels below bounding box occupied by any character */ ascent = fp->max_bounds.ascent + over_y_top ; descent = fp->max_bounds.descent + over_y_bottom ; ht = ascent + descent ; width = over_x_left + n_char*fp->max_bounds.width + over_x_right ; The origin for drawing is then: (over_x_left,ascent) > > Is there a reliable way to determine if interline whitespace is already > included in the font, and what it is? > > Yes, get your fonts from a reliable source. Does this imply we may assume that all fonts from MIT have interline spacing included?