| 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 17 matching lines...) Expand all Loading... |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #ifndef FontCache_h | 30 #ifndef FontCache_h |
| 31 #define FontCache_h | 31 #define FontCache_h |
| 32 | 32 |
| 33 #include <limits.h> | 33 #include <limits.h> |
| 34 #include "wtf/Forward.h" | 34 #include "wtf/Forward.h" |
| 35 #include "wtf/PassRefPtr.h" | 35 #include "wtf/PassRefPtr.h" |
| 36 #include "wtf/RefPtr.h" | 36 #include "wtf/RefPtr.h" |
| 37 #include "wtf/Vector.h" | 37 #include "wtf/Vector.h" |
| 38 #include "wtf/text/CString.h" |
| 38 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
| 39 #include "wtf/unicode/Unicode.h" | 40 #include "wtf/unicode/Unicode.h" |
| 40 | 41 |
| 41 #if OS(WINDOWS) | 42 #if OS(WINDOWS) |
| 42 #include <windows.h> | 43 #include <windows.h> |
| 43 #include <objidl.h> | 44 #include <objidl.h> |
| 44 #include <mlang.h> | 45 #include <mlang.h> |
| 45 #endif | 46 #endif |
| 46 | 47 |
| 48 class SkTypeface; |
| 49 |
| 47 namespace WebCore { | 50 namespace WebCore { |
| 48 | 51 |
| 49 class Font; | 52 class Font; |
| 50 class FontPlatformData; | 53 class FontPlatformData; |
| 51 class FontData; | 54 class FontData; |
| 52 class FontDescription; | 55 class FontDescription; |
| 53 class FontSelector; | 56 class FontSelector; |
| 54 class OpenTypeVerticalData; | 57 class OpenTypeVerticalData; |
| 55 class SimpleFontData; | 58 class SimpleFontData; |
| 56 | 59 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 122 |
| 120 void purgeInactiveFontDataIfNeeded(); | 123 void purgeInactiveFontDataIfNeeded(); |
| 121 | 124 |
| 122 // FIXME: This method should eventually be removed. | 125 // FIXME: This method should eventually be removed. |
| 123 FontPlatformData* getFontResourcePlatformData(const FontDescription&, const
AtomicString& family, bool checkingAlternateName = false); | 126 FontPlatformData* getFontResourcePlatformData(const FontDescription&, const
AtomicString& family, bool checkingAlternateName = false); |
| 124 | 127 |
| 125 // These methods are implemented by each platform. | 128 // These methods are implemented by each platform. |
| 126 PassRefPtr<SimpleFontData> getSimilarFontPlatformData(const Font&); | 129 PassRefPtr<SimpleFontData> getSimilarFontPlatformData(const Font&); |
| 127 FontPlatformData* createFontPlatformData(const FontDescription&, const Atomi
cString& family); | 130 FontPlatformData* createFontPlatformData(const FontDescription&, const Atomi
cString& family); |
| 128 | 131 |
| 132 // Implemented on skia platforms. |
| 133 SkTypeface* createTypeface(const FontDescription&, const AtomicString& famil
y, CString& name); |
| 134 |
| 129 PassRefPtr<SimpleFontData> getFontResourceData(const FontPlatformData*, Shou
ldRetain = Retain); | 135 PassRefPtr<SimpleFontData> getFontResourceData(const FontPlatformData*, Shou
ldRetain = Retain); |
| 130 const FontPlatformData* getFallbackFontData(const FontDescription&); | 136 const FontPlatformData* getFallbackFontData(const FontDescription&); |
| 131 | 137 |
| 132 // Don't purge if this count is > 0; | 138 // Don't purge if this count is > 0; |
| 133 int m_purgePreventCount; | 139 int m_purgePreventCount; |
| 134 | 140 |
| 135 #if OS(DARWIN) || OS(ANDROID) | 141 #if OS(DARWIN) || OS(ANDROID) |
| 136 friend class ComplexTextController; | 142 friend class ComplexTextController; |
| 137 #endif | 143 #endif |
| 138 friend class SimpleFontData; // For getFontResourceData(const FontPlatformDa
ta*) | 144 friend class SimpleFontData; // For getFontResourceData(const FontPlatformDa
ta*) |
| 139 friend class FontFallbackList; | 145 friend class FontFallbackList; |
| 140 }; | 146 }; |
| 141 | 147 |
| 142 // Get the global fontCache. | 148 // Get the global fontCache. |
| 143 FontCache* fontCache(); | 149 FontCache* fontCache(); |
| 144 | 150 |
| 145 class FontCachePurgePreventer { | 151 class FontCachePurgePreventer { |
| 146 public: | 152 public: |
| 147 FontCachePurgePreventer() { fontCache()->disablePurging(); } | 153 FontCachePurgePreventer() { fontCache()->disablePurging(); } |
| 148 ~FontCachePurgePreventer() { fontCache()->enablePurging(); } | 154 ~FontCachePurgePreventer() { fontCache()->enablePurging(); } |
| 149 }; | 155 }; |
| 150 | 156 |
| 151 } | 157 } |
| 152 | 158 |
| 153 #endif | 159 #endif |
| OLD | NEW |