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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 if (!lastResort) | 119 if (!lastResort) |
120 FontCache::crashWithFontInfo(&m_fontDescription); | 120 FontCache::crashWithFontInfo(&m_fontDescription); |
121 // Don't skip the LastResort font in uniqueOrNext() since HarfBuzzShaper | 121 // Don't skip the LastResort font in uniqueOrNext() since HarfBuzzShaper |
122 // needs to use this one to place missing glyph boxes. | 122 // needs to use this one to place missing glyph boxes. |
123 return adoptRef(new FontDataForRangeSetFromCache(lastResort)); | 123 return adoptRef(new FontDataForRangeSetFromCache(lastResort)); |
124 } | 124 } |
125 | 125 |
126 ASSERT(m_fallbackStage == FontGroupFonts || m_fallbackStage == SegmentedFace); | 126 DCHECK(m_fallbackStage == FontGroupFonts || m_fallbackStage == SegmentedFace); |
127 const FontData* fontData = | 127 const FontData* fontData = |
128 m_fontFallbackList->fontDataAt(m_fontDescription, m_currentFontDataIndex); | 128 m_fontFallbackList->fontDataAt(m_fontDescription, m_currentFontDataIndex); |
129 | 129 |
130 if (!fontData) { | 130 if (!fontData) { |
131 // If there is no fontData coming from the fallback list, it means | 131 // If there is no fontData coming from the fallback list, it means |
132 // we are now looking at system fonts, either for prioritized symbol | 132 // we are now looking at system fonts, either for prioritized symbol |
133 // or emoji fonts or by calling system fallback API. | 133 // or emoji fonts or by calling system fallback API. |
134 m_fallbackStage = isNonTextFallbackPriority(m_fontFallbackPriority) | 134 m_fallbackStage = isNonTextFallbackPriority(m_fontFallbackPriority) |
135 ? FallbackPriorityFonts | 135 ? FallbackPriorityFonts |
136 : SystemFonts; | 136 : SystemFonts; |
(...skipping 18 matching lines...) Expand all Loading... |
155 } | 155 } |
156 | 156 |
157 // Iterate over ranges of a segmented font below. | 157 // Iterate over ranges of a segmented font below. |
158 | 158 |
159 const SegmentedFontData* segmented = toSegmentedFontData(fontData); | 159 const SegmentedFontData* segmented = toSegmentedFontData(fontData); |
160 if (m_fallbackStage != SegmentedFace) { | 160 if (m_fallbackStage != SegmentedFace) { |
161 m_segmentedFaceIndex = 0; | 161 m_segmentedFaceIndex = 0; |
162 m_fallbackStage = SegmentedFace; | 162 m_fallbackStage = SegmentedFace; |
163 } | 163 } |
164 | 164 |
165 ASSERT(m_segmentedFaceIndex < segmented->numFaces()); | 165 DCHECK_LT(m_segmentedFaceIndex, segmented->numFaces()); |
166 RefPtr<FontDataForRangeSet> currentSegmentedFace = | 166 RefPtr<FontDataForRangeSet> currentSegmentedFace = |
167 segmented->faceAt(m_segmentedFaceIndex); | 167 segmented->faceAt(m_segmentedFaceIndex); |
168 m_segmentedFaceIndex++; | 168 m_segmentedFaceIndex++; |
169 | 169 |
170 if (m_segmentedFaceIndex == segmented->numFaces()) { | 170 if (m_segmentedFaceIndex == segmented->numFaces()) { |
171 // Switch from iterating over a segmented face to the next family from | 171 // Switch from iterating over a segmented face to the next family from |
172 // the font-family: group of fonts. | 172 // the font-family: group of fonts. |
173 m_fallbackStage = FontGroupFonts; | 173 m_fallbackStage = FontGroupFonts; |
174 m_currentFontDataIndex++; | 174 m_currentFontDataIndex++; |
175 } | 175 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 235 |
236 if (!hint || m_previouslyAskedForHint.contains(hint)) | 236 if (!hint || m_previouslyAskedForHint.contains(hint)) |
237 return nullptr; | 237 return nullptr; |
238 m_previouslyAskedForHint.insert(hint); | 238 m_previouslyAskedForHint.insert(hint); |
239 return fontCache->fallbackFontForCharacter( | 239 return fontCache->fallbackFontForCharacter( |
240 m_fontDescription, hint, | 240 m_fontDescription, hint, |
241 m_fontFallbackList->primarySimpleFontData(m_fontDescription)); | 241 m_fontFallbackList->primarySimpleFontData(m_fontDescription)); |
242 } | 242 } |
243 | 243 |
244 } // namespace blink | 244 } // namespace blink |
OLD | NEW |