I am using the MS Rich Edit Control in my MFC Visual C++ application. Users can select certain symbols to insert into the text. I have had complaints that when they try to insert certain characters into the text, it switches to a different font, which causes problems. I initially assumed that this must be because the character was not available in the current font. But that's not the case.
For testing purposes, I was using Tahoma as the default font in the control (which is also the default font used by my users). This was specified both in the Rich Text Format, and using SetDefaultCharFormat, and it works fine.
Here are 4 examples of characters which, when inserted, cause a font switch:
- Character Map code = U+2248 ("Almost equal to" - 2 wavy lines). If you insert this into the MS Rich Edit Control, it switches the font to "Cambria Math".
- Character Map code = U+25B2 ("Black up-pointing triangle"). If you insert this into the MS Rich Edit Control, it switches the font to "Segoe UI Symbol".
- Character Map code = U+2026 ("horizontal ellipsis"). If you insert this into the MS Rich Edit Control, it switches the font to "Segoe UI Symbol".
- Character Map code = U+0153 ("Latin small ligature Oe"). If you insert this into the MS Rich Edit Control, it switches the font to "Segoe UI Symbol".
In all cases except the last, you cannot change the font to anything else for this character. The control will just ignore the font change. The exception is the last one (U+0153). You can't stop it setting the font to "Segoe UI Symbol" when you insert it, but you can then set the font for that character back to Tahoma.
Bear in mind that all of these characters exist in Tahoma. All of them can be pasted into Notepad.
For interest, some of this behaviour also happens in Wordpad (which I presume uses the MS Rich Edit Control). If you copy-and-paste the U+25B2 character, for example (from Notepad), it goes in as Segoe UI Symbol. If you copy-and-paste the U+2248 character from Notepad into Wordpad, it goes in as Cambria Math. And in both cases, Wordpad ignored all my attempts to change the fonts for these characters to anything else.
Is this a bug in the MS Rich Edit control? Anyone from Microsoft care to comment?