Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Request for CLEARTYPE_QUALITY in CreateFont apparently ignored

21 views
Skip to first unread message

Mike Capp

unread,
Dec 10, 2004, 7:56:08 AM12/10/04
to
(Originally posted this on microsoft.public.win32.programmer.ui but got
no response - trying again here. Any suggestions or "well, it works for
me" datapoints much appreciated)

Hi,

I'm drawing text to a bitmap selected into a memory DC, and I'd like
this text to be antialiased as nicely as possible, irrespective of the
current global font-smoothing preference. I'm using the Platform SDK,
drawing with TextOut and running under WinXP SP2 for testing purposes.

When ClearType smoothing is turned on in Display Properties, and
fdwQuality is PROOF_QUALITY or CLEARTYPE_QUALITY, everything is fine.
So it's apparently possible to use ClearType when drawing to a memory
DC. If fdwQuality is changed to NONANTIALIASED_QUALITY, smoothing is
turned off as expected, so the parameter is apparently being read.

However, when font smoothing is turned OFF in Display Properties, and
fdwQuality is CLEARTYPE_QUALITY, text is drawn with no smoothing - the
CreateFont parameter doesn't seem to override the global setting in
this case.

My call to CreateFont looks like this:

HFONT hfont = ::CreateFont(
-16, // logical height of font
0, // logical average char width, 0 = best match
0, // angle of escapement
0, // base-line orientation angle
FW_NORMAL, // font weight
FALSE, // italic attribute flag
FALSE, // underline attribute flag
FALSE, // strikeout attribute flag
DEFAULT_CHARSET, // character set identifier
OUT_TT_PRECIS, // output precision; prefer TrueType fonts
CLIP_DEFAULT_PRECIS, // clipping precision
CLEARTYPE_QUALITY, // output quality
VARIABLE_PITCH | FF_SWISS, // pitch and family
"Tahoma"); // pointer to typeface name string

The same problem affects ANTIALIASED_QUALITY - it's ignored unless
_some_
sort of font smoothing is enabled in global prefs. Overall, the rule
seems to be that you get the uglier of the global pref and the
CreateFont fdwQuality parameter.

I am checking all Win32 calls for error return, and there's nary a peep
from any of them. Incidentally, CreateFont doesn't fail if you give it
a nonsensical fdwQuality like 12345678, it just ignores it and uses
your global pref.

Can anyone suggest what I'm doing wrong or, if this is a bug, how I
could work around it?

cheers
Mike

0 new messages