Pasting CJK characters to a RichTextBox adds an unwanted second font

If you paste the below into a RichTextBox, the CJK character and everything afterwards turns into a second font - SimSun.

Inserting a CJK character: 色

...makes this font change.

This affects the formatting of the RichTextBox in an unwanted way, and also massively slows down large copy/pastes.

I have tried setting the RichTextBox to use a unicode font such as "Lucida Sans Unicode", and also made sure the source I was copying from (Wordpad) was also using the "Lucida Sans Unicode" font. However, at the end of the day, when I paste to the RichTextBox, it forces the use of another font such as SimSun (or other fonts like "Shonar Bangla" or "Microsoft Himalaya" if we use another type of character).

Since "Lucida Sans Unicode" has them all, why can't it stick to the one font?

I noticed someone else also has a similar problem: make a richtextbox only have one font, even if pasted into (vb.net)

Unfortunately, the solutions on that page didn't work for me as I still find the RTB uses another font after the CJK character.

Answers


Unfortunately despite its slightly confusing name, Lucida Sans Unicode doesn't contain CJK characters (as you could expect from fonts with Unicode in its name). This triggers some font fallback mechanism which results in a font that contains the required symbol. The only possible solution I see is to use a font that actually contains all required characters.


I've been having this problem on and off, myself.

After flipping around here and there on the internet today, I noticed something on msdn and tried something. Add this line to your Form1_Load(), or to the form constructor AFTER the InitializeComponent() line:

richTextBox1.LanguageOption = RichTextBoxLanguageOptions.DualFont;

I'm no expert, and I can't tell you anything about WHY it works but it DOES for me!


Need Your Help

Where to find gdb for an arm target running on linux 2.6.21.5-cfs-v19

linux gdb arm

I have a ARM11 based hardware board which runs a Linux kernel ver. 2.6.21.5-cfs-v19. I have my application running on this ARM-LINUX board. To do source level debugging, of my application I used to...

FormView or not?

asp.net vb.net data-binding wizard formview

I have an ASP.NET page with a Wizard control containing several pages of form fields. The data is collected and inserted to a database from the code behind page. I need to set this form up so you c...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.