> What happens now is that I use GetClientRect() to find out how big
> area is, and simply divide it by the columns/rows that I need.  I
> these sizes to CreateFont() which returns a font that doesn't always
> the dimensions I gave it, so sometimes the font is too small, and
> despite documentation to the contrary, sometimes it's too big.
> leaves me with a font that doesn't actually fit in the Window, so
> characters are getting chopped off.

What I do (in similar situation) is, enumerate all font sizes starting
with some really low size 2 upwards and calculate width/height of a
"sample" text with GetTextExtentPoint32 and make sure it fits in my
window, I stop at the largest font that fits my text inside the window
and use it. I draw a blank border inside unused area of my window
around my rectangle of text to fill the space, never resize client
window, it just looks odd to me. All happens inside WM_SIZE event. I
use only fixed width fonts (Lucida Console is perfect), so any sample
text should do, for example "WWWWW....WWW" (80 of them).


This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].