I have checked Scintilla Asian string display question in Windows 9x
English.
Here is the solution, but there are still some questions.
In PlatWin.cxx SurfaceImpl::DrawTextNoClip, DrawTextClipped,
DrawTextTransparent, and ListBoxX::Draw,
it uses ExtTextOut and DrawText API call.
For example:
void SurfaceImpl::DrawTextNoClip(...){
...
if (unicodeMode) {
wchar_t tbuf[MAX_US_LEN];
int tlen = UCS2FromUTF8(s, len, tbuf,
sizeof(tbuf)/sizeof(wchar_t)-1);
tbuf[tlen] = L'\0';
::ExtTextOutW(hdc, rc.left, ybase, ETO_OPAQUE, &rcw, tbuf, tlen,
NULL);
} else {
------> Original v1.66 code
//::ExtTextOut(hdc, rc.left, ybase, ETO_OPAQUE, &rcw, s,
// Platform::Minimum(len, maxLenText), NULL);
------> My testing code
// You should get the codepage from Scintilla Window
int CodePage = 936; // Chinese codepage
wchar_t tbuf[MAX_US_LEN];
int wStrSize=MultiByteToWideChar(CodePage, 0, s, -1, NULL, 0);
MultiByteToWideChar(CodePage, 0, s, -1, tbuf, wStrSize);
::ExtTextOutW(hdc, rc.left, ybase, ETO_OPAQUE, &rcw, tbuf,
wStrSize, NULL);
------> My testing code end
}
}
The original ExtTextOutA and DrawTextA cannot display the Asian string in
English 9x OS.
The solution is use ExtTextOutW.
ExtTextOutW and TextOutW can be used in 9x OS for Unicode output. (But
DrawTextW cannot.)
After replacing the original "ExtTextOut" with "ExtTextOutW" with Unicode
string convertion,
the Chinese text file can be displayed normally except the following
question:
1. The cursor move is incorrect, sometimes jump two Chinese words (four
bytes);
2. The text cannot be selected.
3. When selecting, the string will be refreshed and changed.
4. What's the function of ListBoxX::Draw?
The "DrawText" should be changed to "ExtTextOut" or "TextOut".
"DrawTextW" cannot work in 9x.
5. How to get the codepage in SurfaceImpl class?
BTW: Can this mail list post the attachment?
If possible, I may post the updated PlatWin.cxx file.
Jeffrey Ren
_________________________________________________________________
免费下载 MSN Explorer: http://explorer.msn.com/lccn/
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest