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

Unified Diff: third_party/WebKit/Source/platform/fonts/android/FontCacheAndroid.cpp

Issue 2396143002: Merge 2840: Re-limit the CJK font hack for Android to only when the content language is available (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/fonts/android/FontCacheAndroid.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/android/FontCacheAndroid.cpp b/third_party/WebKit/Source/platform/fonts/android/FontCacheAndroid.cpp
index c580ac0160534f2202c41b5317689ebc60b9e59e..50ebfc46caf96bc0a5c5226cc7aa954c132b067f 100644
--- a/third_party/WebKit/Source/platform/fonts/android/FontCacheAndroid.cpp
+++ b/third_party/WebKit/Source/platform/fonts/android/FontCacheAndroid.cpp
@@ -58,12 +58,19 @@ AtomicString FontCache::getGenericFamilyNameForScript(const AtomicString& family
if (familyName == FontFamilyNames::webkit_monospace)
return familyName;
- // This is a hack to use the preferred font for CJK scripts.
- // TODO(kojii): This logic disregards either generic family name
- // or locale. We need an API that honors both to find appropriate
- // fonts. crbug.com/642340
- UChar32 examplerChar;
- switch (fontDescription.script()) {
+ // The CJK hack below should be removed, at latest when we have
+ // serif and sans-serif versions of CJK fonts. Until then, limit it
+ // to only when the content locale is available. crbug.com/652146
+ const LayoutLocale* contentLocale = fontDescription.locale();
+ if (!contentLocale)
+ return familyName;
+
+ // This is a hack to use the preferred font for CJK scripts.
+ // TODO(kojii): This logic disregards either generic family name
+ // or locale. We need an API that honors both to find appropriate
+ // fonts. crbug.com/642340
+ UChar32 examplerChar;
+ switch (contentLocale->script()) {
case USCRIPT_SIMPLIFIED_HAN:
case USCRIPT_TRADITIONAL_HAN:
case USCRIPT_KATAKANA_OR_HIRAGANA:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698