OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 fontData = fontDataAt(fontDescription, 0); | 128 fontData = fontDataAt(fontDescription, 0); |
129 if (!fontData) | 129 if (!fontData) |
130 fontData = FontCache::fontCache()->getLastResortFallbackFont(fon
tDescription).get(); | 130 fontData = FontCache::fontCache()->getLastResortFallbackFont(fon
tDescription).get(); |
131 ASSERT(fontData); | 131 ASSERT(fontData); |
132 return fontData; | 132 return fontData; |
133 } | 133 } |
134 | 134 |
135 if (fontData->isSegmented() && !toSegmentedFontData(fontData)->containsC
haracter(' ')) | 135 if (fontData->isSegmented() && !toSegmentedFontData(fontData)->containsC
haracter(' ')) |
136 continue; | 136 continue; |
137 | 137 |
| 138 const SimpleFontData* simpleFontData = fontData->fontDataForCharacter('
'); |
| 139 ASSERT(simpleFontData); |
| 140 |
138 // When a custom font is loading, we should use the correct fallback fon
t to layout the text. | 141 // When a custom font is loading, we should use the correct fallback fon
t to layout the text. |
139 // Here skip the temporary font for the loading custom font which may no
t act as the correct fallback font. | 142 // Here skip the temporary font for the loading custom font which may no
t act as the correct fallback font. |
140 if (!fontData->isLoadingFallback()) | 143 if (!simpleFontData->isLoadingFallback()) |
141 return fontData; | 144 return fontData; |
142 | 145 |
143 // Begin to load the first custom font if needed. | 146 // Begin to load the first custom font if needed. |
144 if (shouldLoadCustomFont) { | 147 if (shouldLoadCustomFont) { |
145 shouldLoadCustomFont = false; | 148 shouldLoadCustomFont = false; |
146 const SimpleFontData* simpleFontData = fontData->fontDataForCharacte
r(' '); | 149 simpleFontData->customFontData()->beginLoadIfNeeded(); |
147 if (simpleFontData && simpleFontData->customFontData()) | |
148 simpleFontData->customFontData()->beginLoadIfNeeded(); | |
149 } | 150 } |
150 } | 151 } |
151 } | 152 } |
152 | 153 |
153 PassRefPtr<FontData> FontFallbackList::getFontData(const FontDescription& fontDe
scription, int& familyIndex) const | 154 PassRefPtr<FontData> FontFallbackList::getFontData(const FontDescription& fontDe
scription, int& familyIndex) const |
154 { | 155 { |
155 RefPtr<FontData> result; | 156 RefPtr<FontData> result; |
156 | 157 |
157 int startIndex = familyIndex; | 158 int startIndex = familyIndex; |
158 const FontFamily* startFamily = &fontDescription.family(); | 159 const FontFamily* startFamily = &fontDescription.family(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 RefPtr<FontData> result = getFontData(fontDescription, m_familyIndex); | 211 RefPtr<FontData> result = getFontData(fontDescription, m_familyIndex); |
211 if (result) { | 212 if (result) { |
212 m_fontList.append(result); | 213 m_fontList.append(result); |
213 if (result->isLoadingFallback()) | 214 if (result->isLoadingFallback()) |
214 m_hasLoadingFallback = true; | 215 m_hasLoadingFallback = true; |
215 } | 216 } |
216 return result.get(); | 217 return result.get(); |
217 } | 218 } |
218 | 219 |
219 } | 220 } |
OLD | NEW |