I know that there is a freetype library that can render a TrueType font to a dot-matrix character. Note, however, that the TrueType technology contains a number of Apple's technology patents (mainly to explain its hint code), and the current FreeType project leader has been notified by Apple that it is currently under negotiation to apply for Apple's patent license.
To avoid the patent problem, you have to hint, but this shows very poor results.
In fact, if only in Windows (whether Chinese or e), as long as the Chinese into a Unicode string (MultiByteToWideChar?), and then use the TEXTOUTW function output.
These functions are supported by either 95 or NT, as long as the corresponding fonts are installed. There is no need to explain TrueType yourself.
Grey Coat Monk: Is it? The patent issue has the company to consider!
The problem is converting to Unicode output in English I didn't succeed!
Used to be a master: How can you use CP_OEMCP?
Of course we have to fill in 936.
To use TEXTOUTW () explicitly, you cannot use DC. TextOut (), because the program is still compiled in a non-Unicode fashion.
wchar_t wstr[500];
int N=multibytetowidechar (936, mb_precomposed,
STR,-1, WSTR, 500);
TEXTOUTW (PDC->M_HDC, x, Y, wstr);
The system must have 936 code pages installed. How does it fit? The Cp_936.nls (VC + +) copy to Windows\System, and then in the registry
\hkey_local_machine\system\currentcontrolset\control\nls\codepage, plus 936 = "Cp_936.nls"
\hkey_local_machine_system\currentcontrolset\control\nls\locale, plus 00000804 = "Chinese (PRC)"
Gray Coat Monk: that's great! It worked! When you return home, monk must buy you a drink!
Code:
BOOL bResult = m_Font.CreateFont(-16,0,0,0,400,0,0,0,134,3,2,1,50,"SimSun");
char *pText = "Test汉字显示测试Test";
wchar_t wBuffer[256];
int nLength = MultiByteToWideChar(936, MB_PRECOMPOSED, pText, -1, wBuffer, 256);
CDC *pDC = GetDC();
CFont *pFontTemp = (CFont *)pDC->SelectObject(&m_Font);
TextOutW(pDC->m_hDC, 80, 80, wBuffer, nLength - 1);
pDC->SelectObject(pFontTemp);
ReleaseDC(pDC);