Discussion:
Qs on CLEARTYPE_QUALITY
(too old to reply)
Louis Solomon [SteelBytes]
2006-02-03 00:58:19 UTC
Permalink
Hi,
here's some questions about CLEARTYPE_QUALITY ...

1. if CLEARTYPE_QUALITY is specifed on a non XP system (eg, 98SE), what
happens? does it fall back to DEFAULT_QUALITY? or ANTIALIASED_QUALITY? or
what?

2. if CLEARTYPE_QUALITY is specifed on a XP system but the DC on which I
attempt to use it does not support ClearType (eg, is a printer), what
happens? does the select fail? does GDI create and use a similar hfont?

3. what is CLEARTYPE_NATURAL_QUALITY? (found in the win2003sp1 edtion of
the platformsdk)

what I want is simply:
"give me the best possible quality - ie, ClearType (if avail and user
enabled), else AntiAlias (if avail), else proof ..."
and to have this work on all win32 on screen, printer and dibsections

just specifying DEFAULT_QUALITY gives me ClearType on my XP, but on 98SE, it
doesn't give me ClearType (no supprise) OR antialias :-(
--
Louis Solomon
www.SteelBytes.com
Jeffrey Tan[MSFT]
2006-02-03 09:04:35 UTC
Permalink
Hi Louis,

I will try to garther some information regarding your issue, I will update
you ASAP. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
John Carson
2006-02-03 11:07:11 UTC
Permalink
Post by Louis Solomon [SteelBytes]
Hi,
here's some questions about CLEARTYPE_QUALITY ...
1. if CLEARTYPE_QUALITY is specifed on a non XP system (eg, 98SE),
what happens? does it fall back to DEFAULT_QUALITY? or
ANTIALIASED_QUALITY? or what?
According to the documentation, the CLEARTYPE_QUALITY flag has no effect on
earlier OS versions. This is Microsoft being kind to you. In general, you
have no business using a flag introduced in a particular OS version on any
earlier version of that OS since the earlier OS version cannot be expected
to "know about" that flag.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/fontext_0xgn.asp

The general solution for this sort of problem is to call GetVersionEx at
runtime to figure out what OS your program is running on, and then make
different calls (say, using CLEARTYPE_QUALITY or ANTIALIASED_QUALITY)
depending on whether it is, say, WinXP or Win98.
Post by Louis Solomon [SteelBytes]
2. if CLEARTYPE_QUALITY is specifed on a XP system but the DC on
which I attempt to use it does not support ClearType (eg, is a
printer), what happens? does the select fail? does GDI create and use
a similar hfont?
Simple solution: just don't do it for printer DCs.
Post by Louis Solomon [SteelBytes]
3. what is CLEARTYPE_NATURAL_QUALITY? (found in the win2003sp1
edtion of the platformsdk)
I don't know, but my guess would be that it is there in anticipation of a
feature to be introduced on Windows Vista.
--
John Carson
Jeffrey Tan[MSFT]
2006-02-06 01:54:20 UTC
Permalink
Hi Louis ,

Sorry for letting you wait.

In addition to "John Carson"'s reply, I will provide some comment regarding
#2 and #3:

#2, Pretty much the only way to get Create/SelectFont to fail is to run out
of memory. The design philosophy here is that even if you don't get
exactly what you want you'll at least get something. I don't know offhand
what the fallback path is if the DC can't support cleartype but could
handle greyscale.

Note that for printers all anti-aliasing (including cleartype) is turned
off anyway. I would suppose it's because the benefits of anti-aliasing go
down as DPI goes up.

What you get using DEFAULT_QUALITY changes from system to system dependent
on the user's settings. If you have cleartype turned on via the display
control panel then DEFAULT_QUALITY will give you cleartype, otherwise it
won't.

Unless you have some very specific reason to do otherwise you should stick
with DEFAULT_QUALITY. "Best" is subjective and some people really dislike
anti-aliased text and find blockiness preferable to fuzziness. Forcing
anti-aliasing on can also be bad in some accessability scenarios like
screen magnifiers where magnifying the aliasing looks really bad.
Cleartype in particular tends to look really bad if you magnify it.

#3, In many of the "black & white" TrueType fonts that we did for Windows
3.1 (like Times New Roman and Arial) hints were added to many glyphs to
change the natural advance width to something that allowed for better
symmetry of the characters. Often widths were changed by ±2 pixels. With
the low resolution of black and white pixels, things like symmetry are much
more important for reading than accuracy of the character width (wysiwyg).
Because of the extra resolution available along the "widths" axis,
ClearType allows us to get both the symmetry for the glyphs and more
accurate advance widths. Even with this extra accuracy, gdi is still
limited to expressing glyph widths in integer pixels, so ultimately all
widths round to the nearest pixel.

Because we wanted to enable ClearType for all fonts on the system in gdi,
we needed the widths with ClearType on to be the same as with ClearType off
(this is what we had previously done with font smoothing.) In order to get
this behavior, we had to add a mode to gdi called compatible widths, which
forces the advanced with to be the same as black & white. In order to do
this we have to insert a little error into the glyphs. Unfortunately, this
error noticeably distorts the glyph shape and at smaller glyph sizes makes
incorrect gamma settings more problematic (the tuner can help here.)

So, for gdi there are two width options available, compatible widths which
by adding some error, creates widths exactly the same as black & white and
font smoothing and "natural widths" which does not include this error.
"Natural widths" mode became available in Windows xp sp1
(cleartype_natural_quality). It provides high quality ClearType, but since
it is in gdi, it is still limited to integer pixels.

Many of the comments come from our product team. Hope this helps

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Louis Solomon [SteelBytes]
2006-02-08 02:43:40 UTC
Permalink
thanks for the detailed reply ...

so in short, I should just use DEFAULT_QUALITY (or PROOF_QUALITY) except ...

from memory this does not give ideal results with win95+pluspack (win95
didn't have font smoothing, but the plus pack added it), you had to specify
ANTIALIASED_QUALITY even if the user had enabled font smoothing (this is why
I had previously been sepcifying ANTIALIASED_QUALITY)

can you verify this?
--
Louis Solomon
www.SteelBytes.com
Jeffrey Tan[MSFT]
2006-02-08 07:02:34 UTC
Permalink
Hi Louis ,

Thanks for your feedback.

I have contacted our product team to verify this issue. Below is the
feedback from them:

"As I recall, the Win95+Plus! solution did enable font smoothing when it
was enabled (by the Plus! tab). It should be noted, though, that in most
cases, the font actually determines what size font smoothing will be
enabled for that particular font."

Hope this helps

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Loading...