| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 } | 118 } |
| 119 | 119 |
| 120 if (fontData->isSegmented() && | 120 if (fontData->isSegmented() && |
| 121 !toSegmentedFontData(fontData)->containsCharacter(spaceCharacter)) | 121 !toSegmentedFontData(fontData)->containsCharacter(spaceCharacter)) |
| 122 continue; | 122 continue; |
| 123 | 123 |
| 124 const SimpleFontData* fontDataForSpace = | 124 const SimpleFontData* fontDataForSpace = |
| 125 fontData->fontDataForCharacter(spaceCharacter); | 125 fontData->fontDataForCharacter(spaceCharacter); |
| 126 ASSERT(fontDataForSpace); | 126 ASSERT(fontDataForSpace); |
| 127 | 127 |
| 128 // When a custom font is loading, we should use the correct fallback font to
layout the text. | 128 // When a custom font is loading, we should use the correct fallback font to |
| 129 // Here skip the temporary font for the loading custom font which may not ac
t as the correct fallback font. | 129 // layout the text. Here skip the temporary font for the loading custom |
| 130 // font which may not act as the correct fallback font. |
| 130 if (!fontDataForSpace->isLoadingFallback()) | 131 if (!fontDataForSpace->isLoadingFallback()) |
| 131 return fontDataForSpace; | 132 return fontDataForSpace; |
| 132 | 133 |
| 133 if (fontData->isSegmented()) { | 134 if (fontData->isSegmented()) { |
| 134 const SegmentedFontData* segmented = toSegmentedFontData(fontData); | 135 const SegmentedFontData* segmented = toSegmentedFontData(fontData); |
| 135 for (unsigned i = 0; i < segmented->numFaces(); i++) { | 136 for (unsigned i = 0; i < segmented->numFaces(); i++) { |
| 136 const SimpleFontData* rangeFontData = segmented->faceAt(i)->fontData(); | 137 const SimpleFontData* rangeFontData = segmented->faceAt(i)->fontData(); |
| 137 if (!rangeFontData->isLoadingFallback()) | 138 if (!rangeFontData->isLoadingFallback()) |
| 138 return rangeFontData; | 139 return rangeFontData; |
| 139 } | 140 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 return m_fontList[realizedFontIndex] | 222 return m_fontList[realizedFontIndex] |
| 222 .get(); // This fallback font is already in our list. | 223 .get(); // This fallback font is already in our list. |
| 223 | 224 |
| 224 // Make sure we're not passing in some crazy value here. | 225 // Make sure we're not passing in some crazy value here. |
| 225 ASSERT(realizedFontIndex == m_fontList.size()); | 226 ASSERT(realizedFontIndex == m_fontList.size()); |
| 226 | 227 |
| 227 if (m_familyIndex == cAllFamiliesScanned) | 228 if (m_familyIndex == cAllFamiliesScanned) |
| 228 return 0; | 229 return 0; |
| 229 | 230 |
| 230 // Ask the font cache for the font data. | 231 // Ask the font cache for the font data. |
| 231 // We are obtaining this font for the first time. We keep track of the famili
es we've looked at before | 232 // We are obtaining this font for the first time. We keep track of the |
| 232 // in |m_familyIndex|, so that we never scan the same spot in the list twice.
getFontData will adjust our | 233 // families we've looked at before in |m_familyIndex|, so that we never scan |
| 234 // the same spot in the list twice. getFontData will adjust our |
| 233 // |m_familyIndex| as it scans for the right font to make. | 235 // |m_familyIndex| as it scans for the right font to make. |
| 234 ASSERT(FontCache::fontCache()->generation() == m_generation); | 236 ASSERT(FontCache::fontCache()->generation() == m_generation); |
| 235 RefPtr<FontData> result = getFontData(fontDescription, m_familyIndex); | 237 RefPtr<FontData> result = getFontData(fontDescription, m_familyIndex); |
| 236 if (result) { | 238 if (result) { |
| 237 m_fontList.append(result); | 239 m_fontList.append(result); |
| 238 if (result->isLoadingFallback()) | 240 if (result->isLoadingFallback()) |
| 239 m_hasLoadingFallback = true; | 241 m_hasLoadingFallback = true; |
| 240 } | 242 } |
| 241 return result.get(); | 243 return result.get(); |
| 242 } | 244 } |
| 243 | 245 |
| 244 bool FontFallbackList::isValid() const { | 246 bool FontFallbackList::isValid() const { |
| 245 if (!m_fontSelector) | 247 if (!m_fontSelector) |
| 246 return m_fontSelectorVersion == 0; | 248 return m_fontSelectorVersion == 0; |
| 247 | 249 |
| 248 return m_fontSelector->version() == m_fontSelectorVersion; | 250 return m_fontSelector->version() == m_fontSelectorVersion; |
| 249 } | 251 } |
| 250 | 252 |
| 251 } // namespace blink | 253 } // namespace blink |
| OLD | NEW |