How can WPF RIchtextbox display Unicode? - wpf

I use the WPF RichTexBox control in WPF project. The problem I get stuck in is it cannot display the unicode as the System.Windows.Forms.RichTextbox in Win Project.
E.g : When I copy a paragraph of Chinese language and paste it to the WPF Richtextbox. The font is break and it cannot display. But when I use System.Windows.Forms.RichTextbox control then I display ok.
So, how can I resolve this problem in WPF project.

I would guess that you're using a font that doesn't support Unicode. Try making sure you're using a Unicode-capable font to display the Chinese characters. (If you don't know, try a few common fonts, like Tahoma, in wordpad.)

Related

Some custom fonts are not showing in Silverlight

I'm using Visual Studio 2010.
I want to build an application displaying some text with custom fonts.
All the fonts are TrueType fonts, with the editable attribute, and are declared as resource with "Copy Always".
But, even at design time, some fonts are replaced by the standard Silverlight font, in the XAML editor.
For example I have 14 different versions of the Helvetica font (bold, oblique, italic, narrow, condensed... and mix of those). But only 3 are correctly displayed, others are using the fallback font. If I open the ttf files with the windows font preview application everything looks ok.
Any idea of what can be wrong ?
Thanks for your help.
After two months of hair pulling I've finally come with a simple solution :
Don't use - (dash) in your embedded font names
I hope it can help somebody.

Displaying text and image (RTF) data in WPF & Silverlight

In our app (Silverlight 5 and WPF) we are looking to put in a help section. The help section will contain simple text and images so thought RTF would be perfect for this. On closer inspection it seems Silverlight doesnt support RTF documents.
What other method could we use to display formatted text / images in both Silverlight and WPF that would allow the content to be generated by a supports person (i.e. no coding knowledge required)

Custom Font in WP7 silverlight app

I have an issue, I tried to load a custom font in wp7 silverlight app for my buttons, and it worked nicely. This font supports greek language in word, photoshop etc. But in expression blend or in visual studio when i change the content of the button in greek word then the button fontfamily loads in default font. Why is this happening?
It sounds as though you aren't loading the font correctly.
What are you actually doing. (Show the code. Don't just describe it.)

Is it possible to install different fonts on windows phone 7 emulator?

I made a demo application using Silverlight where I have given certain Unicode of Hindi language to be displayed on a textbox as a text. ऋ ऊ उ ई इ आ, unicode positions are '\u090B', '\u090A', '\u0909', '\u0908', '\u0907','\u0906' respectively.
So when I pass this whole thing as a string to the textbox.text property it shows at the debug time as the exact value is to the textbox but when I go through the emulator the display shows empty boxes.
Is this require installation of different fonts on emulator? If so then how can I do this? Is it possible to build an application for Windows Phone 7 which can support different languages?
You can embed fonts in your WP7 applications in the same way that you embed fonts for any Silverlight application as decribed in the Embedding fonts in Silvelright blog post by Paul Yanez. You simply check the Embed checkbox in the Text pane in Expression Blend.
NOTE: You will need to make sure that you are licensed to use the font in this way or that it is free for use in this way.

How to list monospace (fixed-width) fonts in WPF

I need to add font chooser to my WPF text editor. I'm adapting this font chooser.
However, it lists all the installed fonts. I only need a list of fixed-width (monospace) fonts.
How do I check if a given System.Windows.Media.FontFamily is a fixed-width font?
There is a solution that uses System.Drawing.FontFamily but those fonts are not exactly compatible with WPF and the code I'm adapting uses System.Windows.Media.FontFamily.
Maybe you can filter the System.Windows.Media.FontFamily list by creating a System.Drawing.Font with the same name and use inteop and LOGFONT from there.
This is a horrible hack but I believe it will work in most cases (if you only use fonts installed on the system the System.Windows.Media.FontFamily and System.Drawing.FontFamily lists should mostly match)
Using something like this to get font sizing information or information about advanced font properties would be completely useless due to the differences in the font renderer between WPF and GDI - but for basic properties of the font like being fixed-width I expect this should work.

Resources