Chromium Code Reviews| Index: webkit/glue/webpreferences.cc |
| diff --git a/webkit/glue/webpreferences.cc b/webkit/glue/webpreferences.cc |
| index 42eb5133443f4a98c752ffbd477549ffc7512d59..8d6ae29dea6750c8de7d455af90a280afba9fa52 100644 |
| --- a/webkit/glue/webpreferences.cc |
| +++ b/webkit/glue/webpreferences.cc |
| @@ -5,6 +5,7 @@ |
| #include "webkit/glue/webpreferences.h" |
| #include <unicode/uchar.h> |
| +#include <unicode/uscript.h> |
| #include "base/string_util.h" |
| #include "base/utf_string_conversions.h" |
| @@ -25,14 +26,12 @@ using WebKit::WebString; |
| using WebKit::WebURL; |
| using WebKit::WebView; |
| +namespace { |
| +const char* kCommonScript = uscript_getShortName(USCRIPT_COMMON); |
|
tony
2012/05/09 17:11:15
This one is correct :)
|
| +} |
| + |
| WebPreferences::WebPreferences() |
| - : standard_font_family(ASCIIToUTF16("Times New Roman")), |
| - fixed_font_family(ASCIIToUTF16("Courier New")), |
| - serif_font_family(ASCIIToUTF16("Times New Roman")), |
| - sans_serif_font_family(ASCIIToUTF16("Arial")), |
| - cursive_font_family(ASCIIToUTF16("Script")), |
| - fantasy_font_family(), // Not sure what to use on Windows. |
| - default_font_size(16), |
| + : default_font_size(16), |
| default_fixed_font_size(13), |
| minimum_font_size(0), |
| minimum_logical_font_size(6), |
| @@ -105,6 +104,18 @@ WebPreferences::WebPreferences() |
| per_tile_painting_enabled(false), |
| css_regions_enabled(false), |
| css_shaders_enabled(false) { |
| + standard_font_family_map[kCommonScript] = |
| + ASCIIToUTF16("Times New Roman"); |
| + fixed_font_family_map[kCommonScript] = |
| + ASCIIToUTF16("Courier New"); |
| + serif_font_family_map[kCommonScript] = |
| + ASCIIToUTF16("Times New Roman"); |
| + sans_serif_font_family_map[kCommonScript] = |
| + ASCIIToUTF16("Arial"); |
| + cursive_font_family_map[kCommonScript] = |
| + ASCIIToUTF16("Script"); |
| + fantasy_font_family_map[kCommonScript] = |
| + ASCIIToUTF16("Impact"); |
| } |
| WebPreferences::~WebPreferences() { |
| @@ -166,12 +177,6 @@ void ApplyFontsFromMap(const WebPreferences::ScriptFontFamilyMap& map, |
| void WebPreferences::Apply(WebView* web_view) const { |
| WebSettings* settings = web_view->settings(); |
| - settings->setStandardFontFamily(standard_font_family); |
| - settings->setFixedFontFamily(fixed_font_family); |
| - settings->setSerifFontFamily(serif_font_family); |
| - settings->setSansSerifFontFamily(sans_serif_font_family); |
| - settings->setCursiveFontFamily(cursive_font_family); |
| - settings->setFantasyFontFamily(fantasy_font_family); |
| ApplyFontsFromMap(standard_font_family_map, setStandardFontFamilyWrapper, |
| settings); |
| ApplyFontsFromMap(fixed_font_family_map, setFixedFontFamilyWrapper, settings); |