| 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" |
| 37 #include "wtf/Allocator.h" | 38 #include "wtf/Allocator.h" |
| 38 #include "wtf/Forward.h" | 39 #include "wtf/Forward.h" |
| 39 #include "wtf/HashMap.h" | 40 #include "wtf/HashMap.h" |
| 40 #include "wtf/PassRefPtr.h" | 41 #include "wtf/PassRefPtr.h" |
| 41 #include "wtf/RefPtr.h" | 42 #include "wtf/RefPtr.h" |
| 42 #include "wtf/text/CString.h" | 43 #include "wtf/text/CString.h" |
| 43 #include "wtf/text/Unicode.h" | 44 #include "wtf/text/Unicode.h" |
| 44 #include "wtf/text/WTFString.h" | 45 #include "wtf/text/WTFString.h" |
| 45 #include <limits.h> | 46 #include <limits.h> |
| 46 | 47 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 PassRefPtr<SimpleFontData> fallbackFontForCharacter(const FontDescription&,
UChar32, const SimpleFontData* fontDataToSubstitute); | 80 PassRefPtr<SimpleFontData> fallbackFontForCharacter(const FontDescription&,
UChar32, const SimpleFontData* fontDataToSubstitute); |
| 80 | 81 |
| 81 // Also implemented by the platform. | 82 // Also implemented by the platform. |
| 82 void platformInit(); | 83 void platformInit(); |
| 83 | 84 |
| 84 PassRefPtr<SimpleFontData> getFontData(const FontDescription&, const AtomicS
tring&, bool checkingAlternateName = false, ShouldRetain = Retain); | 85 PassRefPtr<SimpleFontData> getFontData(const FontDescription&, const AtomicS
tring&, bool checkingAlternateName = false, ShouldRetain = Retain); |
| 85 PassRefPtr<SimpleFontData> getLastResortFallbackFont(const FontDescription&,
ShouldRetain = Retain); | 86 PassRefPtr<SimpleFontData> getLastResortFallbackFont(const FontDescription&,
ShouldRetain = Retain); |
| 86 SimpleFontData* getNonRetainedLastResortFallbackFont(const FontDescription&)
; | 87 SimpleFontData* getNonRetainedLastResortFallbackFont(const FontDescription&)
; |
| 87 bool isPlatformFontAvailable(const FontDescription&, const AtomicString&); | 88 bool isPlatformFontAvailable(const FontDescription&, const AtomicString&); |
| 88 | 89 |
| 90 const Vector<AtomicString>& fontListForFallbackPriority(const FontDescriptio
n&, FontFallbackPriority); |
| 91 |
| 89 // Returns the ShapeCache instance associated with the given cache key. | 92 // Returns the ShapeCache instance associated with the given cache key. |
| 90 // Creates a new instance as needed and as such is guaranteed not to return | 93 // Creates a new instance as needed and as such is guaranteed not to return |
| 91 // a nullptr. Instances are managed by FontCache and are only guaranteed to | 94 // a nullptr. Instances are managed by FontCache and are only guaranteed to |
| 92 // be valid for the duration of the current session, as controlled by | 95 // be valid for the duration of the current session, as controlled by |
| 93 // disable/enablePurging. | 96 // disable/enablePurging. |
| 94 ShapeCache* getShapeCache(const FallbackListCompositeKey&); | 97 ShapeCache* getShapeCache(const FallbackListCompositeKey&); |
| 95 | 98 |
| 96 void addClient(FontCacheClient*); | 99 void addClient(FontCacheClient*); |
| 97 #if !ENABLE(OILPAN) | 100 #if !ENABLE(OILPAN) |
| 98 void removeClient(FontCacheClient*); | 101 void removeClient(FontCacheClient*); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 FontPlatformData* getFontPlatformData(const FontDescription&, const FontFace
CreationParams&, bool checkingAlternateName = false); | 168 FontPlatformData* getFontPlatformData(const FontDescription&, const FontFace
CreationParams&, bool checkingAlternateName = false); |
| 166 | 169 |
| 167 // These methods are implemented by each platform. | 170 // These methods are implemented by each platform. |
| 168 PassOwnPtr<FontPlatformData> createFontPlatformData(const FontDescription&,
const FontFaceCreationParams&, float fontSize); | 171 PassOwnPtr<FontPlatformData> createFontPlatformData(const FontDescription&,
const FontFaceCreationParams&, float fontSize); |
| 169 | 172 |
| 170 // Implemented on skia platforms. | 173 // Implemented on skia platforms. |
| 171 PassRefPtr<SkTypeface> createTypeface(const FontDescription&, const FontFace
CreationParams&, CString& name); | 174 PassRefPtr<SkTypeface> createTypeface(const FontDescription&, const FontFace
CreationParams&, CString& name); |
| 172 | 175 |
| 173 PassRefPtr<SimpleFontData> fallbackOnStandardFontStyle(const FontDescription
&, UChar32); | 176 PassRefPtr<SimpleFontData> fallbackOnStandardFontStyle(const FontDescription
&, UChar32); |
| 174 | 177 |
| 178 template <FontFallbackPriority fallbackPriority> |
| 179 const Vector<AtomicString>& initAndGetFontListForFallbackPriority(const Font
Description&); |
| 180 |
| 181 const Vector<AtomicString> platformFontListForFallbackPriority(FontFallbackP
riority) const; |
| 182 |
| 175 // Don't purge if this count is > 0; | 183 // Don't purge if this count is > 0; |
| 176 int m_purgePreventCount; | 184 int m_purgePreventCount; |
| 177 | 185 |
| 178 #if OS(WIN) | 186 #if OS(WIN) |
| 179 OwnPtr<SkFontMgr> m_fontManager; | 187 OwnPtr<SkFontMgr> m_fontManager; |
| 180 static bool s_useDirectWrite; | 188 static bool s_useDirectWrite; |
| 181 static IDWriteFactory* s_directWriteFactory; | 189 static IDWriteFactory* s_directWriteFactory; |
| 182 static float s_deviceScaleFactor; | 190 static float s_deviceScaleFactor; |
| 183 static bool s_useSubpixelPositioning; | 191 static bool s_useSubpixelPositioning; |
| 184 static HashMap<String, RefPtr<SkTypeface>>* s_sideloadedFonts; | 192 static HashMap<String, RefPtr<SkTypeface>>* s_sideloadedFonts; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 199 USING_FAST_MALLOC(FontCachePurgePreventer); | 207 USING_FAST_MALLOC(FontCachePurgePreventer); |
| 200 WTF_MAKE_NONCOPYABLE(FontCachePurgePreventer); | 208 WTF_MAKE_NONCOPYABLE(FontCachePurgePreventer); |
| 201 public: | 209 public: |
| 202 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } | 210 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } |
| 203 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } | 211 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } |
| 204 }; | 212 }; |
| 205 | 213 |
| 206 } // namespace blink | 214 } // namespace blink |
| 207 | 215 |
| 208 #endif | 216 #endif |
| OLD | NEW |