morreale@bierstadt.scd.ucar.edu (Peter Morreale) (01/31/91)
This is a minor question for all the font builders out there, but I'd like to know how to handle it.... In my *Xt* app I have several text widgets where I control the width of the widget. The idea is to convey to the user that a certain widget can only "accept" "n" characters. (I also use alot of real estate, so I want to conserve it where appropriate...) What I do is to retrieve the width (in pixels) of a single character of the user specified (or default) font and then multiply and set that width accordingly. This works fine for the fixed width fonts (naturally :-), but I didn't account for variable width fonts. For example, the font I am currently using in the app ranges in width from 5 (" ") to 13 ("W") pixels in width. Is there any way I can find out the say "average" width of the characters in a font (short of looping through all the characters..) *or* are there a relatively set group of characters which *generally* show the range of widths within a font? (then I could get the width for that string and produce an average width...) (Please note that I am only interested in ASCII characters. Should the user specify a "symbol" type font, well... ) How can I handle this? Thanks for all and any tips... -PWM ------------------------------------------------------------------ Peter W. Morreale email: morreale@ncar.ucar.edu Nat'l Center for Atmos Research voice: (303) 497-1293 Scientific Computing Division Consulting Office ------------------------------------------------------------------