#821 – Use TextFormattingMode to Make Text Look More Clear

WPF tries to retain the exact shape and style of each glyph in a font, no matter what size the font is being rendered at.  This means that as the text gets smaller, relative to the pixel density of the display, the edges of the glyphs may no longer occur at pixel boundaries.  When this happens, WPF will use anti-aliasing to render the edges of the glyphs in a different color.  This can lead to small text looking fuzzy, or having some odd color fragments along the edges of the letters.

To avoid fuzzy text at small sizes, you can set the TextOptions.TextFormattingMode property to Display (as opposed to the default value of Ideal).  This tells WPF to align the glyphs at pixel boundaries, which can lead to crisper/cleaner text.

        <TextBlock Text="WiWi WIWI HaHaHa (Ideal = Default)"
        <TextBlock Text="WiWi WIWI HaHaHa (Display)"



About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

2 Responses to #821 – Use TextFormattingMode to Make Text Look More Clear

  1. Pingback: Dew Drop – May 16, 2013 (#1,548) | Alvin Ashcraft's Morning Dew

  2. Mike Ward says:

    Awesome tip. For small fonts, this really cleans things up.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: