| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2008 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) 2007-2008 Torch Mobile, Inc. | 3 * Copyright (C) 2007-2008 Torch Mobile, Inc. |
| 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 16 matching lines...) Expand all Loading... |
| 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #ifndef FontCache_h | 30 #ifndef FontCache_h |
| 31 #define FontCache_h | 31 #define FontCache_h |
| 32 | 32 |
| 33 #include "platform/PlatformExport.h" | 33 #include "platform/PlatformExport.h" |
| 34 #include "platform/fonts/FallbackListCompositeKey.h" | 34 #include "platform/fonts/FallbackListCompositeKey.h" |
| 35 #include "platform/fonts/FontCacheKey.h" | 35 #include "platform/fonts/FontCacheKey.h" |
| 36 #include "platform/fonts/FontFaceCreationParams.h" | 36 #include "platform/fonts/FontFaceCreationParams.h" |
| 37 #include "platform/fonts/FontFallbackPriority.h" | |
| 38 #include "wtf/Allocator.h" | 37 #include "wtf/Allocator.h" |
| 39 #include "wtf/Forward.h" | 38 #include "wtf/Forward.h" |
| 40 #include "wtf/HashMap.h" | 39 #include "wtf/HashMap.h" |
| 41 #include "wtf/PassRefPtr.h" | 40 #include "wtf/PassRefPtr.h" |
| 42 #include "wtf/RefPtr.h" | 41 #include "wtf/RefPtr.h" |
| 43 #include "wtf/text/CString.h" | 42 #include "wtf/text/CString.h" |
| 44 #include "wtf/text/Unicode.h" | 43 #include "wtf/text/Unicode.h" |
| 45 #include "wtf/text/WTFString.h" | 44 #include "wtf/text/WTFString.h" |
| 46 #include <limits.h> | 45 #include <limits.h> |
| 47 | 46 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 PassRefPtr<SimpleFontData> fallbackFontForCharacter(const FontDescription&,
UChar32, const SimpleFontData* fontDataToSubstitute); | 79 PassRefPtr<SimpleFontData> fallbackFontForCharacter(const FontDescription&,
UChar32, const SimpleFontData* fontDataToSubstitute); |
| 81 | 80 |
| 82 // Also implemented by the platform. | 81 // Also implemented by the platform. |
| 83 void platformInit(); | 82 void platformInit(); |
| 84 | 83 |
| 85 PassRefPtr<SimpleFontData> getFontData(const FontDescription&, const AtomicS
tring&, bool checkingAlternateName = false, ShouldRetain = Retain); | 84 PassRefPtr<SimpleFontData> getFontData(const FontDescription&, const AtomicS
tring&, bool checkingAlternateName = false, ShouldRetain = Retain); |
| 86 PassRefPtr<SimpleFontData> getLastResortFallbackFont(const FontDescription&,
ShouldRetain = Retain); | 85 PassRefPtr<SimpleFontData> getLastResortFallbackFont(const FontDescription&,
ShouldRetain = Retain); |
| 87 SimpleFontData* getNonRetainedLastResortFallbackFont(const FontDescription&)
; | 86 SimpleFontData* getNonRetainedLastResortFallbackFont(const FontDescription&)
; |
| 88 bool isPlatformFontAvailable(const FontDescription&, const AtomicString&); | 87 bool isPlatformFontAvailable(const FontDescription&, const AtomicString&); |
| 89 | 88 |
| 90 // Returns the list of available emoji and symbol fonts. Does not return a | |
| 91 // null pointer and should return at least one available font for each | |
| 92 // category. The returned list is lazy initialized by checking a list of | |
| 93 // font candidates for local availability. | |
| 94 const Vector<AtomicString>* fontListForFallbackPriority(const FontDescriptio
n&, FontFallbackPriority); | |
| 95 | |
| 96 // Returns the ShapeCache instance associated with the given cache key. | 89 // Returns the ShapeCache instance associated with the given cache key. |
| 97 // Creates a new instance as needed and as such is guaranteed not to return | 90 // Creates a new instance as needed and as such is guaranteed not to return |
| 98 // a nullptr. Instances are managed by FontCache and are only guaranteed to | 91 // a nullptr. Instances are managed by FontCache and are only guaranteed to |
| 99 // be valid for the duration of the current session, as controlled by | 92 // be valid for the duration of the current session, as controlled by |
| 100 // disable/enablePurging. | 93 // disable/enablePurging. |
| 101 ShapeCache* getShapeCache(const FallbackListCompositeKey&); | 94 ShapeCache* getShapeCache(const FallbackListCompositeKey&); |
| 102 | 95 |
| 103 void addClient(FontCacheClient*); | 96 void addClient(FontCacheClient*); |
| 104 #if !ENABLE(OILPAN) | 97 #if !ENABLE(OILPAN) |
| 105 void removeClient(FontCacheClient*); | 98 void removeClient(FontCacheClient*); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 FontPlatformData* getFontPlatformData(const FontDescription&, const FontFace
CreationParams&, bool checkingAlternateName = false); | 165 FontPlatformData* getFontPlatformData(const FontDescription&, const FontFace
CreationParams&, bool checkingAlternateName = false); |
| 173 | 166 |
| 174 // These methods are implemented by each platform. | 167 // These methods are implemented by each platform. |
| 175 PassOwnPtr<FontPlatformData> createFontPlatformData(const FontDescription&,
const FontFaceCreationParams&, float fontSize); | 168 PassOwnPtr<FontPlatformData> createFontPlatformData(const FontDescription&,
const FontFaceCreationParams&, float fontSize); |
| 176 | 169 |
| 177 // Implemented on skia platforms. | 170 // Implemented on skia platforms. |
| 178 PassRefPtr<SkTypeface> createTypeface(const FontDescription&, const FontFace
CreationParams&, CString& name); | 171 PassRefPtr<SkTypeface> createTypeface(const FontDescription&, const FontFace
CreationParams&, CString& name); |
| 179 | 172 |
| 180 PassRefPtr<SimpleFontData> fallbackOnStandardFontStyle(const FontDescription
&, UChar32); | 173 PassRefPtr<SimpleFontData> fallbackOnStandardFontStyle(const FontDescription
&, UChar32); |
| 181 | 174 |
| 182 template <FontFallbackPriority fallbackPriority> | |
| 183 const Vector<AtomicString>* initAndGetFontListForFallbackPriority(const Font
Description&); | |
| 184 | |
| 185 const Vector<AtomicString> platformFontListForFallbackPriority(FontFallbackP
riority) const; | |
| 186 | |
| 187 // Don't purge if this count is > 0; | 175 // Don't purge if this count is > 0; |
| 188 int m_purgePreventCount; | 176 int m_purgePreventCount; |
| 189 | 177 |
| 190 #if OS(WIN) | 178 #if OS(WIN) |
| 191 OwnPtr<SkFontMgr> m_fontManager; | 179 OwnPtr<SkFontMgr> m_fontManager; |
| 192 static bool s_useDirectWrite; | 180 static bool s_useDirectWrite; |
| 193 static IDWriteFactory* s_directWriteFactory; | 181 static IDWriteFactory* s_directWriteFactory; |
| 194 static float s_deviceScaleFactor; | 182 static float s_deviceScaleFactor; |
| 195 static bool s_useSubpixelPositioning; | 183 static bool s_useSubpixelPositioning; |
| 196 static HashMap<String, RefPtr<SkTypeface>>* s_sideloadedFonts; | 184 static HashMap<String, RefPtr<SkTypeface>>* s_sideloadedFonts; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 211 USING_FAST_MALLOC(FontCachePurgePreventer); | 199 USING_FAST_MALLOC(FontCachePurgePreventer); |
| 212 WTF_MAKE_NONCOPYABLE(FontCachePurgePreventer); | 200 WTF_MAKE_NONCOPYABLE(FontCachePurgePreventer); |
| 213 public: | 201 public: |
| 214 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } | 202 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } |
| 215 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } | 203 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } |
| 216 }; | 204 }; |
| 217 | 205 |
| 218 } // namespace blink | 206 } // namespace blink |
| 219 | 207 |
| 220 #endif | 208 #endif |
| OLD | NEW |