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 static AtomicString& mutableSystemFontFamily() { |
| 47 DEFINE_STATIC_LOCAL(AtomicString, systemFontFamily, ()); |
| 48 return systemFontFamily; |
| 49 } |
| 50 |
| 51 // static |
| 52 const AtomicString& FontCache::systemFontFamily() { |
| 53 return mutableSystemFontFamily(); |
| 54 } |
| 55 |
| 56 // static |
| 57 void FontCache::setSystemFontFamily(const char* familyName) { |
| 58 DCHECK(familyName && *familyName); |
| 59 mutableSystemFontFamily() = familyName; |
| 60 } |
| 61 |
46 void FontCache::getFontForCharacter( | 62 void FontCache::getFontForCharacter( |
47 UChar32 c, | 63 UChar32 c, |
48 const char* preferredLocale, | 64 const char* preferredLocale, |
49 FontCache::PlatformFallbackFont* fallbackFont) { | 65 FontCache::PlatformFallbackFont* fallbackFont) { |
50 if (Platform::current()->sandboxSupport()) { | 66 if (Platform::current()->sandboxSupport()) { |
51 WebFallbackFont webFallbackFont; | 67 WebFallbackFont webFallbackFont; |
52 Platform::current()->sandboxSupport()->getFallbackFontForCharacter( | 68 Platform::current()->sandboxSupport()->getFallbackFontForCharacter( |
53 c, preferredLocale, &webFallbackFont); | 69 c, preferredLocale, &webFallbackFont); |
54 fallbackFont->name = String::fromUTF8(CString(webFallbackFont.name)); | 70 fallbackFont->name = String::fromUTF8(CString(webFallbackFont.name)); |
55 fallbackFont->filename = webFallbackFont.filename; | 71 fallbackFont->filename = webFallbackFont.filename; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 std::unique_ptr<FontPlatformData> platformData( | 167 std::unique_ptr<FontPlatformData> platformData( |
152 new FontPlatformData(*substitutePlatformData)); | 168 new FontPlatformData(*substitutePlatformData)); |
153 platformData->setSyntheticBold(shouldSetSyntheticBold); | 169 platformData->setSyntheticBold(shouldSetSyntheticBold); |
154 platformData->setSyntheticItalic(shouldSetSyntheticItalic); | 170 platformData->setSyntheticItalic(shouldSetSyntheticItalic); |
155 return fontDataFromFontPlatformData(platformData.get(), DoNotRetain); | 171 return fontDataFromFontPlatformData(platformData.get(), DoNotRetain); |
156 } | 172 } |
157 | 173 |
158 #endif // !OS(ANDROID) | 174 #endif // !OS(ANDROID) |
159 | 175 |
160 } // namespace blink | 176 } // namespace blink |
OLD | NEW |