ClearTypeHint: New WPF Feature

WPF enforces grayscale rendering when text is rendered its color and the color behind the text before creating the final glyph bitmap. However, the background color can sometimes be a very expensive process. For example, popups have rounded edges and will have the allowstransparency property set. In order to maintain acceptable performance, WPF disables ClearType when it encounters an element that could complicate this process.

Now in .NET 4, we provide the developer to decide whether to render with cleartype or not. The way to do this is to set the RenderOptions.ClearTypeHint property.

This forces the rendering engine to enable Cleartype whenever WPF reaches a node that introduces an intermediate texture that could be transparent. WPF disables ClearType when it detects that the buffer into which text is drawn could have a transparent background. However, you could easily enable it again. WPF needs to disable ClearType because the blending algorithm won't work with a transparent intermediate texture–it will produce visually incorrect results.  

Ebook Download
View all
Learn
View all