Using TextOptions.TextFormattingMode with FormattedText
        Posted  
        
            by dan gibson
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by dan gibson
        
        
        
        Published on 2010-03-31T05:13:32Z
        Indexed on 
            2010/05/20
            20:30 UTC
        
        
        Read the original article
        Hit count: 394
        
With WPF4 you can have non-blurry text by adding TextOptions.TextFormattingMode="Display" and TextOptions.TextRenderingMode="Aliased" to your xaml:
<Window
   TextOptions.TextFormattingMode="Display"
   TextOptions.TextRenderingMode="Aliased">
This works fine for me except for when I draw text with DrawingContext.DrawText like this:
void DrawText(DrawingContext dc)
{
  FormattedText ft = new FormattedText("Hello World",
    System.Globalization.CultureInfo.CurrentCulture,
    System.Windows.FlowDirection.LeftToRight,
    new Typeface(FontFamily, FontStyle, FontWeight, FontStretch),
    FontSize,
    brush);
  dc.DrawText(ft, new Point(rect.Left, rect.Top));
}
How can I draw non-blurry text with FormattedText? ie I want TextOptions.TextFormattingMode="Display" and TextOptions.TextRenderingMode="Aliased" to be used.
© Stack Overflow or respective owner