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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #endif | 47 #endif |
48 | 48 |
49 #if OS(WIN) && !ENABLE(GDI_FONTS_ON_WINDOWS) | 49 #if OS(WIN) && !ENABLE(GDI_FONTS_ON_WINDOWS) |
50 #include "SkFontMgr.h" | 50 #include "SkFontMgr.h" |
51 #endif | 51 #endif |
52 | 52 |
53 class SkTypeface; | 53 class SkTypeface; |
54 | 54 |
55 namespace WebCore { | 55 namespace WebCore { |
56 | 56 |
| 57 class FontCacheClient; |
57 class FontPlatformData; | 58 class FontPlatformData; |
58 class FontData; | 59 class FontData; |
59 class FontDescription; | 60 class FontDescription; |
60 class FontSelector; | |
61 class OpenTypeVerticalData; | 61 class OpenTypeVerticalData; |
62 class SimpleFontData; | 62 class SimpleFontData; |
63 | 63 |
64 enum ShouldRetain { Retain, DoNotRetain }; | 64 enum ShouldRetain { Retain, DoNotRetain }; |
65 enum PurgeSeverity { PurgeIfNeeded, ForcePurge }; | 65 enum PurgeSeverity { PurgeIfNeeded, ForcePurge }; |
66 | 66 |
67 class PLATFORM_EXPORT FontCache { | 67 class PLATFORM_EXPORT FontCache { |
68 friend class FontCachePurgePreventer; | 68 friend class FontCachePurgePreventer; |
69 | 69 |
70 WTF_MAKE_NONCOPYABLE(FontCache); WTF_MAKE_FAST_ALLOCATED; | 70 WTF_MAKE_NONCOPYABLE(FontCache); WTF_MAKE_FAST_ALLOCATED; |
71 public: | 71 public: |
72 static FontCache* fontCache(); | 72 static FontCache* fontCache(); |
73 | 73 |
74 void releaseFontData(const SimpleFontData*); | 74 void releaseFontData(const SimpleFontData*); |
75 | 75 |
76 // This method is implemented by the plaform and used by | 76 // This method is implemented by the plaform and used by |
77 // FontFastPath to lookup the font for a given character. | 77 // FontFastPath to lookup the font for a given character. |
78 PassRefPtr<SimpleFontData> platformFallbackForCharacter(const FontDescriptio
n&, UChar32, const SimpleFontData* fontDataToSubstitute, bool disallowSynthetics
); | 78 PassRefPtr<SimpleFontData> platformFallbackForCharacter(const FontDescriptio
n&, UChar32, const SimpleFontData* fontDataToSubstitute, bool disallowSynthetics
); |
79 | 79 |
80 // Also implemented by the platform. | 80 // Also implemented by the platform. |
81 void platformInit(); | 81 void platformInit(); |
82 | 82 |
83 PassRefPtr<SimpleFontData> getFontData(const FontDescription&, const AtomicS
tring&, bool checkingAlternateName = false, ShouldRetain = Retain); | 83 PassRefPtr<SimpleFontData> getFontData(const FontDescription&, const AtomicS
tring&, bool checkingAlternateName = false, ShouldRetain = Retain); |
84 PassRefPtr<SimpleFontData> getLastResortFallbackFont(const FontDescription&,
ShouldRetain = Retain); | 84 PassRefPtr<SimpleFontData> getLastResortFallbackFont(const FontDescription&,
ShouldRetain = Retain); |
85 SimpleFontData* getNonRetainedLastResortFallbackFont(const FontDescription&)
; | 85 SimpleFontData* getNonRetainedLastResortFallbackFont(const FontDescription&)
; |
86 bool isPlatformFontAvailable(const FontDescription&, const AtomicString&); | 86 bool isPlatformFontAvailable(const FontDescription&, const AtomicString&); |
87 | 87 |
88 void addClient(FontSelector*); | 88 void addClient(FontCacheClient*); |
89 void removeClient(FontSelector*); | 89 void removeClient(FontCacheClient*); |
90 | 90 |
91 unsigned short generation(); | 91 unsigned short generation(); |
92 void invalidate(); | 92 void invalidate(); |
93 | 93 |
94 #if OS(WIN) | 94 #if OS(WIN) |
95 PassRefPtr<SimpleFontData> fontDataFromDescriptionAndLogFont(const FontDescr
iption&, ShouldRetain, const LOGFONT&, wchar_t* outFontFamilyName); | 95 PassRefPtr<SimpleFontData> fontDataFromDescriptionAndLogFont(const FontDescr
iption&, ShouldRetain, const LOGFONT&, wchar_t* outFontFamilyName); |
96 #endif | 96 #endif |
97 | 97 |
98 #if OS(WIN) && !ENABLE(GDI_FONTS_ON_WINDOWS) | 98 #if OS(WIN) && !ENABLE(GDI_FONTS_ON_WINDOWS) |
99 bool useSubpixelPositioning() const { return m_useSubpixelPositioning; } | 99 bool useSubpixelPositioning() const { return m_useSubpixelPositioning; } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 class PLATFORM_EXPORT FontCachePurgePreventer { | 159 class PLATFORM_EXPORT FontCachePurgePreventer { |
160 public: | 160 public: |
161 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } | 161 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } |
162 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } | 162 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } |
163 }; | 163 }; |
164 | 164 |
165 } | 165 } |
166 | 166 |
167 #endif | 167 #endif |
OLD | NEW |