wrong font in a RichTextBox importing from .rtf

Posted by giacomellow on Stack Overflow See other posts from Stack Overflow or by giacomellow
Published on 2010-06-14T13:07:41Z Indexed on 2010/06/14 13:12 UTC
Read the original article Hit count: 211

Filed under:
|
|

Hi all,

I'm developing a microsoft surface application using expression blend+vs 2008.

I have a RichTextBox that loads formatted text from an .rtf file. The text is formatted with uppecases, color, and specific font (helvetica-neue). When i load the text, it is displayed in the control with matching format (color and uppecase) but NOT matching font. it seems to use the standard Blend font (Thaoma).

the text is loaded with this function:

public static RichTextBox  SetRTFText(string text, RichTextBox richTextBox)
        {
            MemoryStream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(text));

            TextRange documentTextRange = new TextRange(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd);

            documentTextRange.Load(stream, DataFormats.Rtf );


            return richTextBox; 
        } 

thank you all!

© Stack Overflow or respective owner

Related posts about wpf

Related posts about expression-blend