summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-22 09:19:37 +0000
committerhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-22 09:19:37 +0000
commite03c4449ca8590e190e7432f7fe35e0c240e1cf9 (patch)
tree645247a477cb3329f08577baf911dcace713421e /chrome/browser
parent8819206f48b04c853ab9a05e6cf3161370780b19 (diff)
downloadchromium_src-e03c4449ca8590e190e7432f7fe35e0c240e1cf9.zip
chromium_src-e03c4449ca8590e190e7432f7fe35e0c240e1cf9.tar.gz
chromium_src-e03c4449ca8590e190e7432f7fe35e0c240e1cf9.tar.bz2
A quick fix for Issue 3803.
I noticed a Font dialog used the system locale (not the application locale) to display the localzed font name of a CJK font, i.e. we can retrieve this localized font name with a GetTextFace() call. This change just retrieves the localized font name of the given font with a GetTextFace() call before initializing a CHOOSEFONT object. BUG=3803 <http://crbug.com/3803> TEST=run Chrome on Simplified Chinese XP; open the "Fonts and Languages" dialog;click the "Change" for "Sans-Serif Font", and; verify its "font" editbox shows the localized font-name of "simsun". Review URL: http://codereview.chromium.org/119416 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18901 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/views/shell_dialogs_win.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/chrome/browser/views/shell_dialogs_win.cc b/chrome/browser/views/shell_dialogs_win.cc
index b476f61..df15034 100644
--- a/chrome/browser/views/shell_dialogs_win.cc
+++ b/chrome/browser/views/shell_dialogs_win.cc
@@ -676,6 +676,23 @@ void SelectFontDialogImpl::ExecuteSelectFontWithNameSize(
font_name.c_str());
LOGFONT logfont;
GetObject(hf, sizeof(LOGFONT), &logfont);
+ // Retrieve the localized face name of the above font and update the LOGFONT
+ // structure. When a font has a localized name matching to the system locale,
+ // GetTextFace() returns the localized name. We should pass this localized
+ // name to ChooseFont() so it can set the focus.
+ HDC memory_dc = CreateCompatibleDC(NULL);
+ if (memory_dc) {
+ wchar_t localized_font_name[LF_FACESIZE];
+ HFONT original_font = reinterpret_cast<HFONT>(SelectObject(memory_dc, hf));
+ int length = GetTextFace(memory_dc, arraysize(localized_font_name),
+ &localized_font_name[0]);
+ if (length > 0) {
+ memcpy(&logfont.lfFaceName[0], &localized_font_name[0],
+ sizeof(localized_font_name));
+ }
+ SelectObject(memory_dc, original_font);
+ DeleteDC(memory_dc);
+ }
CHOOSEFONT cf;
cf.lStructSize = sizeof(cf);
cf.hwndOwner = run_state.owner;