15.6. Text-Rendering Improvements

In previous releases of WPF, text could sometimes appear a bit blurry. This is fixed in WPF 4.0 (possibly driven by the need for clear text in the VS2010 IDE), and you now have much finer-grained control over how text is rendered with the new TextFormattingMode and TextRenderingMode properties.

15.6.1. TextOptions.TextFormattingMode

TextFormatting mode allows you to set the text metrics that WPF will use for formatting text. TextFormatting mode has two settings:

  • Ideal (as per previous versions)

  • Display (ensures that every glyph's position and width is not fractional, which is very similar to how the GDI renders text)

The following code demonstrates setting text to use the Display setting:

<TextBlock TextOptions.TextFormattingMode="Display"> ...

Get Introducing .NET 4.0: with Visual Studio 2010 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.