New WPF Features: TextFormattingMode for clear text

This is part of a series on New WPF Features

Now there has been feedback since 3.0 that the WPF text doesnt render clearly when the fontsizes are smaller. So for .NET 4 we forked on this issue and fixed it by introducind the property TextOptions.TextFormattingMode. The default value is ideal which is what we have currently. The other option is Display and it makes small text look crisper and clear.

Lets see it in action

<StackPanel xmlns=’’


            <TextBox TextOptions.TextFormattingMode=”Ideal” FontSize=”10″>HELLO WORLD</TextBox>

            <TextBox TextOptions.TextFormattingMode=”Display” FontSize=”10″>HELLO WORLD</TextBox>


            <TextBox TextOptions.TextFormattingMode=”Ideal” FontSize=”15″>HELLO WORLD</TextBox>

            <TextBox TextOptions.TextFormattingMode=”Display” FontSize=”15″>HELLO WORLD</TextBox>


See the difference 🙂 … also for asian characters the difference is very evident ..

Guidelines for this property 


Recommended Mode

Large Text (15pt+)

Ideal \ Display (users preference)

Transformed Text


Zoomed Text


Design Scenarios


Small Text


Share this post


Comments (9)

  1. ray says:

    Why not call it TextRenderingMode? Formatting sounds like some options for doing something like Console.WriteLine("Hello, {0}!", "Bob")..

  2. Graeme says:

    I agree that calling it formatting is a little misleading.  It is a great feature though, thanks for the post!

  3. John Goldsmith says:

    Hi Lester,

    Are you saying that 14pt and below is ‘small’ text and so should be set to ‘Display’?

    If the default is ‘Ideal’ could you implement some kind of implicit (app level) style to trigger to ‘Display’ if less than 15pt?



  4. llester says:

    John, currently we do not support the implicit switching.

    RayGraeme, thanks for the feedback on the naming.

    Your feedback will be conveyed to the respective teams for consideration.

  5. John says:

    I wholeheartedly agree with Ray and Graeme, having the word ‘Formatting’ in the name is very misleading.  TextRenderingMode is a much better name for this property.

  6. Brad says:

    I agree with previous posters about the naming. Also, is there a good explanation on why font rendering in WPF is so hard (from your perspective). There are lots of annoying issues with text rendering in WPF (this being on of them) and I am wondering why text rendering is so poor.

    Don’t get me wrong I love WPF, and the text rendering isn’t a major stumbling block for me, but it does seem odd that there are so many problems with it.

  7. dennis says:

    TextFormatting mode refers to how TextFormatter is created. It is happening before rendering. (

    Before dotnet 4.0, WPF uses ideal metric layout which preserves the shape of all glyphs even if this means not starting and/or ending a glyph on a pixel boundary (subpixel). This causes poor rendering results on the screen particularly for smaller text.

    For 4.0, we’re introducing GDI compatiable way of creating TextFormatter (Display mode) besides the existing Ideal mode. GDI uses a text layout algorithm that slightly modifies glyph width and placement to make sure that glyphs start and end on pixel boundaries. This improves the clarity of each letter yet detracts from the ascetics of a carefully constructed font.

    For rending, we’ll have three text rendering mode. They are ClearType, Grayscale, and Aliased. You can set it using the same logic TextOptions.TextRenderingMode="".

    For more details, you can read

  8. ray says:

    My bad. Thank you for your explanation Dennis. It’s a nice feature. I’m always happy to know things are improving. Just expecting some magic..

  9. dennis says:

    No problem. It’s great to have you guys:).