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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 friend class FontCachePurgePreventer; | 71 friend class FontCachePurgePreventer; |
72 | 72 |
73 WTF_MAKE_NONCOPYABLE(FontCache); WTF_MAKE_FAST_ALLOCATED; | 73 WTF_MAKE_NONCOPYABLE(FontCache); WTF_MAKE_FAST_ALLOCATED; |
74 public: | 74 public: |
75 static FontCache* fontCache(); | 75 static FontCache* fontCache(); |
76 | 76 |
77 void releaseFontData(const SimpleFontData*); | 77 void releaseFontData(const SimpleFontData*); |
78 | 78 |
79 // This method is implemented by the plaform and used by | 79 // This method is implemented by the plaform and used by |
80 // FontFastPath to lookup the font for a given character. | 80 // FontFastPath to lookup the font for a given character. |
81 PassRefPtr<SimpleFontData> platformFallbackForCharacter(const FontDescriptio
n&, UChar32, const SimpleFontData* fontDataToSubstitute); | 81 PassRefPtr<SimpleFontData> fallbackFontForCharacter(const FontDescription&,
UChar32, const SimpleFontData* fontDataToSubstitute); |
82 | 82 |
83 // Also implemented by the platform. | 83 // Also implemented by the platform. |
84 void platformInit(); | 84 void platformInit(); |
85 | 85 |
86 PassRefPtr<SimpleFontData> getFontData(const FontDescription&, const AtomicS
tring&, bool checkingAlternateName = false, ShouldRetain = Retain); | 86 PassRefPtr<SimpleFontData> getFontData(const FontDescription&, const AtomicS
tring&, bool checkingAlternateName = false, ShouldRetain = Retain); |
87 PassRefPtr<SimpleFontData> getLastResortFallbackFont(const FontDescription&,
ShouldRetain = Retain); | 87 PassRefPtr<SimpleFontData> getLastResortFallbackFont(const FontDescription&,
ShouldRetain = Retain); |
88 SimpleFontData* getNonRetainedLastResortFallbackFont(const FontDescription&)
; | 88 SimpleFontData* getNonRetainedLastResortFallbackFont(const FontDescription&)
; |
89 bool isPlatformFontAvailable(const FontDescription&, const AtomicString&); | 89 bool isPlatformFontAvailable(const FontDescription&, const AtomicString&); |
90 | 90 |
91 void addClient(FontCacheClient*); | 91 void addClient(FontCacheClient*); |
(...skipping 19 matching lines...) Expand all Loading... |
111 #endif | 111 #endif |
112 | 112 |
113 #if ENABLE(OPENTYPE_VERTICAL) | 113 #if ENABLE(OPENTYPE_VERTICAL) |
114 typedef uint32_t FontFileKey; | 114 typedef uint32_t FontFileKey; |
115 PassRefPtr<OpenTypeVerticalData> getVerticalData(const FontFileKey&, const F
ontPlatformData&); | 115 PassRefPtr<OpenTypeVerticalData> getVerticalData(const FontFileKey&, const F
ontPlatformData&); |
116 #endif | 116 #endif |
117 | 117 |
118 #if OS(ANDROID) | 118 #if OS(ANDROID) |
119 static AtomicString getGenericFamilyNameForScript(const AtomicString& family
Name, UScriptCode); | 119 static AtomicString getGenericFamilyNameForScript(const AtomicString& family
Name, UScriptCode); |
120 #else | 120 #else |
121 struct SimpleFontFamily { | 121 struct PlatformFallbackFont { |
122 String name; | 122 String name; |
| 123 CString filename; |
| 124 int ttcIndex; |
123 bool isBold; | 125 bool isBold; |
124 bool isItalic; | 126 bool isItalic; |
125 }; | 127 }; |
126 static void getFontFamilyForCharacter(UChar32, const char* preferredLocale,
SimpleFontFamily*); | 128 static void getFontForCharacter(UChar32, const char* preferredLocale, Platfo
rmFallbackFont*); |
127 #endif | 129 #endif |
128 | 130 |
129 private: | 131 private: |
130 FontCache(); | 132 FontCache(); |
131 ~FontCache(); | 133 ~FontCache(); |
132 | 134 |
133 void purge(PurgeSeverity = PurgeIfNeeded); | 135 void purge(PurgeSeverity = PurgeIfNeeded); |
134 | 136 |
135 void disablePurging() { m_purgePreventCount++; } | 137 void disablePurging() { m_purgePreventCount++; } |
136 void enablePurging() | 138 void enablePurging() |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 173 |
172 class PLATFORM_EXPORT FontCachePurgePreventer { | 174 class PLATFORM_EXPORT FontCachePurgePreventer { |
173 public: | 175 public: |
174 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } | 176 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } |
175 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } | 177 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } |
176 }; | 178 }; |
177 | 179 |
178 } | 180 } |
179 | 181 |
180 #endif | 182 #endif |
OLD | NEW |