wrong font in a RichTextBox importing from .rtf
- by giacomellow
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!