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 28 matching lines...) Expand all Loading... |
39 #include "wtf/HashMap.h" | 39 #include "wtf/HashMap.h" |
40 #include "wtf/PassRefPtr.h" | 40 #include "wtf/PassRefPtr.h" |
41 #include "wtf/RefPtr.h" | 41 #include "wtf/RefPtr.h" |
42 #include "wtf/text/CString.h" | 42 #include "wtf/text/CString.h" |
43 #include "wtf/text/Unicode.h" | 43 #include "wtf/text/Unicode.h" |
44 #include "wtf/text/WTFString.h" | 44 #include "wtf/text/WTFString.h" |
45 #include <limits.h> | 45 #include <limits.h> |
46 | 46 |
47 #if OS(WIN) | 47 #if OS(WIN) |
48 #include "SkFontMgr.h" | 48 #include "SkFontMgr.h" |
49 struct IDWriteFactory; | |
50 #endif | 49 #endif |
51 | 50 |
52 class SkTypeface; | 51 class SkTypeface; |
53 | 52 |
54 namespace blink { | 53 namespace blink { |
55 | 54 |
56 class FontCacheClient; | 55 class FontCacheClient; |
57 class FontFaceCreationParams; | 56 class FontFaceCreationParams; |
58 class FontPlatformData; | 57 class FontPlatformData; |
59 class FontDescription; | 58 class FontDescription; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 99 |
101 unsigned short generation(); | 100 unsigned short generation(); |
102 void invalidate(); | 101 void invalidate(); |
103 | 102 |
104 #if OS(WIN) | 103 #if OS(WIN) |
105 bool useSubpixelPositioning() const { return s_useSubpixelPositioning; } | 104 bool useSubpixelPositioning() const { return s_useSubpixelPositioning; } |
106 SkFontMgr* fontManager() { return m_fontManager.get(); } | 105 SkFontMgr* fontManager() { return m_fontManager.get(); } |
107 static bool useDirectWrite() { return s_useDirectWrite; } | 106 static bool useDirectWrite() { return s_useDirectWrite; } |
108 static float deviceScaleFactor() { return s_deviceScaleFactor; } | 107 static float deviceScaleFactor() { return s_deviceScaleFactor; } |
109 static void setUseDirectWrite(bool useDirectWrite) { s_useDirectWrite = useD
irectWrite; } | 108 static void setUseDirectWrite(bool useDirectWrite) { s_useDirectWrite = useD
irectWrite; } |
110 static void setDirectWriteFactory(IDWriteFactory* factory) { s_directWriteFa
ctory = factory; } | 109 static void setFontManager(const RefPtr<SkFontMgr>&); |
111 static void setDeviceScaleFactor(float deviceScaleFactor) { s_deviceScaleFac
tor = deviceScaleFactor; } | 110 static void setDeviceScaleFactor(float deviceScaleFactor) { s_deviceScaleFac
tor = deviceScaleFactor; } |
112 static void setUseSubpixelPositioning(bool useSubpixelPositioning) { s_useSu
bpixelPositioning = useSubpixelPositioning; } | 111 static void setUseSubpixelPositioning(bool useSubpixelPositioning) { s_useSu
bpixelPositioning = useSubpixelPositioning; } |
113 static void addSideloadedFontForTesting(SkTypeface*); | 112 static void addSideloadedFontForTesting(SkTypeface*); |
114 // Functions to cache and retrieve the system font metrics. | 113 // Functions to cache and retrieve the system font metrics. |
115 static void setMenuFontMetrics(const wchar_t* familyName, int32_t fontHeight
); | 114 static void setMenuFontMetrics(const wchar_t* familyName, int32_t fontHeight
); |
116 static void setSmallCaptionFontMetrics(const wchar_t* familyName, int32_t fo
ntHeight); | 115 static void setSmallCaptionFontMetrics(const wchar_t* familyName, int32_t fo
ntHeight); |
117 static void setStatusFontMetrics(const wchar_t* familyName, int32_t fontHeig
ht); | 116 static void setStatusFontMetrics(const wchar_t* familyName, int32_t fontHeig
ht); |
118 static int32_t menuFontHeight() { return s_menuFontHeight; } | 117 static int32_t menuFontHeight() { return s_menuFontHeight; } |
119 static const AtomicString& menuFontFamily() { return *s_smallCaptionFontFami
lyName; } | 118 static const AtomicString& menuFontFamily() { return *s_smallCaptionFontFami
lyName; } |
120 static int32_t smallCaptionFontHeight() { return s_smallCaptionFontHeight; } | 119 static int32_t smallCaptionFontHeight() { return s_smallCaptionFontHeight; } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 168 |
170 // Implemented on skia platforms. | 169 // Implemented on skia platforms. |
171 PassRefPtr<SkTypeface> createTypeface(const FontDescription&, const FontFace
CreationParams&, CString& name); | 170 PassRefPtr<SkTypeface> createTypeface(const FontDescription&, const FontFace
CreationParams&, CString& name); |
172 | 171 |
173 PassRefPtr<SimpleFontData> fallbackOnStandardFontStyle(const FontDescription
&, UChar32); | 172 PassRefPtr<SimpleFontData> fallbackOnStandardFontStyle(const FontDescription
&, UChar32); |
174 | 173 |
175 // Don't purge if this count is > 0; | 174 // Don't purge if this count is > 0; |
176 int m_purgePreventCount; | 175 int m_purgePreventCount; |
177 | 176 |
178 #if OS(WIN) | 177 #if OS(WIN) |
179 OwnPtr<SkFontMgr> m_fontManager; | 178 RefPtr<SkFontMgr> m_fontManager; |
180 static bool s_useDirectWrite; | 179 static bool s_useDirectWrite; |
181 static IDWriteFactory* s_directWriteFactory; | 180 static SkFontMgr* s_fontManager; |
182 static float s_deviceScaleFactor; | 181 static float s_deviceScaleFactor; |
183 static bool s_useSubpixelPositioning; | 182 static bool s_useSubpixelPositioning; |
184 static HashMap<String, RefPtr<SkTypeface>>* s_sideloadedFonts; | 183 static HashMap<String, RefPtr<SkTypeface>>* s_sideloadedFonts; |
185 // The system font metrics cache. | 184 // The system font metrics cache. |
186 static AtomicString* s_menuFontFamilyName; | 185 static AtomicString* s_menuFontFamilyName; |
187 static int32_t s_menuFontHeight; | 186 static int32_t s_menuFontHeight; |
188 static AtomicString* s_smallCaptionFontFamilyName; | 187 static AtomicString* s_smallCaptionFontFamilyName; |
189 static int32_t s_smallCaptionFontHeight; | 188 static int32_t s_smallCaptionFontHeight; |
190 static AtomicString* s_statusFontFamilyName; | 189 static AtomicString* s_statusFontFamilyName; |
191 static int32_t s_statusFontHeight; | 190 static int32_t s_statusFontHeight; |
192 #endif | 191 #endif |
193 | 192 |
194 friend class SimpleFontData; // For fontDataFromFontPlatformData | 193 friend class SimpleFontData; // For fontDataFromFontPlatformData |
195 friend class FontFallbackList; | 194 friend class FontFallbackList; |
196 }; | 195 }; |
197 | 196 |
198 class PLATFORM_EXPORT FontCachePurgePreventer { | 197 class PLATFORM_EXPORT FontCachePurgePreventer { |
199 USING_FAST_MALLOC(FontCachePurgePreventer); | 198 USING_FAST_MALLOC(FontCachePurgePreventer); |
200 WTF_MAKE_NONCOPYABLE(FontCachePurgePreventer); | 199 WTF_MAKE_NONCOPYABLE(FontCachePurgePreventer); |
201 public: | 200 public: |
202 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } | 201 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } |
203 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } | 202 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } |
204 }; | 203 }; |
205 | 204 |
206 } // namespace blink | 205 } // namespace blink |
207 | 206 |
208 #endif | 207 #endif |
OLD | NEW |