Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: chrome/common/l10n_util_win.cc

Issue 92135: Use the default Windows UI fonts for Indian locales on Vista. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/app/resources/locale_settings_zh-TW.xtb ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/l10n_util.h" 5 #include "chrome/common/l10n_util.h"
6 #include "chrome/common/l10n_util_win.h" 6 #include "chrome/common/l10n_util_win.h"
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <windowsx.h> 9 #include <windowsx.h>
10 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 bool IsLocaleSupportedByOS(const std::wstring& locale) { 65 bool IsLocaleSupportedByOS(const std::wstring& locale) {
66 // Block Oriya on Windows XP. 66 // Block Oriya on Windows XP.
67 return !(LowerCaseEqualsASCII(locale, "or") && 67 return !(LowerCaseEqualsASCII(locale, "or") &&
68 win_util::GetWinVersion() < win_util::WINVERSION_VISTA); 68 win_util::GetWinVersion() < win_util::WINVERSION_VISTA);
69 } 69 }
70 70
71 bool NeedOverrideDefaultUIFont(std::wstring* override_font_family, 71 bool NeedOverrideDefaultUIFont(std::wstring* override_font_family,
72 double* font_size_scaler) { 72 double* font_size_scaler) {
73 // This is rather simple-minded to deal with the UI font size 73 // This is rather simple-minded to deal with the UI font size
74 // issue for some Indian locales (ml, bn, hi) for which the default 74 // issue for some Indian locales (ml, bn, hi) for which
75 // Windows fonts are too small to be legible. For those locales, 75 // the default Windows fonts are too small to be legible. For those
76 // IDS_UI_FONT_FAMILY is set to an actual font family to use while 76 // locales, IDS_UI_FONT_FAMILY is set to an actual font family to
77 // for other locales, it's set to 'default'. 77 // use while for other locales, it's set to 'default'.
78 std::wstring ui_font_family = GetString(IDS_UI_FONT_FAMILY); 78
79 int scaler100 = StringToInt(l10n_util::GetString(IDS_UI_FONT_SIZE_SCALER)); 79 // XP and Vista or later have different font size issues and
80 // we need separate ui font specifications.
81 int ui_font_family_id = IDS_UI_FONT_FAMILY;
82 int ui_font_size_scaler_id = IDS_UI_FONT_SIZE_SCALER;
83 if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) {
84 ui_font_family_id = IDS_UI_FONT_FAMILY_XP;
85 ui_font_size_scaler_id = IDS_UI_FONT_SIZE_SCALER_XP;
86 }
87
88 std::wstring ui_font_family = GetString(ui_font_family_id);
89 int scaler100 = StringToInt(l10n_util::GetString(ui_font_size_scaler_id));
80 if (ui_font_family == L"default" && scaler100 == 100) 90 if (ui_font_family == L"default" && scaler100 == 100)
81 return false; 91 return false;
82 if (override_font_family && font_size_scaler) { 92 if (override_font_family && font_size_scaler) {
83 override_font_family->swap(ui_font_family); 93 override_font_family->swap(ui_font_family);
84 *font_size_scaler = scaler100 / 100.0; 94 *font_size_scaler = scaler100 / 100.0;
85 } 95 }
86 return true; 96 return true;
87 } 97 }
88 98
89 void AdjustUIFont(LOGFONT* logfont) { 99 void AdjustUIFont(LOGFONT* logfont) {
(...skipping 11 matching lines...) Expand all
101 if (GetObject(GetWindowFont(hwnd), sizeof(logfont), &logfont)) { 111 if (GetObject(GetWindowFont(hwnd), sizeof(logfont), &logfont)) {
102 AdjustLogFont(ui_font_family, ui_font_size_scaler, &logfont); 112 AdjustLogFont(ui_font_family, ui_font_size_scaler, &logfont);
103 HFONT hfont = CreateFontIndirect(&logfont); 113 HFONT hfont = CreateFontIndirect(&logfont);
104 if (hfont) 114 if (hfont)
105 SetWindowFont(hwnd, hfont, FALSE); 115 SetWindowFont(hwnd, hfont, FALSE);
106 } 116 }
107 } 117 }
108 } 118 }
109 119
110 } // namespace l10n_util 120 } // namespace l10n_util
OLDNEW
« no previous file with comments | « chrome/app/resources/locale_settings_zh-TW.xtb ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698