How can you fix WPF’s small-text display problem?

So how can you fix WPF’s small-text display problem? The best solution is to scale up your text (on a 96 dpi monitor, the effect should disappear at a text size of about 15 device-independent units) or use a highdpi monitor that has enough resolution to show sharp text at any size. But because these options often aren’t practical, WPF also has the ability to selectively use GDI-like text rendering.
To use GDI-style text rendering, you add the extOptions.TextFormattingMode attached property to a text-displaying element such as the TextBlock or Label, and set it to Display (rather than the standard value, Ideal). Here’s an example:
<textblock fontsize="12" margin="5">
This is a Test. Ideal text is blurry at small sizes.
</textblock>
It’s important to remember that the TextFormattingMode property is a solution for small text only. If you use it on larger text (text above 15 points), the text will not be as clear, the spacing will not be as even, and the typeface will not be rendered as accurately. And if you use text in conjunction with a transform (discussed in Chapter 12) that rotates, resizes, or otherwise changes its appearance, you should always use
WPF’s standard text display mode. That’s because the GDI-style optimization for display text is applied before any transforms. After a transform is applied, the result will no longer be aligned on pixel boundaries, and the text will appear blurry.

댓글

이 블로그의 인기 게시물

Oracle NLS_DATE_FORMAT 변경

Stop console process using Ctrl+C.

Alternative to IValueConvert, QuickConverter