| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 ASSERT(fontDataForSpace); | 127 ASSERT(fontDataForSpace); |
| 128 | 128 |
| 129 // When a custom font is loading, we should use the correct fallback fon
t to layout the text. | 129 // When a custom font is loading, we should use the correct fallback fon
t to layout the text. |
| 130 // Here skip the temporary font for the loading custom font which may no
t act as the correct fallback font. | 130 // Here skip the temporary font for the loading custom font which may no
t act as the correct fallback font. |
| 131 if (!fontDataForSpace->isLoadingFallback()) | 131 if (!fontDataForSpace->isLoadingFallback()) |
| 132 return fontDataForSpace; | 132 return fontDataForSpace; |
| 133 | 133 |
| 134 if (fontData->isSegmented()) { | 134 if (fontData->isSegmented()) { |
| 135 const SegmentedFontData* segmented = toSegmentedFontData(fontData); | 135 const SegmentedFontData* segmented = toSegmentedFontData(fontData); |
| 136 for (unsigned i = 0; i < segmented->numFaces(); i++) { | 136 for (unsigned i = 0; i < segmented->numFaces(); i++) { |
| 137 const SimpleFontData* rangeFontData = segmented->faceAt(i).fontD
ata(); | 137 const SimpleFontData* rangeFontData = segmented->faceAt(i)->font
Data(); |
| 138 if (!rangeFontData->isLoadingFallback()) | 138 if (!rangeFontData->isLoadingFallback()) |
| 139 return rangeFontData; | 139 return rangeFontData; |
| 140 } | 140 } |
| 141 if (fontData->isLoading()) | 141 if (fontData->isLoading()) |
| 142 shouldLoadCustomFont = false; | 142 shouldLoadCustomFont = false; |
| 143 } | 143 } |
| 144 | 144 |
| 145 // Begin to load the first custom font if needed. | 145 // Begin to load the first custom font if needed. |
| 146 if (shouldLoadCustomFont) { | 146 if (shouldLoadCustomFont) { |
| 147 shouldLoadCustomFont = false; | 147 shouldLoadCustomFont = false; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 while (currentFamily) { | 188 while (currentFamily) { |
| 189 if (currentFamily->family().length()) { | 189 if (currentFamily->family().length()) { |
| 190 FontFaceCreationParams params(adjustFamilyNameToAvoidUnsupportedFont
s(currentFamily->family())); | 190 FontFaceCreationParams params(adjustFamilyNameToAvoidUnsupportedFont
s(currentFamily->family())); |
| 191 RefPtr<FontData> result; | 191 RefPtr<FontData> result; |
| 192 if (m_fontSelector) | 192 if (m_fontSelector) |
| 193 result = m_fontSelector->getFontData(fontDescription, currentFam
ily->family()); | 193 result = m_fontSelector->getFontData(fontDescription, currentFam
ily->family()); |
| 194 if (!result) { | 194 if (!result) { |
| 195 if (FontPlatformData* platformData = FontCache::fontCache()->get
FontPlatformData(fontDescription, params)) | 195 if (FontPlatformData* platformData = FontCache::fontCache()->get
FontPlatformData(fontDescription, params)) |
| 196 result = FontCache::fontCache()->fontDataFromFontPlatformDat
a(platformData); | 196 result = FontCache::fontCache()->fontDataFromFontPlatformDat
a(platformData); |
| 197 } | 197 } |
| 198 if (result) | 198 if (result) { |
| 199 key.add(fontDescription.cacheKey(params)); | 199 key.add(fontDescription.cacheKey(params)); |
| 200 if (!result->isSegmented() && !result->isCustomFont()) |
| 201 FontCache::fontCache()->releaseFontData(toSimpleFontData(res
ult)); |
| 202 } |
| 200 } | 203 } |
| 201 currentFamily = currentFamily->next(); | 204 currentFamily = currentFamily->next(); |
| 202 } | 205 } |
| 203 | 206 |
| 204 return key; | 207 return key; |
| 205 } | 208 } |
| 206 | 209 |
| 207 const FontData* FontFallbackList::fontDataAt(const FontDescription& fontDescript
ion, unsigned realizedFontIndex) const | 210 const FontData* FontFallbackList::fontDataAt(const FontDescription& fontDescript
ion, unsigned realizedFontIndex) const |
| 208 { | 211 { |
| 209 if (realizedFontIndex < m_fontList.size()) | 212 if (realizedFontIndex < m_fontList.size()) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 231 | 234 |
| 232 bool FontFallbackList::isValid() const | 235 bool FontFallbackList::isValid() const |
| 233 { | 236 { |
| 234 if (!m_fontSelector) | 237 if (!m_fontSelector) |
| 235 return m_fontSelectorVersion == 0; | 238 return m_fontSelectorVersion == 0; |
| 236 | 239 |
| 237 return m_fontSelector->version() == m_fontSelectorVersion; | 240 return m_fontSelector->version() == m_fontSelectorVersion; |
| 238 } | 241 } |
| 239 | 242 |
| 240 } // namespace blink | 243 } // namespace blink |
| OLD | NEW |