WPF and Text Blurriness, now with complete Clarity
The #1 complaint I hear about WPF (Windows Presentation Foundation) is that many fonts end up looking "blurry." It's a darned shame because really great applications like Evernote get criticized because of this one issue*.
The blurriness happens on .NET 3.5 and below because WPF's graphics system is "device independent" so rendering happens independent of resolution. It makes apps DPI-aware for free and scales them nicely. Unfortunately MOST people are running on 96dpi screens and that's where you'd expect clarity. You can get around this 90% of the time today using SnapsToDevicePixels when appropriate, but it wasn't automatic and it's subtle.
The good news is that with .NET 4 this is totally fixed. You can see with with the .NET 4 RC (Release Candidate) and VS2010, which uses WPF for much of its own rendering. Additionally, a check-in in a recent milestone makes things even clearer with light text on a dark background.
From the WPF Text Blog:
"With this fixed, WPF is not technically pixel perfect with GDI text rendering, but the difference is indiscernible to the naked eye."
So how indiscernible?
UPDATE: A little confusion about this in the comments. Folks feel very strongly about this stuff, understandably. Just like color blindness, some people are sensitive to this stuff and others "can't see it." One person in the blogs didn't like go for "indiscernible" and showed a screenshot. Here's the deal. If you are running VS2010 RC, you don't have this fix. This will be in the RTM. Here's a 100% screenshot, followed by the zoomed in version. The takeaway is this. If you didn't like the rendering before, you will now. This is/was some subtle stuff, but it's indiscernible in the RTM, so be happy! I took the screenshot from a daily build, not the actual RTM, which hasn't happened yet.
Blown up:
Click on these side-by-side images from the WPF Text Blog to enlarge and compare. VS2008 with GDI rendering is on the left and VS2010 (a post RC-build) with this fix is on the right. Of course, the release of .NET 4 will have this fix.
In the comments on the WPF Text Blog, Rick Brewster, the author of Paint.NET suggests that we can really analyze these images using an XOR in Paint.NET.
I've done just that here, taking the dark text on a white background and XORing it. Then, for visibility, I've inverted the result. This shows just the differences in pixels between the two rendering paths. Can't see much? That's the point.
To quote from the WPF Blog comments: "If you can’t tell a difference between the screenshots of VS2008 and VS2010, then you should not be able to tell the difference between GDI and another WPF app."
Also, note that this applies to all WPF apps on .NET 4. It's a general fix that's not VS2010 specific. Enjoy. I'll be happy when this is out and everyone's using it, including my favorite WPF app, Evernote.
* I don't know anyone at Evernote, I'm just a fan and I read the comments on their blog. I speak only for me on this issue.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.



About Newsletter