Partager via


Working with ClearType Fonts

Windows CE .NET includes 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 platforms support ClearType.

ClearType can be enabled system-wide or on a per-application basis. 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.

ClearType on Windows CE-based devices implements only a vertical striping algorithm. When the screen is rotated, it will still display ClearType using the vertical striping algorithm. ClearType is available in all orientations. Legibility is not compromised by using vertical striping on horizontal striped devices. For example, ClearType works well in the tablet PC devices.

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 CE supports ClearType only for display devices with color depths of 8, 16, 24, or 32 bits per pixel (bpp). The Windows CE implementation of ClearType can use subpixels contained either in vertical stripes or in horizontal stripes to provide ClearType support even when the screen is rotated.

Windows CE supports 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.

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.

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.

See Also

Fonts | How to Implement ClearType

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.