WPF Blurry fonts issue- Solutions

2019-01-01 09:44发布

Problem is described and demonstrated on the following links:

Explanation: Text Clarity in WPF. This link has font comparison.

I would like to collect all possible solutions for this problem. Microsoft Expression Blend uses WPF but fonts look readable.

  • Dark background as in Microsoft Expression Blend
  • Increasing the font size and changing the font (Calibri ... ) [link]
  • Embed windows forms [link]
  • Use GDI+ and/or Windows Forms TextRenderer class to render text to a bitmap, and then render that bitmap as a WPF control. [link]

Are there any more solutions?

This is going to be fixed in VS2010 (and WPF4) beta 2

WPF 4.0 Text Stack Improvements

IT LOOKS LIKE IT HAS BEEN FINALLY SOLVED !

Scott Hanselman's ComputerZen.com: WPF and Text Blurriness, now with complete Clarity
WPF Text Blog: Additional WPF Text Clarity Improvements

标签: wpf fonts
10条回答
何处买醉
2楼-- · 2019-01-01 10:20

From a developer's point, the only known "workaround" to date is to use GDI+ and/or Windows Forms TextRenderer class to render text to a bitmap, and then render that bitmap as a WPF control. Aside from obvious performance implications, this doesn't alleviate the problem for existing applications.

I have now created a Microsoft Connect ticket for this issue (to my surprise, despite all the negativity, there was no actual bug report in the designated tracker).

Since that is one of the official channels of communicating requests and questions to Microsoft, I would advise also going through it for a quicker answer. At least, if you wish for the issue to be addressed one way or another, voting for that ticket there and/or validating the issue will help to draw the attention of Microsoft PMs and engineers to this problem, and possibly raise its perceived priority.

查看更多
宁负流年不负卿
3楼-- · 2019-01-01 10:23

Just tried out VS2010 beta, which is all done in WPF, and it suffers BADLY from the blurry-font issue. Particularly on tooltips.

That seems to give some evidence that WPF4 will in fact not solve the problem (if anything it looks worse)

查看更多
柔情千种
4楼-- · 2019-01-01 10:23

I don't see it as a bug, but the default configuration is indeed very annoying. Here's a comparision of all the combinations of

TextOptions.TextRenderingMode
TextOptions.TextFormattingMode
RenderOptions.ClearTypeHint

SnapToDevicePixels doesn't make any differente in text rendering.

http://i.stack.imgur.com/cS3S2.png

I prefer:

TextOptions.TextRenderingMode="Auto"
TextOptions.TextFormattingMode="Ideal"
RenderOptions.ClearTypeHint="Auto"

where vertical lines are never blurry.

The font used is Open Sans Light, that can be really beautifull if it's well used, like in latest TeamViewer.

For those using Mahapps.Metro, the problem is the TransitioningContentControl https://github.com/MahApps/MahApps.Metro/issues/889

查看更多
无与为乐者.
5楼-- · 2019-01-01 10:23

They say "SnapToDevicePixels = true" works, but I've never seen any good results.

I combat the blurred text by switching to a different font.

Obviously this is not a solution to the problem, however this is how I've worked around it.

查看更多
像晚风撩人
6楼-- · 2019-01-01 10:25

Wow, I can't believe I finally got my WPF fonts readable. And I also can't believe there is no option dialog to make these changes easy while the default values are horrible on my display.

These registry settings (in decimal) worked for me and come closest to my regular cleartype font:

  • ClearTypeLevel: 10 (mostly greyscale aliasing)
  • GammaLevel: 1300 (higher gamma made the font too thin and I was seeing the colors in the aliasing)
查看更多
余生无你
7楼-- · 2019-01-01 10:27

This is going to be fixed in VS2010 (and WPF4) beta 2:

查看更多
登录 后发表回答