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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 107 } |
108 | 108 |
109 const FontData* FontFallbackList::primaryFontData(const FontDescription& fontDes
cription) const | 109 const FontData* FontFallbackList::primaryFontData(const FontDescription& fontDes
cription) const |
110 { | 110 { |
111 bool shouldLoadCustomFont = true; | 111 bool shouldLoadCustomFont = true; |
112 | 112 |
113 for (unsigned fontIndex = 0; ; ++fontIndex) { | 113 for (unsigned fontIndex = 0; ; ++fontIndex) { |
114 const FontData* fontData = fontDataAt(fontDescription, fontIndex); | 114 const FontData* fontData = fontDataAt(fontDescription, fontIndex); |
115 if (!fontData) { | 115 if (!fontData) { |
116 // All fonts are custom fonts and are loading. Return the first Font
Data. | 116 // All fonts are custom fonts and are loading. Return the first Font
Data. |
117 // FIXME: Correct fallback to the default font. | 117 fontData = fontDataAt(fontDescription, 0); |
118 return fontDataAt(fontDescription, 0); | 118 if (!fontData) |
| 119 fontData = FontCache::fontCache()->getLastResortFallbackFont(fon
tDescription).get(); |
| 120 ASSERT(fontData); |
| 121 return fontData; |
119 } | 122 } |
120 | 123 |
121 if (fontData->isSegmented() && !toSegmentedFontData(fontData)->containsC
haracter(' ')) | 124 if (fontData->isSegmented() && !toSegmentedFontData(fontData)->containsC
haracter(' ')) |
122 continue; | 125 continue; |
123 | 126 |
124 // When a custom font is loading, we should use the correct fallback fon
t to layout the text. | 127 // When a custom font is loading, we should use the correct fallback fon
t to layout the text. |
125 // Here skip the temporary font for the loading custom font which may no
t act as the correct fallback font. | 128 // Here skip the temporary font for the loading custom font which may no
t act as the correct fallback font. |
126 if (!fontData->isLoadingFallback()) | 129 if (!fontData->isLoadingFallback()) |
127 return fontData; | 130 return fontData; |
128 | 131 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 RefPtr<FontData> result = getFontData(fontDescription, m_familyIndex); | 199 RefPtr<FontData> result = getFontData(fontDescription, m_familyIndex); |
197 if (result) { | 200 if (result) { |
198 m_fontList.append(result); | 201 m_fontList.append(result); |
199 if (result->isLoading()) | 202 if (result->isLoading()) |
200 m_loadingCustomFonts = true; | 203 m_loadingCustomFonts = true; |
201 } | 204 } |
202 return result.get(); | 205 return result.get(); |
203 } | 206 } |
204 | 207 |
205 } | 208 } |
OLD | NEW |