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 29 matching lines...) Expand all Loading... |
40 #include "wtf/HashMap.h" | 40 #include "wtf/HashMap.h" |
41 #include "wtf/PassRefPtr.h" | 41 #include "wtf/PassRefPtr.h" |
42 #include "wtf/RefPtr.h" | 42 #include "wtf/RefPtr.h" |
43 #include "wtf/text/CString.h" | 43 #include "wtf/text/CString.h" |
44 #include "wtf/text/Unicode.h" | 44 #include "wtf/text/Unicode.h" |
45 #include "wtf/text/WTFString.h" | 45 #include "wtf/text/WTFString.h" |
46 #include <limits.h> | 46 #include <limits.h> |
47 | 47 |
48 #if OS(WIN) | 48 #if OS(WIN) |
49 #include "SkFontMgr.h" | 49 #include "SkFontMgr.h" |
50 struct IDWriteFactory; | |
51 #endif | 50 #endif |
52 | 51 |
53 class SkTypeface; | 52 class SkTypeface; |
54 | 53 |
55 namespace blink { | 54 namespace blink { |
56 | 55 |
57 class FontCacheClient; | 56 class FontCacheClient; |
58 class FontFaceCreationParams; | 57 class FontFaceCreationParams; |
59 class FontPlatformData; | 58 class FontPlatformData; |
60 class FontDescription; | 59 class FontDescription; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 106 |
108 unsigned short generation(); | 107 unsigned short generation(); |
109 void invalidate(); | 108 void invalidate(); |
110 | 109 |
111 #if OS(WIN) | 110 #if OS(WIN) |
112 bool useSubpixelPositioning() const { return s_useSubpixelPositioning; } | 111 bool useSubpixelPositioning() const { return s_useSubpixelPositioning; } |
113 SkFontMgr* fontManager() { return m_fontManager.get(); } | 112 SkFontMgr* fontManager() { return m_fontManager.get(); } |
114 static bool useDirectWrite() { return s_useDirectWrite; } | 113 static bool useDirectWrite() { return s_useDirectWrite; } |
115 static float deviceScaleFactor() { return s_deviceScaleFactor; } | 114 static float deviceScaleFactor() { return s_deviceScaleFactor; } |
116 static void setUseDirectWrite(bool useDirectWrite) { s_useDirectWrite = useD
irectWrite; } | 115 static void setUseDirectWrite(bool useDirectWrite) { s_useDirectWrite = useD
irectWrite; } |
117 static void setDirectWriteFactory(IDWriteFactory* factory) { s_directWriteFa
ctory = factory; } | 116 static void setFontManager(const RefPtr<SkFontMgr>&); |
118 static void setDeviceScaleFactor(float deviceScaleFactor) { s_deviceScaleFac
tor = deviceScaleFactor; } | 117 static void setDeviceScaleFactor(float deviceScaleFactor) { s_deviceScaleFac
tor = deviceScaleFactor; } |
119 static void setUseSubpixelPositioning(bool useSubpixelPositioning) { s_useSu
bpixelPositioning = useSubpixelPositioning; } | 118 static void setUseSubpixelPositioning(bool useSubpixelPositioning) { s_useSu
bpixelPositioning = useSubpixelPositioning; } |
120 static void addSideloadedFontForTesting(SkTypeface*); | 119 static void addSideloadedFontForTesting(SkTypeface*); |
121 // Functions to cache and retrieve the system font metrics. | 120 // Functions to cache and retrieve the system font metrics. |
122 static void setMenuFontMetrics(const wchar_t* familyName, int32_t fontHeight
); | 121 static void setMenuFontMetrics(const wchar_t* familyName, int32_t fontHeight
); |
123 static void setSmallCaptionFontMetrics(const wchar_t* familyName, int32_t fo
ntHeight); | 122 static void setSmallCaptionFontMetrics(const wchar_t* familyName, int32_t fo
ntHeight); |
124 static void setStatusFontMetrics(const wchar_t* familyName, int32_t fontHeig
ht); | 123 static void setStatusFontMetrics(const wchar_t* familyName, int32_t fontHeig
ht); |
125 static int32_t menuFontHeight() { return s_menuFontHeight; } | 124 static int32_t menuFontHeight() { return s_menuFontHeight; } |
126 static const AtomicString& menuFontFamily() { return *s_smallCaptionFontFami
lyName; } | 125 static const AtomicString& menuFontFamily() { return *s_smallCaptionFontFami
lyName; } |
127 static int32_t smallCaptionFontHeight() { return s_smallCaptionFontHeight; } | 126 static int32_t smallCaptionFontHeight() { return s_smallCaptionFontHeight; } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 180 |
182 template <FontFallbackPriority fallbackPriority> | 181 template <FontFallbackPriority fallbackPriority> |
183 const Vector<AtomicString>* initAndGetFontListForFallbackPriority(const Font
Description&); | 182 const Vector<AtomicString>* initAndGetFontListForFallbackPriority(const Font
Description&); |
184 | 183 |
185 const Vector<AtomicString> platformFontListForFallbackPriority(FontFallbackP
riority) const; | 184 const Vector<AtomicString> platformFontListForFallbackPriority(FontFallbackP
riority) const; |
186 | 185 |
187 // Don't purge if this count is > 0; | 186 // Don't purge if this count is > 0; |
188 int m_purgePreventCount; | 187 int m_purgePreventCount; |
189 | 188 |
190 #if OS(WIN) | 189 #if OS(WIN) |
191 OwnPtr<SkFontMgr> m_fontManager; | 190 RefPtr<SkFontMgr> m_fontManager; |
192 static bool s_useDirectWrite; | 191 static bool s_useDirectWrite; |
193 static IDWriteFactory* s_directWriteFactory; | 192 static SkFontMgr* s_fontManager; |
194 static float s_deviceScaleFactor; | 193 static float s_deviceScaleFactor; |
195 static bool s_useSubpixelPositioning; | 194 static bool s_useSubpixelPositioning; |
196 static HashMap<String, RefPtr<SkTypeface>>* s_sideloadedFonts; | 195 static HashMap<String, RefPtr<SkTypeface>>* s_sideloadedFonts; |
197 // The system font metrics cache. | 196 // The system font metrics cache. |
198 static AtomicString* s_menuFontFamilyName; | 197 static AtomicString* s_menuFontFamilyName; |
199 static int32_t s_menuFontHeight; | 198 static int32_t s_menuFontHeight; |
200 static AtomicString* s_smallCaptionFontFamilyName; | 199 static AtomicString* s_smallCaptionFontFamilyName; |
201 static int32_t s_smallCaptionFontHeight; | 200 static int32_t s_smallCaptionFontHeight; |
202 static AtomicString* s_statusFontFamilyName; | 201 static AtomicString* s_statusFontFamilyName; |
203 static int32_t s_statusFontHeight; | 202 static int32_t s_statusFontHeight; |
204 #endif | 203 #endif |
205 | 204 |
206 friend class SimpleFontData; // For fontDataFromFontPlatformData | 205 friend class SimpleFontData; // For fontDataFromFontPlatformData |
207 friend class FontFallbackList; | 206 friend class FontFallbackList; |
208 }; | 207 }; |
209 | 208 |
210 class PLATFORM_EXPORT FontCachePurgePreventer { | 209 class PLATFORM_EXPORT FontCachePurgePreventer { |
211 USING_FAST_MALLOC(FontCachePurgePreventer); | 210 USING_FAST_MALLOC(FontCachePurgePreventer); |
212 WTF_MAKE_NONCOPYABLE(FontCachePurgePreventer); | 211 WTF_MAKE_NONCOPYABLE(FontCachePurgePreventer); |
213 public: | 212 public: |
214 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } | 213 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } |
215 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } | 214 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } |
216 }; | 215 }; |
217 | 216 |
218 } // namespace blink | 217 } // namespace blink |
219 | 218 |
220 #endif | 219 #endif |
OLD | NEW |