- Use the Unicode RichEdit control instead of the MBCS version, so as to enforce the use

of code page 1252 for output text. This is noticeable, for example, with the FMOD copyright
  notice where the copyright symbol appears as ゥ (halfwidth katakana small U) with code page 932.

SVN r2177 (trunk)
This commit is contained in:
Randy Heit 2010-02-24 04:17:14 +00:00
parent ad54cfcf94
commit 0b2c2e1cb3
2 changed files with 8 additions and 5 deletions

View file

@ -422,7 +422,7 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
TEXTMETRIC tm; TEXTMETRIC tm;
HINSTANCE inst = (HINSTANCE)(LONG_PTR)GetWindowLongPtr(hWnd, GWLP_HINSTANCE); HINSTANCE inst = (HINSTANCE)(LONG_PTR)GetWindowLongPtr(hWnd, GWLP_HINSTANCE);
DRAWITEMSTRUCT *drawitem; DRAWITEMSTRUCT *drawitem;
CHARFORMAT2 format; CHARFORMAT2W format;
switch (msg) switch (msg)
{ {
@ -453,7 +453,7 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
SelectObject (hdc, oldfont); SelectObject (hdc, oldfont);
// Create log read-only edit control // Create log read-only edit control
view = CreateWindowEx (WS_EX_NOPARENTNOTIFY, RICHEDIT_CLASS, NULL, view = CreateWindowEx (WS_EX_NOPARENTNOTIFY, "RichEdit20W", NULL,
WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_VSCROLL |
ES_LEFT | ES_MULTILINE | WS_CLIPSIBLINGS, ES_LEFT | ES_MULTILINE | WS_CLIPSIBLINGS,
0, 0, 0, 0, 0, 0, 0, 0,
@ -476,8 +476,8 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
format.yHeight = 200; format.yHeight = 200;
format.crTextColor = RGB(223,223,223); format.crTextColor = RGB(223,223,223);
format.bPitchAndFamily = FF_SWISS | VARIABLE_PITCH; format.bPitchAndFamily = FF_SWISS | VARIABLE_PITCH;
strcpy(format.szFaceName, "DejaVu Sans"); // At least I have it. :p wcscpy(format.szFaceName, L"DejaVu Sans"); // At least I have it. :p
SendMessage (view, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&format); SendMessageW(view, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&format);
ConWindow = view; ConWindow = view;
ReleaseDC (hWnd, hdc); ReleaseDC (hWnd, hdc);

View file

@ -944,7 +944,10 @@ void I_PrintStr(const char *cp)
buf[bpos] = 0; buf[bpos] = 0;
if (edit != NULL) if (edit != NULL)
{ {
SendMessage(edit, EM_REPLACESEL, FALSE, (LPARAM)buf); wchar_t wbuf[countof(buf)];
MultiByteToWideChar(1252 /* Latin 1 */, 0, buf, bpos, wbuf, countof(wbuf));
wbuf[bpos] = 0;
SendMessageW(edit, EM_REPLACESEL, FALSE, (LPARAM)wbuf);
} }
if (StdOut != NULL) if (StdOut != NULL)
{ {