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

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

Issue 2390623002: Re-limit the CJK font hack for Android to only when the content language is available (Closed)
Patch Set: Comments updated 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 b40ef9632703df729163c915728a457b8d096bb3..d7c4fdfc950541c5edb2a30d4239a5174bef6a50 100644
--- a/third_party/WebKit/Source/platform/fonts/android/FontCacheAndroid.cpp
+++ b/third_party/WebKit/Source/platform/fonts/android/FontCacheAndroid.cpp
@@ -65,12 +65,19 @@ AtomicString FontCache::getGenericFamilyNameForScript(
if (familyName == FontFamilyNames::webkit_monospace)
return familyName;
+ // 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 (fontDescription.script()) {
+ 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