| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 return next(hintList); | 71 return next(hintList); |
| 72 | 72 |
| 73 uint32_t candidateId = candidateTypeface->uniqueID(); | 73 uint32_t candidateId = candidateTypeface->uniqueID(); |
| 74 if (m_uniqueFontDataForRangeSetsReturned.contains(candidateId)) { | 74 if (m_uniqueFontDataForRangeSetsReturned.contains(candidateId)) { |
| 75 return next(hintList); | 75 return next(hintList); |
| 76 } | 76 } |
| 77 | 77 |
| 78 // We don't want to skip subsetted ranges because HarfBuzzShaper's behavior | 78 // We don't want to skip subsetted ranges because HarfBuzzShaper's behavior |
| 79 // depends on the subsetting. | 79 // depends on the subsetting. |
| 80 if (candidate->isEntireRange()) | 80 if (candidate->isEntireRange()) |
| 81 m_uniqueFontDataForRangeSetsReturned.add(candidateId); | 81 m_uniqueFontDataForRangeSetsReturned.insert(candidateId); |
| 82 return candidate; | 82 return candidate; |
| 83 } | 83 } |
| 84 | 84 |
| 85 PassRefPtr<FontDataForRangeSet> FontFallbackIterator::next( | 85 PassRefPtr<FontDataForRangeSet> FontFallbackIterator::next( |
| 86 const Vector<UChar32>& hintList) { | 86 const Vector<UChar32>& hintList) { |
| 87 if (m_fallbackStage == OutOfLuck) | 87 if (m_fallbackStage == OutOfLuck) |
| 88 return adoptRef(new FontDataForRangeSet()); | 88 return adoptRef(new FontDataForRangeSet()); |
| 89 | 89 |
| 90 if (m_fallbackStage == FallbackPriorityFonts) { | 90 if (m_fallbackStage == FallbackPriorityFonts) { |
| 91 // Only try one fallback priority font, | 91 // Only try one fallback priority font, |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 // because the shaper must have previously tried shaping with the font | 227 // because the shaper must have previously tried shaping with the font |
| 228 // already. | 228 // already. |
| 229 if (!hintList.size()) | 229 if (!hintList.size()) |
| 230 return nullptr; | 230 return nullptr; |
| 231 | 231 |
| 232 FontCache* fontCache = FontCache::fontCache(); | 232 FontCache* fontCache = FontCache::fontCache(); |
| 233 UChar32 hint = hintList[chooseHintIndex(hintList)]; | 233 UChar32 hint = hintList[chooseHintIndex(hintList)]; |
| 234 | 234 |
| 235 if (!hint || m_previouslyAskedForHint.contains(hint)) | 235 if (!hint || m_previouslyAskedForHint.contains(hint)) |
| 236 return nullptr; | 236 return nullptr; |
| 237 m_previouslyAskedForHint.add(hint); | 237 m_previouslyAskedForHint.insert(hint); |
| 238 return fontCache->fallbackFontForCharacter( | 238 return fontCache->fallbackFontForCharacter( |
| 239 m_fontDescription, hint, | 239 m_fontDescription, hint, |
| 240 m_fontFallbackList->primarySimpleFontData(m_fontDescription)); | 240 m_fontFallbackList->primarySimpleFontData(m_fontDescription)); |
| 241 } | 241 } |
| 242 | 242 |
| 243 } // namespace blink | 243 } // namespace blink |
| OLD | NEW |