Working with ClearType Fonts
A version of this page is also available for
4/8/2010
Windows Embedded CE–based devices include support for Microsoft ClearType® display technology equivalent to what has shipped in Windows XP. Because this ClearType support depends on the implementation of the display driver, not all OS designs support ClearType.
ClearType can be enabled system–wide or on a per–application basis.
ClearType uses characteristics of LCDs to make text seem less jagged and more like printed type on paper, increasing the readability of the text. ClearType increases the effective screen resolution on LCDs by taking advantage of the red, green, and blue subpixels that make up each pixel on a color screen. By mathematically adjusting the signal from these subpixels, ClearType creates text in which the letters have smoother edges.
Windows Embedded CE–based devices support ClearType only for display devices with color depths of 8, 16, 24, or 32 bits per pixel (bpp). The implementation of ClearType on Windows Embedded CE–based devices can use subpixels contained either in vertical stripes or in horizontal stripes to provide ClearType support even when the screen is rotated.
Windows Embedded CE–based devices support standard ClearType text and ClearType text with compatible widths. Compatible widths produce text in which the letters have the same spacing as non–ClearType text.
To display text in a ClearType font, call the CreateFontIndirect function and pass into this function a LOGFONT structure with the lfQuality member set to either CLEARTYPE_QUALITY or CLEARTYPE_COMPAT_QUALITY. The CLEARTYPE_QUALITY value produces standard ClearType text, while the CLEARTYPE_COMPAT_QUALITY value produces ClearType text with compatible widths.
ClearType can work poorly for some TrueType fonts. Be sure to test the fonts that you use for legibility when you enable ClearType for your application.
In addition to implementing ClearType, you can also improve the appearance of ClearType text by adjusting the gamma value. The gamma value controls the luminance generated on an LCD screen.To retrieve the current gamma correction value, call the SystemParametersInfo function with the uiAction parameter set to SPI_GETFONTSMOOTHINGCONTRAST. To set the gamma correction value, call SystemParametersInfo with uiAction set to SPI_SETFONTSMOOTHINGCONTRAST and the pvParam parameter set to a pointer to an unsigned integer that contains the desired gamma correction value.