INFO: Controlling Anti-aliased Text via the LOGFONT Structure

ID: Q197076


The information in this article applies to:
  • Microsoft Windows versions 95, 98
  • Microsoft Windows NT 4.0
  • Microsoft Windows 2000


SUMMARY

Beginning with Windows 95 and Windows NT 4.0, the Graphics Device Interface (GDI) can display TrueType fonts that are anti-aliased for better on-screen readability. Applications receive the benefits of anti-aliased text without making modifications to the program code. However, applications may want to control the use of anti-aliased explicitly.


MORE INFORMATION

Windows and Windows NT display anti-aliased text if the video display is configured to be 16-bit per pixel or greater color depth and the user has chosen the "smooth edges of screen fonts" display option. Anti-aliased text, otherwise known as gray-scale text, uses shades of gray when the background is white, to smooth the transition of glyph edge pixels to the background color.

Application developers can specifically realize fonts with or without anti- aliasing by using the lfQuality member of the LOGFONT structure.

NOTE: Anti-aliased text can only be realized if the video display is configured to be in 16-bit per pixel or greater color depth.

Unfortunately the Platform SDK documentation for the LOGFONT structure fails to document the constants that are used to control anti-aliased text by the application. However, the following constants are declared in the WinGDI.h header file of the Platform SDK:


   #define NONANTIALIASED_QUALITY  3
   #define ANTIALIASED_QUALITY     4 


Disabling Anti-Aliased Text

To disable anti-aliased text, set the LOGFONT structure's lfQuality member to NONANTIALIASED_QUALITY. The font created by selecting the HFONT into a device context (DC) is not anti-aliased even if the system option for anti- aliasing has been chosen.

Enabling Anti-Aliased Text

To enable anti-aliased text, set the LOGFONT structure's lfQuality member to ANTIALIASED_QUALITY. The font created by selecting the HFONT into a device context (DC) is anti-aliased if the system's video display settings can support anti-aliased fonts.

If an application sets the lfQuality member of the LOGFONT structure to DEFAULT_QUALITY or PROOF_QUALITY, anti-aliasing of text is controlled by the user's selection of the "smooth edges of screen fonts" display option.

NOTE: The Windows 95 base installation does not produce anti-aliased text (smooth fonts). To install font smoothing capabilities into Windows 95, install the Plus! pack for Windows 95 or download the font smoothing utility from the Microsoft Typography Web site referenced below.


REFERENCES

To obtain the Windows 95 font smoothing utility, download the Microsoft Typography Web site at:

http://www.microsoft.com/typography/

Additional query words: kbDSupport

Keywords : kbNTOS400 kbWinOS2000 kbWinOS95 kbWinOS98
Version : WINDOWS:95,98; winnt:4.0
Platform : WINDOWS winnt
Issue type : kbinfo


Last Reviewed: December 20, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.