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 15 matching lines...) Expand all Loading... | |
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
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 <limits.h> | 33 #include <limits.h> |
34 #include "platform/PlatformExport.h" | 34 #include "platform/PlatformExport.h" |
35 #include "wtf/Forward.h" | 35 #include "wtf/Forward.h" |
36 #include "wtf/HashSet.h" | |
36 #include "wtf/PassRefPtr.h" | 37 #include "wtf/PassRefPtr.h" |
37 #include "wtf/RefPtr.h" | 38 #include "wtf/RefPtr.h" |
38 #include "wtf/Vector.h" | 39 #include "wtf/Vector.h" |
39 #include "wtf/text/CString.h" | 40 #include "wtf/text/CString.h" |
40 #include "wtf/text/WTFString.h" | 41 #include "wtf/text/WTFString.h" |
41 #include "wtf/unicode/Unicode.h" | 42 #include "wtf/unicode/Unicode.h" |
42 | 43 |
43 #if OS(WIN) | 44 #if OS(WIN) |
44 #include "SkFontMgr.h" | 45 #include "SkFontMgr.h" |
45 #include <windows.h> | 46 #include <windows.h> |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 #if OS(WIN) | 97 #if OS(WIN) |
97 PassRefPtr<SimpleFontData> fontDataFromDescriptionAndLogFont(const FontDescr iption&, ShouldRetain, const LOGFONT&, wchar_t* outFontFamilyName); | 98 PassRefPtr<SimpleFontData> fontDataFromDescriptionAndLogFont(const FontDescr iption&, ShouldRetain, const LOGFONT&, wchar_t* outFontFamilyName); |
98 #endif | 99 #endif |
99 | 100 |
100 #if OS(WIN) | 101 #if OS(WIN) |
101 bool useSubpixelPositioning() const { return s_useSubpixelPositioning; } | 102 bool useSubpixelPositioning() const { return s_useSubpixelPositioning; } |
102 SkFontMgr* fontManager() { return m_fontManager.get(); } | 103 SkFontMgr* fontManager() { return m_fontManager.get(); } |
103 static void setUseDirectWrite(bool useDirectWrite) { s_useDirectWrite = useD irectWrite; } | 104 static void setUseDirectWrite(bool useDirectWrite) { s_useDirectWrite = useD irectWrite; } |
104 static void setDirectWriteFactory(IDWriteFactory* factory) { s_directWriteFa ctory = factory; } | 105 static void setDirectWriteFactory(IDWriteFactory* factory) { s_directWriteFa ctory = factory; } |
105 static void setUseSubpixelPositioning(bool useSubpixelPositioning) { s_useSu bpixelPositioning = useSubpixelPositioning; } | 106 static void setUseSubpixelPositioning(bool useSubpixelPositioning) { s_useSu bpixelPositioning = useSubpixelPositioning; } |
107 static void addSideloadedFont(SkTypeface*); | |
eae
2014/04/12 10:51:33
How about addSideloadedFontForTesting to discourag
scottmg
2014/04/12 15:42:39
SG, Done.
| |
106 #endif | 108 #endif |
107 | 109 |
108 #if ENABLE(OPENTYPE_VERTICAL) | 110 #if ENABLE(OPENTYPE_VERTICAL) |
109 typedef uint32_t FontFileKey; | 111 typedef uint32_t FontFileKey; |
110 PassRefPtr<OpenTypeVerticalData> getVerticalData(const FontFileKey&, const F ontPlatformData&); | 112 PassRefPtr<OpenTypeVerticalData> getVerticalData(const FontFileKey&, const F ontPlatformData&); |
111 #endif | 113 #endif |
112 | 114 |
113 #if OS(ANDROID) | 115 #if OS(ANDROID) |
114 static AtomicString getGenericFamilyNameForScript(const AtomicString& family Name, UScriptCode); | 116 static AtomicString getGenericFamilyNameForScript(const AtomicString& family Name, UScriptCode); |
115 #else | 117 #else |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 PassRefPtr<SimpleFontData> fontDataFromFontPlatformData(const FontPlatformDa ta*, ShouldRetain = Retain); | 149 PassRefPtr<SimpleFontData> fontDataFromFontPlatformData(const FontPlatformDa ta*, ShouldRetain = Retain); |
148 | 150 |
149 // Don't purge if this count is > 0; | 151 // Don't purge if this count is > 0; |
150 int m_purgePreventCount; | 152 int m_purgePreventCount; |
151 | 153 |
152 #if OS(WIN) | 154 #if OS(WIN) |
153 OwnPtr<SkFontMgr> m_fontManager; | 155 OwnPtr<SkFontMgr> m_fontManager; |
154 static bool s_useDirectWrite; | 156 static bool s_useDirectWrite; |
155 static IDWriteFactory* s_directWriteFactory; | 157 static IDWriteFactory* s_directWriteFactory; |
156 static bool s_useSubpixelPositioning; | 158 static bool s_useSubpixelPositioning; |
159 static HashMap<String, SkTypeface*>* s_sideloadedFonts; | |
157 #endif | 160 #endif |
158 | 161 |
159 #if OS(MACOSX) || OS(ANDROID) | 162 #if OS(MACOSX) || OS(ANDROID) |
160 friend class ComplexTextController; | 163 friend class ComplexTextController; |
161 #endif | 164 #endif |
162 friend class SimpleFontData; // For fontDataFromFontPlatformData | 165 friend class SimpleFontData; // For fontDataFromFontPlatformData |
163 friend class FontFallbackList; | 166 friend class FontFallbackList; |
164 }; | 167 }; |
165 | 168 |
166 class PLATFORM_EXPORT FontCachePurgePreventer { | 169 class PLATFORM_EXPORT FontCachePurgePreventer { |
167 public: | 170 public: |
168 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } | 171 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } |
169 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } | 172 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } |
170 }; | 173 }; |
171 | 174 |
172 } | 175 } |
173 | 176 |
174 #endif | 177 #endif |
OLD | NEW |