From 0b2c2e1cb35ea9260807de394baa5e9fd061c60b Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Wed, 24 Feb 2010 04:17:14 +0000 Subject: [PATCH] =?UTF-8?q?-=20Use=20the=20Unicode=20RichEdit=20control=20?= =?UTF-8?q?instead=20of=20the=20MBCS=20version,=20so=20as=20to=20enforce?= =?UTF-8?q?=20the=20use=20=20=20of=20code=20page=201252=20for=20output=20t?= =?UTF-8?q?ext.=20This=20is=20noticeable,=20for=20example,=20with=20the=20?= =?UTF-8?q?FMOD=20copyright=20=20=20notice=20where=20the=20copyright=20sym?= =?UTF-8?q?bol=20appears=20as=20=EF=BD=A9=20(halfwidth=20katakana=20small?= =?UTF-8?q?=20U)=20with=20code=20page=20932.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SVN r2177 (trunk) --- src/win32/i_main.cpp | 8 ++++---- src/win32/i_system.cpp | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/win32/i_main.cpp b/src/win32/i_main.cpp index 69b1ae7498..b52325972c 100644 --- a/src/win32/i_main.cpp +++ b/src/win32/i_main.cpp @@ -422,7 +422,7 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) TEXTMETRIC tm; HINSTANCE inst = (HINSTANCE)(LONG_PTR)GetWindowLongPtr(hWnd, GWLP_HINSTANCE); DRAWITEMSTRUCT *drawitem; - CHARFORMAT2 format; + CHARFORMAT2W format; switch (msg) { @@ -453,7 +453,7 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) SelectObject (hdc, oldfont); // 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 | ES_LEFT | ES_MULTILINE | WS_CLIPSIBLINGS, 0, 0, 0, 0, @@ -476,8 +476,8 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) format.yHeight = 200; format.crTextColor = RGB(223,223,223); format.bPitchAndFamily = FF_SWISS | VARIABLE_PITCH; - strcpy(format.szFaceName, "DejaVu Sans"); // At least I have it. :p - SendMessage (view, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&format); + wcscpy(format.szFaceName, L"DejaVu Sans"); // At least I have it. :p + SendMessageW(view, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&format); ConWindow = view; ReleaseDC (hWnd, hdc); diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index 6320c33f51..36524a0935 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -944,7 +944,10 @@ void I_PrintStr(const char *cp) buf[bpos] = 0; 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) {