Re: MFC application textbox input overflow on Japanese Windows 2000
In Windows 2000 the default font is MS UI Gothic, which contains Japanese
characters, and agrees with the results that you found. However, the
default font size is usually 9 not 12.
Now I will guess that you got 12 because the display is set to a high dpi or
because a user assistance feature is set for large fonts. Next, I will
guess that Windows 2000 doesn't fully support its own options, so the
textbox gets confused. If your program works correctly in Windows XP then I
really think this is a Windows 2000 problem.
When you set the font to Arial I think you will have other problems. The
Arial Unicode font includes Japanese characters but plain Arial doesn't.
You say you only typed a string of English characters so you didn't see
additional problems, but your customers might type Japanese characters.
Also you need to take care with your textbox size of 30 characters. Since
you're building in ANSI instead of Unicode, you need to provide 60 bytes to
handle all possibilities of 30 characters, plus one more byte for a null
terminator.
<ningjun.wang@lexisnexis.com> wrote in message
news:1189442209.829192.306550@r34g2000hsd.googlegroups.com...
I print out the font as follow:
CFont* font = m_classEdit.GetFont();
if (font) {
LOGFONT lf;
font->GetLogFont(&lf);
ErrorReporter::messageFormat("%s %d %d", lf.lfFaceName, lf.lfHeight,
lf.lfWidth);
}
On English XP, it shows
"MS Shell Dlg -11 0"
On Japanese Windows 2000, it shows
"MS UI Gothic -12 0"
I also try to set the font of the textbox to Arial as follow
CFont* s_pFont = new CFont();
s_pFont->CreatePointFont(100, "Arial");
m_classEdit.SetFont(s_pFont);
CFont* font = m_classEdit.GetFont();
if (font) {
LOGFONT lf;
font->GetLogFont(&lf);
ErrorReporter::messageFormat("%s %d %d", lf.lfFaceName, lf.lfHeight,
lf.lfWidth);
}
Now on both English and japanese Windows, it shows
"Arial -10 0"
But still text overflow to the next line outside the textbox on
Japanese Windows. Not problem on English Windows.