Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: Source/platform/fonts/FontCache.h

Issue 235553003: Support sideloaded fonts for DirectWrite (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add ForTesting, iterator name Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/platform/fonts/skia/FontCacheSkia.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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/HashMap.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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 #if OS(WIN) 99 #if OS(WIN)
99 PassRefPtr<SimpleFontData> fontDataFromDescriptionAndLogFont(const FontDescr iption&, ShouldRetain, const LOGFONT&, wchar_t* outFontFamilyName); 100 PassRefPtr<SimpleFontData> fontDataFromDescriptionAndLogFont(const FontDescr iption&, ShouldRetain, const LOGFONT&, wchar_t* outFontFamilyName);
100 #endif 101 #endif
101 102
102 #if OS(WIN) 103 #if OS(WIN)
103 bool useSubpixelPositioning() const { return s_useSubpixelPositioning; } 104 bool useSubpixelPositioning() const { return s_useSubpixelPositioning; }
104 SkFontMgr* fontManager() { return m_fontManager.get(); } 105 SkFontMgr* fontManager() { return m_fontManager.get(); }
105 static void setUseDirectWrite(bool useDirectWrite) { s_useDirectWrite = useD irectWrite; } 106 static void setUseDirectWrite(bool useDirectWrite) { s_useDirectWrite = useD irectWrite; }
106 static void setDirectWriteFactory(IDWriteFactory* factory) { s_directWriteFa ctory = factory; } 107 static void setDirectWriteFactory(IDWriteFactory* factory) { s_directWriteFa ctory = factory; }
107 static void setUseSubpixelPositioning(bool useSubpixelPositioning) { s_useSu bpixelPositioning = useSubpixelPositioning; } 108 static void setUseSubpixelPositioning(bool useSubpixelPositioning) { s_useSu bpixelPositioning = useSubpixelPositioning; }
109 static void addSideloadedFontForTesting(SkTypeface*);
108 #endif 110 #endif
109 111
110 #if ENABLE(OPENTYPE_VERTICAL) 112 #if ENABLE(OPENTYPE_VERTICAL)
111 typedef uint32_t FontFileKey; 113 typedef uint32_t FontFileKey;
112 PassRefPtr<OpenTypeVerticalData> getVerticalData(const FontFileKey&, const F ontPlatformData&); 114 PassRefPtr<OpenTypeVerticalData> getVerticalData(const FontFileKey&, const F ontPlatformData&);
113 #endif 115 #endif
114 116
115 #if OS(ANDROID) 117 #if OS(ANDROID)
116 static AtomicString getGenericFamilyNameForScript(const AtomicString& family Name, UScriptCode); 118 static AtomicString getGenericFamilyNameForScript(const AtomicString& family Name, UScriptCode);
117 #else 119 #else
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 PassRefPtr<SimpleFontData> fontDataFromFontPlatformData(const FontPlatformDa ta*, ShouldRetain = Retain); 151 PassRefPtr<SimpleFontData> fontDataFromFontPlatformData(const FontPlatformDa ta*, ShouldRetain = Retain);
150 152
151 // Don't purge if this count is > 0; 153 // Don't purge if this count is > 0;
152 int m_purgePreventCount; 154 int m_purgePreventCount;
153 155
154 #if OS(WIN) 156 #if OS(WIN)
155 OwnPtr<SkFontMgr> m_fontManager; 157 OwnPtr<SkFontMgr> m_fontManager;
156 static bool s_useDirectWrite; 158 static bool s_useDirectWrite;
157 static IDWriteFactory* s_directWriteFactory; 159 static IDWriteFactory* s_directWriteFactory;
158 static bool s_useSubpixelPositioning; 160 static bool s_useSubpixelPositioning;
161 static HashMap<String, SkTypeface*>* s_sideloadedFonts;
159 #endif 162 #endif
160 163
161 #if OS(MACOSX) || OS(ANDROID) 164 #if OS(MACOSX) || OS(ANDROID)
162 friend class ComplexTextController; 165 friend class ComplexTextController;
163 #endif 166 #endif
164 friend class SimpleFontData; // For fontDataFromFontPlatformData 167 friend class SimpleFontData; // For fontDataFromFontPlatformData
165 friend class FontFallbackList; 168 friend class FontFallbackList;
166 }; 169 };
167 170
168 class PLATFORM_EXPORT FontCachePurgePreventer { 171 class PLATFORM_EXPORT FontCachePurgePreventer {
169 public: 172 public:
170 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } 173 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); }
171 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } 174 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); }
172 }; 175 };
173 176
174 } 177 }
175 178
176 #endif 179 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/platform/fonts/skia/FontCacheSkia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698