| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 182 |
| 184 template <FontFallbackPriority fallbackPriority> | 183 template <FontFallbackPriority fallbackPriority> |
| 185 const Vector<AtomicString>* initAndGetFontListForFallbackPriority(const Font
Description&); | 184 const Vector<AtomicString>* initAndGetFontListForFallbackPriority(const Font
Description&); |
| 186 | 185 |
| 187 const Vector<AtomicString> platformFontListForFallbackPriority(FontFallbackP
riority) const; | 186 const Vector<AtomicString> platformFontListForFallbackPriority(FontFallbackP
riority) const; |
| 188 | 187 |
| 189 // Don't purge if this count is > 0; | 188 // Don't purge if this count is > 0; |
| 190 int m_purgePreventCount; | 189 int m_purgePreventCount; |
| 191 | 190 |
| 192 #if OS(WIN) | 191 #if OS(WIN) |
| 193 OwnPtr<SkFontMgr> m_fontManager; | 192 RefPtr<SkFontMgr> m_fontManager; |
| 194 static bool s_useDirectWrite; | 193 static bool s_useDirectWrite; |
| 195 static IDWriteFactory* s_directWriteFactory; | 194 static SkFontMgr* s_fontManager; |
| 196 static float s_deviceScaleFactor; | 195 static float s_deviceScaleFactor; |
| 197 static bool s_useSubpixelPositioning; | 196 static bool s_useSubpixelPositioning; |
| 198 static HashMap<String, RefPtr<SkTypeface>>* s_sideloadedFonts; | 197 static HashMap<String, RefPtr<SkTypeface>>* s_sideloadedFonts; |
| 199 // The system font metrics cache. | 198 // The system font metrics cache. |
| 200 static AtomicString* s_menuFontFamilyName; | 199 static AtomicString* s_menuFontFamilyName; |
| 201 static int32_t s_menuFontHeight; | 200 static int32_t s_menuFontHeight; |
| 202 static AtomicString* s_smallCaptionFontFamilyName; | 201 static AtomicString* s_smallCaptionFontFamilyName; |
| 203 static int32_t s_smallCaptionFontHeight; | 202 static int32_t s_smallCaptionFontHeight; |
| 204 static AtomicString* s_statusFontFamilyName; | 203 static AtomicString* s_statusFontFamilyName; |
| 205 static int32_t s_statusFontHeight; | 204 static int32_t s_statusFontHeight; |
| 206 #endif | 205 #endif |
| 207 | 206 |
| 208 friend class SimpleFontData; // For fontDataFromFontPlatformData | 207 friend class SimpleFontData; // For fontDataFromFontPlatformData |
| 209 friend class FontFallbackList; | 208 friend class FontFallbackList; |
| 210 }; | 209 }; |
| 211 | 210 |
| 212 class PLATFORM_EXPORT FontCachePurgePreventer { | 211 class PLATFORM_EXPORT FontCachePurgePreventer { |
| 213 USING_FAST_MALLOC(FontCachePurgePreventer); | 212 USING_FAST_MALLOC(FontCachePurgePreventer); |
| 214 WTF_MAKE_NONCOPYABLE(FontCachePurgePreventer); | 213 WTF_MAKE_NONCOPYABLE(FontCachePurgePreventer); |
| 215 public: | 214 public: |
| 216 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } | 215 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } |
| 217 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } | 216 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } |
| 218 }; | 217 }; |
| 219 | 218 |
| 220 } // namespace blink | 219 } // namespace blink |
| 221 | 220 |
| 222 #endif | 221 #endif |
| OLD | NEW |