| 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; |
| 84 #endif // OS(WIN) | 85 #endif // OS(WIN) |
| 85 | 86 |
| 86 FontCache* FontCache::fontCache() | 87 FontCache* FontCache::fontCache() |
| 87 { | 88 { |
| 88 DEFINE_STATIC_LOCAL(FontCache, globalFontCache, ()); | 89 DEFINE_STATIC_LOCAL(FontCache, globalFontCache, ()); |
| 89 return &globalFontCache; | 90 return &globalFontCache; |
| 90 } | 91 } |
| 91 | 92 |
| 92 FontPlatformData* FontCache::getFontPlatformData(const FontDescription& fontDesc
ription, | 93 FontPlatformData* FontCache::getFontPlatformData(const FontDescription& fontDesc
ription, |
| 93 const FontFaceCreationParams& creationParams, bool checkingAlternateName) | 94 const FontFaceCreationParams& creationParams, bool checkingAlternateName) |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 FallbackListShaperCache::iterator iter; | 368 FallbackListShaperCache::iterator iter; |
| 368 for (iter = gFallbackListShaperCache->begin(); | 369 for (iter = gFallbackListShaperCache->begin(); |
| 369 iter != gFallbackListShaperCache->end(); | 370 iter != gFallbackListShaperCache->end(); |
| 370 ++iter) { | 371 ++iter) { |
| 371 shapeResultCacheSize += iter->value->byteSize(); | 372 shapeResultCacheSize += iter->value->byteSize(); |
| 372 } | 373 } |
| 373 dump->addScalar("size", "bytes", shapeResultCacheSize); | 374 dump->addScalar("size", "bytes", shapeResultCacheSize); |
| 374 memoryDump->addSuballocation(dump->guid(), String(WTF::Partitions::kAllocate
dObjectPoolName)); | 375 memoryDump->addSuballocation(dump->guid(), String(WTF::Partitions::kAllocate
dObjectPoolName)); |
| 375 } | 376 } |
| 376 | 377 |
| 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 } |
| 377 | 394 |
| 378 } // namespace blink | 395 } // namespace blink |
| OLD | NEW |