Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!mips!apple!hercules!sparkyfs!unix!hplabs!hp-ses!hpcuhb!hpindda!mears@hpindda.HP.COM From: mears@hpindda.HP.COM (David Mears) Newsgroups: comp.windows.x Subject: Determining font size values: R2 vs. R3 Message-ID: <3630008@hpindda.HP.COM> Date: 20 Feb 90 23:45:30 GMT Organization: HP Information Networks, Cupertino, CA Lines: 27 I have an application which needs to compute the size of an enclosing box around a block of text that will be put into a widget. To determine the size, I determine the max width and height of the font being used and then multiply those values by the number of characters in the widest line, and by the number of lines in the block. My calculations came out fine when used with R2 based fonts, but do not work right with an R3 font. Apparently there was some small change made in the way that the sizing information is stored in the R3 fonts. I would appreciate it if someone could show me how to modify my calculations so they will give the correct results with either an R2 or an R3 font. Right now I determine the font character width and height by the following formulas: TFheight = font->max_bounds.ascent + font->max_bounds.descent; TFwidth = font->max_bounds.rbearing - font->min_bounds.lbearing; BTW, using these formulas tends to give me a value which is slightly small for the R3 fonts. Thanks. David B. Mears Hewlett-Packard Cupertino CA hplabs!hpda!mears mears@hpda.HP.COM