OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
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 10 matching lines...) Expand all Loading... |
21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | 21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 */ | 28 */ |
29 | 29 |
30 #include "config.h" | 30 #include "config.h" |
31 #include "core/platform/graphics/FontCache.h" | 31 #include "platform/fonts/FontCache.h" |
32 | 32 |
33 #include "FontFamilyNames.h" | 33 #include "FontFamilyNames.h" |
34 | 34 |
35 #include "RuntimeEnabledFeatures.h" | 35 #include "RuntimeEnabledFeatures.h" |
36 #include "core/platform/graphics/FontDataCache.h" | |
37 #include "core/platform/graphics/FontFallbackList.h" | |
38 #include "core/platform/graphics/FontPlatformData.h" | |
39 #include "core/platform/graphics/opentype/OpenTypeVerticalData.h" | |
40 #include "platform/fonts/AlternateFontFamily.h" | 36 #include "platform/fonts/AlternateFontFamily.h" |
41 #include "platform/fonts/FontCacheKey.h" | 37 #include "platform/fonts/FontCacheKey.h" |
| 38 #include "platform/fonts/FontDataCache.h" |
42 #include "platform/fonts/FontDescription.h" | 39 #include "platform/fonts/FontDescription.h" |
| 40 #include "platform/fonts/FontFallbackList.h" |
| 41 #include "platform/fonts/FontPlatformData.h" |
43 #include "platform/fonts/FontSelector.h" | 42 #include "platform/fonts/FontSelector.h" |
44 #include "platform/fonts/FontSmoothingMode.h" | 43 #include "platform/fonts/FontSmoothingMode.h" |
45 #include "platform/fonts/TextRenderingMode.h" | 44 #include "platform/fonts/TextRenderingMode.h" |
| 45 #include "platform/fonts/opentype/OpenTypeVerticalData.h" |
46 #include "wtf/HashMap.h" | 46 #include "wtf/HashMap.h" |
47 #include "wtf/ListHashSet.h" | 47 #include "wtf/ListHashSet.h" |
48 #include "wtf/StdLibExtras.h" | 48 #include "wtf/StdLibExtras.h" |
49 #include "wtf/text/AtomicStringHash.h" | 49 #include "wtf/text/AtomicStringHash.h" |
50 #include "wtf/text/StringHash.h" | 50 #include "wtf/text/StringHash.h" |
51 | 51 |
52 using namespace WTF; | 52 using namespace WTF; |
53 | 53 |
54 namespace WebCore { | 54 namespace WebCore { |
55 | 55 |
56 FontCache* fontCache() | |
57 { | |
58 DEFINE_STATIC_LOCAL(FontCache, globalFontCache, ()); | |
59 return &globalFontCache; | |
60 } | |
61 | |
62 #if !OS(WIN) || ENABLE(GDI_FONTS_ON_WINDOWS) | 56 #if !OS(WIN) || ENABLE(GDI_FONTS_ON_WINDOWS) |
63 FontCache::FontCache() | 57 FontCache::FontCache() |
64 : m_purgePreventCount(0) | 58 : m_purgePreventCount(0) |
65 { | 59 { |
66 } | 60 } |
67 #endif // !OS(WIN) || ENABLE(GDI_FONTS_ON_WINDOWS) | 61 #endif // !OS(WIN) || ENABLE(GDI_FONTS_ON_WINDOWS) |
68 | 62 |
69 typedef HashMap<FontCacheKey, OwnPtr<FontPlatformData>, FontCacheKeyHash, FontCa
cheKeyTraits> FontPlatformDataCache; | 63 typedef HashMap<FontCacheKey, OwnPtr<FontPlatformData>, FontCacheKeyHash, FontCa
cheKeyTraits> FontPlatformDataCache; |
70 | 64 |
71 static FontPlatformDataCache* gFontPlatformDataCache = 0; | 65 static FontPlatformDataCache* gFontPlatformDataCache = 0; |
72 | 66 |
| 67 FontCache* FontCache::fontCache() |
| 68 { |
| 69 DEFINE_STATIC_LOCAL(FontCache, globalFontCache, ()); |
| 70 return &globalFontCache; |
| 71 } |
| 72 |
73 FontPlatformData* FontCache::getFontPlatformData(const FontDescription& fontDesc
ription, | 73 FontPlatformData* FontCache::getFontPlatformData(const FontDescription& fontDesc
ription, |
74 const AtomicString& passedFamilyName, bool checkingAlternateName) | 74 const AtomicString& passedFamilyName, bool checkingAlternateName) |
75 { | 75 { |
76 #if OS(WIN) && ENABLE(OPENTYPE_VERTICAL) | 76 #if OS(WIN) && ENABLE(OPENTYPE_VERTICAL) |
77 // Leading "@" in the font name enables Windows vertical flow flag for the f
ont. | 77 // Leading "@" in the font name enables Windows vertical flow flag for the f
ont. |
78 // Because we do vertical flow by ourselves, we don't want to use the Window
s feature. | 78 // Because we do vertical flow by ourselves, we don't want to use the Window
s feature. |
79 // IE disregards "@" regardless of the orientatoin, so we follow the behavio
r. | 79 // IE disregards "@" regardless of the orientatoin, so we follow the behavio
r. |
80 const AtomicString& familyName = (passedFamilyName.isEmpty() || passedFamily
Name[0] != '@') ? | 80 const AtomicString& familyName = (passedFamilyName.isEmpty() || passedFamily
Name[0] != '@') ? |
81 passedFamilyName : AtomicString(passedFamilyName.impl()->substring(1)); | 81 passedFamilyName : AtomicString(passedFamilyName.impl()->substring(1)); |
82 #else | 82 #else |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 clients.append(*it); | 285 clients.append(*it); |
286 | 286 |
287 ASSERT(numClients == clients.size()); | 287 ASSERT(numClients == clients.size()); |
288 for (size_t i = 0; i < numClients; ++i) | 288 for (size_t i = 0; i < numClients; ++i) |
289 clients[i]->fontCacheInvalidated(); | 289 clients[i]->fontCacheInvalidated(); |
290 | 290 |
291 purge(ForcePurge); | 291 purge(ForcePurge); |
292 } | 292 } |
293 | 293 |
294 } // namespace WebCore | 294 } // namespace WebCore |
OLD | NEW |