Unicode prog ?? - displaying Chinese in simple MFC program...
Hi,
I wrote some test code to see if I can display chinese character in a simple MFC dialog program.
I'm currently running in NT4.0 English version, VC++6.0. I've downloaded the "Ming" font from the HKC website. I've already installed the Visual unicode static and DLL library.
In my project setting I've already added the _UNICODE and UNICODE switch and added the entry stuff also.
I've use the Visual wizard to generate a simple dialog program. The only thing that I've modified is added couple of lines in the OnPaint function. Still it is not display the chinese character.
Hopefully, you can pinpoint the mistakes I've made. What else is missing that I need to do.
thx,
Jeff
CFont font;
VERIFY(font.CreateFont(
12, // nHeight
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_NORMAL, // nWeight
FALSE, // bItalic
FALSE, // bUnderline
0, // cStrikeOut
CHINESEBIG5_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
DEFAULT_QUALITY, // nQuality
DEFAULT_PITCH, // | FF_SWISS, // nPitchAndFamily
//_T(""))); // lpszFacename
_T("Ming"))); // lpszFacename
SetFont(&font);
CPaintDC dc(this); // device context for painting
TCHAR ss[] = {0x4000, 0x5000, 0x40, 0x0000};
dc.TextOut(10, 10,ss, 2);
SetWindowText(ss);
If you are going to use Far East character, then
Well, what I am saying here will at least cope with Far-East language:
If you have installed that kinds of language in your Win2k, you will have a font called "SimSun" in yr font folder. Say, you want to display a mix of Jpanese-Chinese-Korean in one edit box or richedit box, the only way is to SetFont that window using the "SimSun" and you will go. Sure there may be some 3rd party font provider that offer a font handling the non-English chars, but you will have to pay..
You can find an example of my article in codeguru here:
http://www.codeguru.com/system/KeyLoggerMore2.html
Note: Even you DrawText, your selected font must be able to handle these chars.
Help this help