| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/fonts/FontFallbackIterator.h" | 5 #include "platform/fonts/FontFallbackIterator.h" |
| 6 | 6 |
| 7 #include "platform/fonts/FontCache.h" | 7 #include "platform/fonts/FontCache.h" |
| 8 #include "platform/fonts/FontDescription.h" | 8 #include "platform/fonts/FontDescription.h" |
| 9 #include "platform/fonts/FontFallbackList.h" | 9 #include "platform/fonts/FontFallbackList.h" |
| 10 #include "platform/fonts/SegmentedFontData.h" | 10 #include "platform/fonts/SegmentedFontData.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 // If we don't have options from the system fallback anymore or had | 110 // If we don't have options from the system fallback anymore or had |
| 111 // previously returned them, we only have the last resort font left. | 111 // previously returned them, we only have the last resort font left. |
| 112 // TODO: crbug.com/42217 Improve this by doing the last run with a last | 112 // TODO: crbug.com/42217 Improve this by doing the last run with a last |
| 113 // resort font that has glyphs for everything, for example the Unicode | 113 // resort font that has glyphs for everything, for example the Unicode |
| 114 // LastResort font, not just Times or Arial. | 114 // LastResort font, not just Times or Arial. |
| 115 FontCache* fontCache = FontCache::fontCache(); | 115 FontCache* fontCache = FontCache::fontCache(); |
| 116 m_fallbackStage = OutOfLuck; | 116 m_fallbackStage = OutOfLuck; |
| 117 RefPtr<SimpleFontData> lastResort = | 117 RefPtr<SimpleFontData> lastResort = |
| 118 fontCache->getLastResortFallbackFont(m_fontDescription).get(); | 118 fontCache->getLastResortFallbackFont(m_fontDescription).get(); |
| 119 RELEASE_ASSERT(lastResort); | 119 if (!lastResort) |
| 120 FontCache::crashWithFontInfo(&m_fontDescription); |
| 120 // Don't skip the LastResort font in uniqueOrNext() since HarfBuzzShaper | 121 // Don't skip the LastResort font in uniqueOrNext() since HarfBuzzShaper |
| 121 // needs to use this one to place missing glyph boxes. | 122 // needs to use this one to place missing glyph boxes. |
| 122 return adoptRef(new FontDataForRangeSetFromCache(lastResort)); | 123 return adoptRef(new FontDataForRangeSetFromCache(lastResort)); |
| 123 } | 124 } |
| 124 | 125 |
| 125 ASSERT(m_fallbackStage == FontGroupFonts || m_fallbackStage == SegmentedFace); | 126 ASSERT(m_fallbackStage == FontGroupFonts || m_fallbackStage == SegmentedFace); |
| 126 const FontData* fontData = | 127 const FontData* fontData = |
| 127 m_fontFallbackList->fontDataAt(m_fontDescription, m_currentFontDataIndex); | 128 m_fontFallbackList->fontDataAt(m_fontDescription, m_currentFontDataIndex); |
| 128 | 129 |
| 129 if (!fontData) { | 130 if (!fontData) { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 235 |
| 235 if (!hint || m_previouslyAskedForHint.contains(hint)) | 236 if (!hint || m_previouslyAskedForHint.contains(hint)) |
| 236 return nullptr; | 237 return nullptr; |
| 237 m_previouslyAskedForHint.insert(hint); | 238 m_previouslyAskedForHint.insert(hint); |
| 238 return fontCache->fallbackFontForCharacter( | 239 return fontCache->fallbackFontForCharacter( |
| 239 m_fontDescription, hint, | 240 m_fontDescription, hint, |
| 240 m_fontFallbackList->primarySimpleFontData(m_fontDescription)); | 241 m_fontFallbackList->primarySimpleFontData(m_fontDescription)); |
| 241 } | 242 } |
| 242 | 243 |
| 243 } // namespace blink | 244 } // namespace blink |
| OLD | NEW |