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

Unified Diff: third_party/WebKit/Source/platform/fonts/win/FontFallbackWin.cpp

Issue 1695653002: Take Accept-Language into account in CJK font fallback for Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@al
Patch Set: Rebase Created 4 years, 10 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 | « third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp ('k') | 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/win/FontFallbackWin.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/win/FontFallbackWin.cpp b/third_party/WebKit/Source/platform/fonts/win/FontFallbackWin.cpp
index 0ff4e29e69e5cd8f1d5be0ec3091d2ed64fe8c2e..a64f1c4c8a5a8294c4518ae2f8f04cd6ac40918a 100644
--- a/third_party/WebKit/Source/platform/fonts/win/FontFallbackWin.cpp
+++ b/third_party/WebKit/Source/platform/fonts/win/FontFallbackWin.cpp
@@ -230,6 +230,18 @@ void initializeScriptFontMap(ScriptToFontMap& scriptFontMap, SkFontMgr* fontMana
scriptFontMap[USCRIPT_HAN] = localeFamily;
}
+static UScriptCode scriptForHan(UScriptCode contentScript,
+ const AtomicString& contentLocale)
+{
+ UScriptCode script = scriptCodeForHanFromLocale(contentScript, contentLocale);
+ if (script != USCRIPT_COMMON)
+ return script;
+ script = FontCache::preferredScriptForHan();
+ if (script != USCRIPT_COMMON)
+ return script;
+ return USCRIPT_HAN;
+}
+
// There are a lot of characters in USCRIPT_COMMON that can be covered
// by fonts for scripts closely related to them. See
// http://unicode.org/cldr/utility/list-unicodeset.jsp?a=[:Script=Common:]
@@ -408,13 +420,10 @@ const UChar* getFallbackFamily(UChar32 character,
if (script == USCRIPT_COMMON)
script = getScriptBasedOnUnicodeBlock(character);
- // For unified-Han scripts, try the lang attribute.
- if (script == USCRIPT_HAN) {
- script = scriptCodeForHanFromLocale(contentScript, contentLocale);
- // Use the UI locale if it is still ambiguous.
- if (script == USCRIPT_COMMON)
- script = USCRIPT_SIMPLIFIED_HAN;
- }
+ // For unified-Han scripts, try the lang attribute, system, or
+ // accept-languages.
+ if (script == USCRIPT_HAN)
+ script = scriptForHan(contentScript, contentLocale);
family = getFontFamilyForScript(script, generic, fontManager);
// Another lame work-around to cover non-BMP characters.
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698