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

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

Issue 1682813004: Revert of Add plumbing in blink to allow overriding the default font collection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
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 28 matching lines...) Expand all
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;
49 #endif 50 #endif
50 51
51 class SkTypeface; 52 class SkTypeface;
52 53
53 namespace blink { 54 namespace blink {
54 55
55 class FontCacheClient; 56 class FontCacheClient;
56 class FontFaceCreationParams; 57 class FontFaceCreationParams;
57 class FontPlatformData; 58 class FontPlatformData;
58 class FontDescription; 59 class FontDescription;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 100
100 unsigned short generation(); 101 unsigned short generation();
101 void invalidate(); 102 void invalidate();
102 103
103 #if OS(WIN) 104 #if OS(WIN)
104 bool useSubpixelPositioning() const { return s_useSubpixelPositioning; } 105 bool useSubpixelPositioning() const { return s_useSubpixelPositioning; }
105 SkFontMgr* fontManager() { return m_fontManager.get(); } 106 SkFontMgr* fontManager() { return m_fontManager.get(); }
106 static bool useDirectWrite() { return s_useDirectWrite; } 107 static bool useDirectWrite() { return s_useDirectWrite; }
107 static float deviceScaleFactor() { return s_deviceScaleFactor; } 108 static float deviceScaleFactor() { return s_deviceScaleFactor; }
108 static void setUseDirectWrite(bool useDirectWrite) { s_useDirectWrite = useD irectWrite; } 109 static void setUseDirectWrite(bool useDirectWrite) { s_useDirectWrite = useD irectWrite; }
109 static void setFontManager(const RefPtr<SkFontMgr>&); 110 static void setDirectWriteFactory(IDWriteFactory* factory) { s_directWriteFa ctory = factory; }
110 static void setDeviceScaleFactor(float deviceScaleFactor) { s_deviceScaleFac tor = deviceScaleFactor; } 111 static void setDeviceScaleFactor(float deviceScaleFactor) { s_deviceScaleFac tor = deviceScaleFactor; }
111 static void setUseSubpixelPositioning(bool useSubpixelPositioning) { s_useSu bpixelPositioning = useSubpixelPositioning; } 112 static void setUseSubpixelPositioning(bool useSubpixelPositioning) { s_useSu bpixelPositioning = useSubpixelPositioning; }
112 static void addSideloadedFontForTesting(SkTypeface*); 113 static void addSideloadedFontForTesting(SkTypeface*);
113 // Functions to cache and retrieve the system font metrics. 114 // Functions to cache and retrieve the system font metrics.
114 static void setMenuFontMetrics(const wchar_t* familyName, int32_t fontHeight ); 115 static void setMenuFontMetrics(const wchar_t* familyName, int32_t fontHeight );
115 static void setSmallCaptionFontMetrics(const wchar_t* familyName, int32_t fo ntHeight); 116 static void setSmallCaptionFontMetrics(const wchar_t* familyName, int32_t fo ntHeight);
116 static void setStatusFontMetrics(const wchar_t* familyName, int32_t fontHeig ht); 117 static void setStatusFontMetrics(const wchar_t* familyName, int32_t fontHeig ht);
117 static int32_t menuFontHeight() { return s_menuFontHeight; } 118 static int32_t menuFontHeight() { return s_menuFontHeight; }
118 static const AtomicString& menuFontFamily() { return *s_smallCaptionFontFami lyName; } 119 static const AtomicString& menuFontFamily() { return *s_smallCaptionFontFami lyName; }
119 static int32_t smallCaptionFontHeight() { return s_smallCaptionFontHeight; } 120 static int32_t smallCaptionFontHeight() { return s_smallCaptionFontHeight; }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 169
169 // Implemented on skia platforms. 170 // Implemented on skia platforms.
170 PassRefPtr<SkTypeface> createTypeface(const FontDescription&, const FontFace CreationParams&, CString& name); 171 PassRefPtr<SkTypeface> createTypeface(const FontDescription&, const FontFace CreationParams&, CString& name);
171 172
172 PassRefPtr<SimpleFontData> fallbackOnStandardFontStyle(const FontDescription &, UChar32); 173 PassRefPtr<SimpleFontData> fallbackOnStandardFontStyle(const FontDescription &, UChar32);
173 174
174 // Don't purge if this count is > 0; 175 // Don't purge if this count is > 0;
175 int m_purgePreventCount; 176 int m_purgePreventCount;
176 177
177 #if OS(WIN) 178 #if OS(WIN)
178 RefPtr<SkFontMgr> m_fontManager; 179 OwnPtr<SkFontMgr> m_fontManager;
179 static bool s_useDirectWrite; 180 static bool s_useDirectWrite;
180 static SkFontMgr* s_fontManager; 181 static IDWriteFactory* s_directWriteFactory;
181 static float s_deviceScaleFactor; 182 static float s_deviceScaleFactor;
182 static bool s_useSubpixelPositioning; 183 static bool s_useSubpixelPositioning;
183 static HashMap<String, RefPtr<SkTypeface>>* s_sideloadedFonts; 184 static HashMap<String, RefPtr<SkTypeface>>* s_sideloadedFonts;
184 // The system font metrics cache. 185 // The system font metrics cache.
185 static AtomicString* s_menuFontFamilyName; 186 static AtomicString* s_menuFontFamilyName;
186 static int32_t s_menuFontHeight; 187 static int32_t s_menuFontHeight;
187 static AtomicString* s_smallCaptionFontFamilyName; 188 static AtomicString* s_smallCaptionFontFamilyName;
188 static int32_t s_smallCaptionFontHeight; 189 static int32_t s_smallCaptionFontHeight;
189 static AtomicString* s_statusFontFamilyName; 190 static AtomicString* s_statusFontFamilyName;
190 static int32_t s_statusFontHeight; 191 static int32_t s_statusFontHeight;
191 #endif 192 #endif
192 193
193 friend class SimpleFontData; // For fontDataFromFontPlatformData 194 friend class SimpleFontData; // For fontDataFromFontPlatformData
194 friend class FontFallbackList; 195 friend class FontFallbackList;
195 }; 196 };
196 197
197 class PLATFORM_EXPORT FontCachePurgePreventer { 198 class PLATFORM_EXPORT FontCachePurgePreventer {
198 USING_FAST_MALLOC(FontCachePurgePreventer); 199 USING_FAST_MALLOC(FontCachePurgePreventer);
199 WTF_MAKE_NONCOPYABLE(FontCachePurgePreventer); 200 WTF_MAKE_NONCOPYABLE(FontCachePurgePreventer);
200 public: 201 public:
201 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } 202 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); }
202 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } 203 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); }
203 }; 204 };
204 205
205 } // namespace blink 206 } // namespace blink
206 207
207 #endif 208 #endif
OLDNEW
« no previous file with comments | « content/child/font_warmup_win.cc ('k') | third_party/WebKit/Source/platform/fonts/FontCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698