| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 static FallbackListShaperCache* gFallbackListShaperCache = nullptr; | 74 static FallbackListShaperCache* gFallbackListShaperCache = nullptr; |
| 75 | 75 |
| 76 SkFontMgr* FontCache::s_fontManager = nullptr; | 76 SkFontMgr* FontCache::s_fontManager = nullptr; |
| 77 | 77 |
| 78 #if OS(WIN) | 78 #if OS(WIN) |
| 79 bool FontCache::s_useDirectWrite = false; | 79 bool FontCache::s_useDirectWrite = false; |
| 80 bool FontCache::s_antialiasedTextEnabled = false; | 80 bool FontCache::s_antialiasedTextEnabled = false; |
| 81 bool FontCache::s_lcdTextEnabled = false; | 81 bool FontCache::s_lcdTextEnabled = false; |
| 82 bool FontCache::s_useSubpixelPositioning = false; | 82 bool FontCache::s_useSubpixelPositioning = false; |
| 83 float FontCache::s_deviceScaleFactor = 1.0; | 83 float FontCache::s_deviceScaleFactor = 1.0; |
| 84 bool FontCache::s_useSkiaFontFallback = false; | |
| 85 #endif // OS(WIN) | 84 #endif // OS(WIN) |
| 86 | 85 |
| 87 FontCache* FontCache::fontCache() | 86 FontCache* FontCache::fontCache() |
| 88 { | 87 { |
| 89 DEFINE_STATIC_LOCAL(FontCache, globalFontCache, ()); | 88 DEFINE_STATIC_LOCAL(FontCache, globalFontCache, ()); |
| 90 return &globalFontCache; | 89 return &globalFontCache; |
| 91 } | 90 } |
| 92 | 91 |
| 93 FontPlatformData* FontCache::getFontPlatformData(const FontDescription& fontDesc
ription, | 92 FontPlatformData* FontCache::getFontPlatformData(const FontDescription& fontDesc
ription, |
| 94 const FontFaceCreationParams& creationParams, bool checkingAlternateName) | 93 const FontFaceCreationParams& creationParams, bool checkingAlternateName) |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 FallbackListShaperCache::iterator iter; | 367 FallbackListShaperCache::iterator iter; |
| 369 for (iter = gFallbackListShaperCache->begin(); | 368 for (iter = gFallbackListShaperCache->begin(); |
| 370 iter != gFallbackListShaperCache->end(); | 369 iter != gFallbackListShaperCache->end(); |
| 371 ++iter) { | 370 ++iter) { |
| 372 shapeResultCacheSize += iter->value->byteSize(); | 371 shapeResultCacheSize += iter->value->byteSize(); |
| 373 } | 372 } |
| 374 dump->addScalar("size", "bytes", shapeResultCacheSize); | 373 dump->addScalar("size", "bytes", shapeResultCacheSize); |
| 375 memoryDump->addSuballocation(dump->guid(), String(WTF::Partitions::kAllocate
dObjectPoolName)); | 374 memoryDump->addSuballocation(dump->guid(), String(WTF::Partitions::kAllocate
dObjectPoolName)); |
| 376 } | 375 } |
| 377 | 376 |
| 378 // SkFontMgr requires script-based locale names, like "zh-Hant" and "zh-Hans", | |
| 379 // instead of "zh-CN" and "zh-TW". | |
| 380 CString toSkFontMgrLocale(const String& locale) | |
| 381 { | |
| 382 if (!locale.startsWith("zh", TextCaseInsensitive)) | |
| 383 return locale.ascii(); | |
| 384 | |
| 385 switch (localeToScriptCodeForFontSelection(locale)) { | |
| 386 case USCRIPT_SIMPLIFIED_HAN: | |
| 387 return "zh-Hans"; | |
| 388 case USCRIPT_TRADITIONAL_HAN: | |
| 389 return "zh-Hant"; | |
| 390 default: | |
| 391 return locale.ascii(); | |
| 392 } | |
| 393 } | |
| 394 | 377 |
| 395 } // namespace blink | 378 } // namespace blink |
| OLD | NEW |