Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!uc!shamash!caffeine!dtj From: dtj@caffeine.cray.com (Dean Johnson) Newsgroups: comp.windows.x Subject: Re: font size Message-ID: <7363@caffeine.cray.com> Date: 13 Jul 90 04:37:22 GMT References: <8649@ubc-cs.UUCP> Organization: Cray Research Inc. - Mendota Heights, Minnesota Lines: 27 #include In article <8649@ubc-cs.UUCP> lindholm@greve.ucs.ubc.ca (George Lindholm) writes: >How can I calculate the number of lines that will fit in a listWidget? >I can't find any information on how to get information on the font currently >being used (XtNfont returns something, what I don't know). Something like the following function should give you an good approximation. -Dean -------- cut here ----------- #define FONTHEIGHT(a) ((a)->max_bounds.ascent + (a)->max_bounds.descent) lines_in_widget(w) Widget w; { static Dimension boxHeight; static XFontStruct *font; static Arg getargs[] = {{ XtNheight, (XtArgVal)&boxHeight }, { XtNfont, (XtArgVal)&font }}; XtGetValues(w, getargs, XtNumber(getargs)); return((int) (boxHeight / FONTHEIGHT(font))); }