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

Unified Diff: webkit/glue/webpreferences.cc

Issue 10532105: Use ICU script code "Jpan" instead of "Hrkt" in Japanese pref names (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 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/common/pref_names.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webpreferences.cc
diff --git a/webkit/glue/webpreferences.cc b/webkit/glue/webpreferences.cc
index 8160befb1a6ee568e3bff933afe15d91555e4b73..2e23c1b254d7270d134df2e59b2f17f5217b4cd0 100644
--- a/webkit/glue/webpreferences.cc
+++ b/webkit/glue/webpreferences.cc
@@ -175,14 +175,38 @@ void setFantasyFontFamilyWrapper(WebSettings* settings,
typedef void (*SetFontFamilyWrapper)(
WebKit::WebSettings*, const string16&, UScriptCode);
+// If |scriptCode| is a member of a family of "similar" script codes, returns
+// the script code in that family that is used by WebKit for font selection
+// purposes. For example, USCRIPT_KATAKANA_OR_HIRAGANA and USCRIPT_JAPANESE are
+// considered equivalent for the purposes of font selection. WebKit uses the
+// script code USCRIPT_KATAKANA_OR_HIRAGANA. So, if |scriptCode| is
+// USCRIPT_JAPANESE, the function returns USCRIPT_KATAKANA_OR_HIRAGANA. WebKit
+// uses different scripts than the ones in Chrome pref names because the version
+// of ICU included on certain ports does not have some of the newer scripts. If
+// |scriptCode| is not a member of such a family, returns |scriptCode|.
+UScriptCode GetScriptForWebSettings(UScriptCode scriptCode) {
+ switch (scriptCode) {
+ case USCRIPT_HIRAGANA:
+ case USCRIPT_KATAKANA:
+ case USCRIPT_JAPANESE:
+ return USCRIPT_KATAKANA_OR_HIRAGANA;
+ case USCRIPT_KOREAN:
+ return USCRIPT_HANGUL;
+ default:
+ return scriptCode;
+ }
+}
+
void ApplyFontsFromMap(const WebPreferences::ScriptFontFamilyMap& map,
SetFontFamilyWrapper setter,
WebSettings* settings) {
for (WebPreferences::ScriptFontFamilyMap::const_iterator it = map.begin();
it != map.end(); ++it) {
int32 script = u_getPropertyValueEnum(UCHAR_SCRIPT, (it->first).c_str());
- if (script >= 0 && script < USCRIPT_CODE_LIMIT)
- (*setter)(settings, it->second, (UScriptCode) script);
+ if (script >= 0 && script < USCRIPT_CODE_LIMIT) {
+ UScriptCode code = static_cast<UScriptCode>(script);
+ (*setter)(settings, it->second, GetScriptForWebSettings(code));
+ }
}
}
« no previous file with comments | « chrome/common/pref_names.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698