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

Unified Diff: chrome/browser/ui/prefs/prefs_tab_helper.cc

Issue 346763011: Merge 279449 "Use Consolas for Windows 7 and above as default mo..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/2062/src/
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/app/resources/locale_settings_win.grd ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/prefs/prefs_tab_helper.cc
===================================================================
--- chrome/browser/ui/prefs/prefs_tab_helper.cc (revision 279858)
+++ chrome/browser/ui/prefs/prefs_tab_helper.cc (working copy)
@@ -34,6 +34,10 @@
#include "chrome/browser/themes/theme_service_factory.h"
#endif
+#if defined(OS_WIN)
+#include "base/win/windows_version.h"
+#endif
+
using content::WebContents;
DEFINE_WEB_CONTENTS_USER_DATA_KEY(PrefsTabHelper);
@@ -124,6 +128,17 @@
}
#endif // !defined(OS_ANDROID)
+#if defined(OS_WIN)
+// On Windows with DirectWrite we want to use an alternate fixed font like
+// Consolas, which looks much better than Courier New.
+bool ShouldUseAlternateDefaultFixedFont() {
+ UINT smooth_type = 0;
+ SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, &smooth_type, 0);
+ return (base::win::GetVersion() >= base::win::VERSION_WIN7) &&
+ (smooth_type == FE_FONTSMOOTHINGCLEARTYPE);
+}
+#endif
+
struct FontDefault {
const char* pref_name;
int resource_id;
@@ -454,7 +469,15 @@
std::set<std::string> fonts_with_defaults;
UScriptCode browser_script = GetScriptOfBrowserLocale();
for (size_t i = 0; i < kFontDefaultsLength; ++i) {
- const FontDefault& pref = kFontDefaults[i];
+ FontDefault pref = kFontDefaults[i];
+
+#if defined(OS_WIN)
+ if (pref.pref_name == prefs::kWebKitFixedFontFamily) {
+ if (ShouldUseAlternateDefaultFixedFont())
+ pref.resource_id = IDS_FIXED_FONT_FAMILY_ALT_WIN;
+ }
+#endif
+
UScriptCode pref_script = GetScriptOfFontPref(pref.pref_name);
// Suppress this default font pref value if it is for the primary script of
« no previous file with comments | « chrome/app/resources/locale_settings_win.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698