| Index: third_party/WebKit/Source/platform/fonts/FontCache.cpp
|
| diff --git a/third_party/WebKit/Source/platform/fonts/FontCache.cpp b/third_party/WebKit/Source/platform/fonts/FontCache.cpp
|
| index b97d46bb73380bae5358653bc70948bfdbfe9ab5..7911db93d0b0b401d01c7cdd45df6258f3b4fac2 100644
|
| --- a/third_party/WebKit/Source/platform/fonts/FontCache.cpp
|
| +++ b/third_party/WebKit/Source/platform/fonts/FontCache.cpp
|
| @@ -374,5 +374,21 @@ void FontCache::dumpShapeResultCache(WebProcessMemoryDump* memoryDump)
|
| memoryDump->addSuballocation(dump->guid(), String(WTF::Partitions::kAllocatedObjectPoolName));
|
| }
|
|
|
| +// SkFontMgr requires script-based locale names, like "zh-Hant" and "zh-Hans",
|
| +// instead of "zh-CN" and "zh-TW".
|
| +CString toSkFontMgrLocale(const String& locale)
|
| +{
|
| + if (!locale.startsWith("zh", TextCaseInsensitive))
|
| + return locale.ascii();
|
| +
|
| + switch (localeToScriptCodeForFontSelection(locale)) {
|
| + case USCRIPT_SIMPLIFIED_HAN:
|
| + return "zh-Hans";
|
| + case USCRIPT_TRADITIONAL_HAN:
|
| + return "zh-Hant";
|
| + default:
|
| + return locale.ascii();
|
| + }
|
| +}
|
|
|
| } // namespace blink
|
|
|