I set the font linking to SimSun for my fonts at Window registry.
When I apply that font to my richedit control, it have below behavior:
- First, it display SimSun - ok
- When I add text that is not CKJ unicode, then add more text in CKJ, the font window selected is Microsoft Ya Hei instead of SimSun
Here is screenshot:
The fonts are:
- "阿哥": SimSun
- "◎": Segoe UI Symbol
- "[āgē] đại ca" Arial
- "对兄长的称呼。" Microsft Ya Hei
How I can force window to choose SimSun instead of Microsft Ya Hei in this case?
EDIT
Thank @Cody Gray for perfect answer. Here is worked code:
CHARFORMAT2 cf2;
memset(&cf2, 0, sizeof(CHARFORMAT2));
cf2.cbSize = sizeof(CHARFORMAT2);
cf2.dwMask = CFM_FACE | CFM_SIZE | CFM_CHARSET | CFM_LCID;
cf2.lcid = 0x0804;
cf2.yHeight = 280;
cf2.bCharSet = CHINESEBIG5_CHARSET;
wcscpy(cf2.szFaceName, L"SimSun");
SendMessage(rtbhWnd, EM_SETCHARFORMAT, SCF_SELECTION | SCF_ASSOCIATEFONT, (LPARAM)&cf2);
cf2.cbSize = sizeof(CHARFORMAT2);
cf2.dwMask = CFM_FACE | CFM_SIZE | CFM_CHARSET | CFM_LCID;
cf2.lcid = 0x0409;
cf2.yHeight = 220;
cf2.bCharSet = ANSI_CHARSET;
wcscpy(cf2.szFaceName, L"Segoe UI");
SendMessage(rtbhWnd, EM_SETCHARFORMAT, SCF_SELECTION | SCF_ASSOCIATEFONT2, (LPARAM)&cf2);