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

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

Issue 1685053002: blink fonts: Load Android SkFontMgr on Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@windows_change
Patch Set: Rebase. Created 4 years, 9 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 27 matching lines...) Expand all
38 #include "wtf/Allocator.h" 38 #include "wtf/Allocator.h"
39 #include "wtf/Forward.h" 39 #include "wtf/Forward.h"
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)
49 #include "SkFontMgr.h" 48 #include "SkFontMgr.h"
50 #endif
51 49
52 class SkTypeface; 50 class SkTypeface;
53 51
54 namespace blink { 52 namespace blink {
55 53
56 class FontCacheClient; 54 class FontCacheClient;
57 class FontFaceCreationParams; 55 class FontFaceCreationParams;
58 class FontPlatformData; 56 class FontPlatformData;
59 class FontDescription; 57 class FontDescription;
60 class OpenTypeVerticalData; 58 class OpenTypeVerticalData;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 ShapeCache* getShapeCache(const FallbackListCompositeKey&); 98 ShapeCache* getShapeCache(const FallbackListCompositeKey&);
101 99
102 void addClient(FontCacheClient*); 100 void addClient(FontCacheClient*);
103 #if !ENABLE(OILPAN) 101 #if !ENABLE(OILPAN)
104 void removeClient(FontCacheClient*); 102 void removeClient(FontCacheClient*);
105 #endif 103 #endif
106 104
107 unsigned short generation(); 105 unsigned short generation();
108 void invalidate(); 106 void invalidate();
109 107
108 SkFontMgr* fontManager() { return m_fontManager.get(); }
109 static void setFontManager(const RefPtr<SkFontMgr>&);
110
110 #if OS(WIN) 111 #if OS(WIN)
111 bool useSubpixelPositioning() const { return s_useSubpixelPositioning; } 112 bool useSubpixelPositioning() const { return s_useSubpixelPositioning; }
112 SkFontMgr* fontManager() { return m_fontManager.get(); }
113 static bool useDirectWrite() { return s_useDirectWrite; } 113 static bool useDirectWrite() { return s_useDirectWrite; }
114 static float deviceScaleFactor() { return s_deviceScaleFactor; } 114 static float deviceScaleFactor() { return s_deviceScaleFactor; }
115 static void setUseDirectWrite(bool useDirectWrite) { s_useDirectWrite = useD irectWrite; } 115 static void setUseDirectWrite(bool useDirectWrite) { s_useDirectWrite = useD irectWrite; }
116 static void setFontManager(const RefPtr<SkFontMgr>&);
117 static void setDeviceScaleFactor(float deviceScaleFactor) { s_deviceScaleFac tor = deviceScaleFactor; } 116 static void setDeviceScaleFactor(float deviceScaleFactor) { s_deviceScaleFac tor = deviceScaleFactor; }
118 static void setUseSubpixelPositioning(bool useSubpixelPositioning) { s_useSu bpixelPositioning = useSubpixelPositioning; } 117 static void setUseSubpixelPositioning(bool useSubpixelPositioning) { s_useSu bpixelPositioning = useSubpixelPositioning; }
119 static void addSideloadedFontForTesting(SkTypeface*); 118 static void addSideloadedFontForTesting(SkTypeface*);
120 // Functions to cache and retrieve the system font metrics. 119 // Functions to cache and retrieve the system font metrics.
121 static void setMenuFontMetrics(const wchar_t* familyName, int32_t fontHeight ); 120 static void setMenuFontMetrics(const wchar_t* familyName, int32_t fontHeight );
122 static void setSmallCaptionFontMetrics(const wchar_t* familyName, int32_t fo ntHeight); 121 static void setSmallCaptionFontMetrics(const wchar_t* familyName, int32_t fo ntHeight);
123 static void setStatusFontMetrics(const wchar_t* familyName, int32_t fontHeig ht); 122 static void setStatusFontMetrics(const wchar_t* familyName, int32_t fontHeig ht);
124 static int32_t menuFontHeight() { return s_menuFontHeight; } 123 static int32_t menuFontHeight() { return s_menuFontHeight; }
125 static const AtomicString& menuFontFamily() { return *s_smallCaptionFontFami lyName; } 124 static const AtomicString& menuFontFamily() { return *s_smallCaptionFontFami lyName; }
126 static int32_t smallCaptionFontHeight() { return s_smallCaptionFontHeight; } 125 static int32_t smallCaptionFontHeight() { return s_smallCaptionFontHeight; }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 170
172 // FIXME: This method should eventually be removed. 171 // FIXME: This method should eventually be removed.
173 FontPlatformData* getFontPlatformData(const FontDescription&, const FontFace CreationParams&, bool checkingAlternateName = false); 172 FontPlatformData* getFontPlatformData(const FontDescription&, const FontFace CreationParams&, bool checkingAlternateName = false);
174 173
175 // These methods are implemented by each platform. 174 // These methods are implemented by each platform.
176 PassOwnPtr<FontPlatformData> createFontPlatformData(const FontDescription&, const FontFaceCreationParams&, float fontSize); 175 PassOwnPtr<FontPlatformData> createFontPlatformData(const FontDescription&, const FontFaceCreationParams&, float fontSize);
177 176
178 // Implemented on skia platforms. 177 // Implemented on skia platforms.
179 PassRefPtr<SkTypeface> createTypeface(const FontDescription&, const FontFace CreationParams&, CString& name); 178 PassRefPtr<SkTypeface> createTypeface(const FontDescription&, const FontFace CreationParams&, CString& name);
180 179
180 #if OS(ANDROID) || OS(LINUX)
181 static AtomicString getFamilyNameForCharacter(SkFontMgr*, UChar32, const Fon tDescription&);
182 #endif
183
181 PassRefPtr<SimpleFontData> fallbackOnStandardFontStyle(const FontDescription &, UChar32); 184 PassRefPtr<SimpleFontData> fallbackOnStandardFontStyle(const FontDescription &, UChar32);
182 185
183 template <FontFallbackPriority fallbackPriority> 186 template <FontFallbackPriority fallbackPriority>
184 const Vector<AtomicString>* initAndGetFontListForFallbackPriority(const Font Description&); 187 const Vector<AtomicString>* initAndGetFontListForFallbackPriority(const Font Description&);
185 188
186 const Vector<AtomicString> platformFontListForFallbackPriority(FontFallbackP riority) const; 189 const Vector<AtomicString> platformFontListForFallbackPriority(FontFallbackP riority) const;
187 190
188 // Don't purge if this count is > 0; 191 // Don't purge if this count is > 0;
189 int m_purgePreventCount; 192 int m_purgePreventCount;
190 193
194 RefPtr<SkFontMgr> m_fontManager;
195 static SkFontMgr* s_fontManager;
196
191 #if OS(WIN) 197 #if OS(WIN)
192 RefPtr<SkFontMgr> m_fontManager;
193 static bool s_useDirectWrite; 198 static bool s_useDirectWrite;
194 static SkFontMgr* s_fontManager;
195 static float s_deviceScaleFactor; 199 static float s_deviceScaleFactor;
196 static bool s_useSubpixelPositioning; 200 static bool s_useSubpixelPositioning;
197 static HashMap<String, RefPtr<SkTypeface>>* s_sideloadedFonts; 201 static HashMap<String, RefPtr<SkTypeface>>* s_sideloadedFonts;
198 // The system font metrics cache. 202 // The system font metrics cache.
199 static AtomicString* s_menuFontFamilyName; 203 static AtomicString* s_menuFontFamilyName;
200 static int32_t s_menuFontHeight; 204 static int32_t s_menuFontHeight;
201 static AtomicString* s_smallCaptionFontFamilyName; 205 static AtomicString* s_smallCaptionFontFamilyName;
202 static int32_t s_smallCaptionFontHeight; 206 static int32_t s_smallCaptionFontHeight;
203 static AtomicString* s_statusFontFamilyName; 207 static AtomicString* s_statusFontFamilyName;
204 static int32_t s_statusFontHeight; 208 static int32_t s_statusFontHeight;
205 #endif 209 #endif
206 210
207 friend class SimpleFontData; // For fontDataFromFontPlatformData 211 friend class SimpleFontData; // For fontDataFromFontPlatformData
208 friend class FontFallbackList; 212 friend class FontFallbackList;
209 }; 213 };
210 214
211 class PLATFORM_EXPORT FontCachePurgePreventer { 215 class PLATFORM_EXPORT FontCachePurgePreventer {
212 USING_FAST_MALLOC(FontCachePurgePreventer); 216 USING_FAST_MALLOC(FontCachePurgePreventer);
213 WTF_MAKE_NONCOPYABLE(FontCachePurgePreventer); 217 WTF_MAKE_NONCOPYABLE(FontCachePurgePreventer);
214 public: 218 public:
215 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } 219 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); }
216 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } 220 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); }
217 }; 221 };
218 222
219 } // namespace blink 223 } // namespace blink
220 224
221 #endif 225 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698