| OLD | NEW |
| 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 "app/l10n_util.h" |
| 6 #include "chrome/common/l10n_util_win.h" | 6 #include "app/l10n_util_win.h" |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <windowsx.h> | 9 #include <windowsx.h> |
| 10 | 10 |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/win_util.h" | 12 #include "base/win_util.h" |
| 13 | 13 |
| 14 #include "grit/locale_settings.h" | 14 #include "grit/locale_settings.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 ui_font_family_id = IDS_UI_FONT_FAMILY_XP; | 84 ui_font_family_id = IDS_UI_FONT_FAMILY_XP; |
| 85 ui_font_size_scaler_id = IDS_UI_FONT_SIZE_SCALER_XP; | 85 ui_font_size_scaler_id = IDS_UI_FONT_SIZE_SCALER_XP; |
| 86 } | 86 } |
| 87 | 87 |
| 88 std::wstring ui_font_family = GetString(ui_font_family_id); | 88 std::wstring ui_font_family = GetString(ui_font_family_id); |
| 89 int scaler100 = StringToInt(l10n_util::GetString(ui_font_size_scaler_id)); | 89 int scaler100 = StringToInt(l10n_util::GetString(ui_font_size_scaler_id)); |
| 90 if (ui_font_family == L"default" && scaler100 == 100) | 90 if (ui_font_family == L"default" && scaler100 == 100) |
| 91 return false; | 91 return false; |
| 92 if (override_font_family && font_size_scaler) { | 92 if (override_font_family && font_size_scaler) { |
| 93 override_font_family->swap(ui_font_family); | 93 override_font_family->swap(ui_font_family); |
| 94 *font_size_scaler = scaler100 / 100.0; | 94 *font_size_scaler = scaler100 / 100.0; |
| 95 } | 95 } |
| 96 return true; | 96 return true; |
| 97 } | 97 } |
| 98 | 98 |
| 99 void AdjustUIFont(LOGFONT* logfont) { | 99 void AdjustUIFont(LOGFONT* logfont) { |
| 100 std::wstring ui_font_family; | 100 std::wstring ui_font_family; |
| 101 double ui_font_size_scaler; | 101 double ui_font_size_scaler; |
| 102 if (NeedOverrideDefaultUIFont(&ui_font_family, &ui_font_size_scaler)) | 102 if (NeedOverrideDefaultUIFont(&ui_font_family, &ui_font_size_scaler)) |
| 103 AdjustLogFont(ui_font_family, ui_font_size_scaler, logfont); | 103 AdjustLogFont(ui_font_family, ui_font_size_scaler, logfont); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void AdjustUIFontForWindow(HWND hwnd) { | 106 void AdjustUIFontForWindow(HWND hwnd) { |
| 107 std::wstring ui_font_family; | 107 std::wstring ui_font_family; |
| 108 double ui_font_size_scaler; | 108 double ui_font_size_scaler; |
| 109 if (NeedOverrideDefaultUIFont(&ui_font_family, &ui_font_size_scaler)) { | 109 if (NeedOverrideDefaultUIFont(&ui_font_family, &ui_font_size_scaler)) { |
| 110 LOGFONT logfont; | 110 LOGFONT logfont; |
| 111 if (GetObject(GetWindowFont(hwnd), sizeof(logfont), &logfont)) { | 111 if (GetObject(GetWindowFont(hwnd), sizeof(logfont), &logfont)) { |
| 112 AdjustLogFont(ui_font_family, ui_font_size_scaler, &logfont); | 112 AdjustLogFont(ui_font_family, ui_font_size_scaler, &logfont); |
| 113 HFONT hfont = CreateFontIndirect(&logfont); | 113 HFONT hfont = CreateFontIndirect(&logfont); |
| 114 if (hfont) | 114 if (hfont) |
| 115 SetWindowFont(hwnd, hfont, FALSE); | 115 SetWindowFont(hwnd, hfont, FALSE); |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 } // namespace l10n_util | 120 } // namespace l10n_util |
| OLD | NEW |