Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 | 36 |
| 37 FontCache::FontCache() : m_purgePreventCount(0) { | 37 FontCache::FontCache() : m_purgePreventCount(0) { |
| 38 if (s_staticFontManager) { | 38 if (s_staticFontManager) { |
| 39 adopted(s_staticFontManager); | 39 adopted(s_staticFontManager); |
| 40 m_fontManager = sk_ref_sp(s_staticFontManager); | 40 m_fontManager = sk_ref_sp(s_staticFontManager); |
| 41 } else { | 41 } else { |
| 42 m_fontManager = nullptr; | 42 m_fontManager = nullptr; |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 // The system UI font is localizable. When not localized, | |
| 47 // FontCache::createTypeface() maps "system-ui" to the Skia default font. | |
| 48 static AtomicString& mutableSystemFontFamily() { | |
| 49 DEFINE_STATIC_LOCAL(AtomicString, systemFontFamily, | |
| 50 (FontFamilyNames::system_ui)); | |
| 51 return systemFontFamily; | |
| 52 } | |
| 53 | |
| 54 // static | |
| 55 const AtomicString& FontCache::systemFontFamily(float) { | |
| 56 return mutableSystemFontFamily(); | |
| 57 } | |
| 58 | |
| 59 // static | |
| 60 void FontCache::setSystemFontFamily(const char* familyName) { | |
| 61 mutableSystemFontFamily() = | |
|
drott
2016/10/13 07:59:35
Let's DCHECK for a non zero-length familyName argu
kojii
2016/10/13 09:03:20
Done.
| |
| 62 !familyName || !*familyName ? familyName : FontFamilyNames::system_ui; | |
| 63 } | |
| 64 | |
| 46 void FontCache::getFontForCharacter( | 65 void FontCache::getFontForCharacter( |
| 47 UChar32 c, | 66 UChar32 c, |
| 48 const char* preferredLocale, | 67 const char* preferredLocale, |
| 49 FontCache::PlatformFallbackFont* fallbackFont) { | 68 FontCache::PlatformFallbackFont* fallbackFont) { |
| 50 if (Platform::current()->sandboxSupport()) { | 69 if (Platform::current()->sandboxSupport()) { |
| 51 WebFallbackFont webFallbackFont; | 70 WebFallbackFont webFallbackFont; |
| 52 Platform::current()->sandboxSupport()->getFallbackFontForCharacter( | 71 Platform::current()->sandboxSupport()->getFallbackFontForCharacter( |
| 53 c, preferredLocale, &webFallbackFont); | 72 c, preferredLocale, &webFallbackFont); |
| 54 fallbackFont->name = String::fromUTF8(CString(webFallbackFont.name)); | 73 fallbackFont->name = String::fromUTF8(CString(webFallbackFont.name)); |
| 55 fallbackFont->filename = webFallbackFont.filename; | 74 fallbackFont->filename = webFallbackFont.filename; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 std::unique_ptr<FontPlatformData> platformData( | 170 std::unique_ptr<FontPlatformData> platformData( |
| 152 new FontPlatformData(*substitutePlatformData)); | 171 new FontPlatformData(*substitutePlatformData)); |
| 153 platformData->setSyntheticBold(shouldSetSyntheticBold); | 172 platformData->setSyntheticBold(shouldSetSyntheticBold); |
| 154 platformData->setSyntheticItalic(shouldSetSyntheticItalic); | 173 platformData->setSyntheticItalic(shouldSetSyntheticItalic); |
| 155 return fontDataFromFontPlatformData(platformData.get(), DoNotRetain); | 174 return fontDataFromFontPlatformData(platformData.get(), DoNotRetain); |
| 156 } | 175 } |
| 157 | 176 |
| 158 #endif // !OS(ANDROID) | 177 #endif // !OS(ANDROID) |
| 159 | 178 |
| 160 } // namespace blink | 179 } // namespace blink |
| OLD | NEW |