× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Scott,

> What happens now is that I use GetClientRect() to find out how big
the
> area is, and simply divide it by the columns/rows that I need.  I
pass
> these sizes to CreateFont() which returns a font that doesn't always
match
> the dimensions I gave it, so sometimes the font is too small, and
> despite documentation to the contrary, sometimes it's too big.
This
> 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).


Alex


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 by midrange.com 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.