| 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/Logging.h" | 7 #include "platform/Logging.h" |
| 8 #include "platform/fonts/FontCache.h" | 8 #include "platform/fonts/FontCache.h" |
| 9 #include "platform/fonts/FontDescription.h" | 9 #include "platform/fonts/FontDescription.h" |
| 10 #include "platform/fonts/FontFallbackList.h" | 10 #include "platform/fonts/FontFallbackList.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 { | 170 { |
| 171 return FontCache::fontCache()->fallbackFontForCharacter( | 171 return FontCache::fontCache()->fallbackFontForCharacter( |
| 172 m_fontDescription, | 172 m_fontDescription, |
| 173 hint, | 173 hint, |
| 174 m_fontFallbackList->primarySimpleFontData(m_fontDescription), | 174 m_fontFallbackList->primarySimpleFontData(m_fontDescription), |
| 175 m_fontFallbackPriority); | 175 m_fontFallbackPriority); |
| 176 } | 176 } |
| 177 | 177 |
| 178 const PassRefPtr<SimpleFontData> FontFallbackIterator::uniqueSystemFontForHint(U
Char32 hint) | 178 const PassRefPtr<SimpleFontData> FontFallbackIterator::uniqueSystemFontForHint(U
Char32 hint) |
| 179 { | 179 { |
| 180 FontCache* fontCache = FontCache::fontCache(); | |
| 181 | |
| 182 // When we're asked for a fallback for the same characters again, we give up | 180 // When we're asked for a fallback for the same characters again, we give up |
| 183 // because the shaper must have previously tried shaping with the font | 181 // because the shaper must have previously tried shaping with the font |
| 184 // already. | 182 // already. |
| 185 if (m_visitedSystemFonts.find(hint) != m_visitedSystemFonts.end()) { | 183 if (!hint || m_visitedSystemFonts.find(hint) != m_visitedSystemFonts.end()) |
| 186 return nullptr; | 184 return nullptr; |
| 187 } | |
| 188 | 185 |
| 186 FontCache* fontCache = FontCache::fontCache(); |
| 189 RefPtr<SimpleFontData> fallbackFont = fontCache->fallbackFontForCharacter(m_
fontDescription, hint, m_fontFallbackList->primarySimpleFontData(m_fontDescripti
on)); | 187 RefPtr<SimpleFontData> fallbackFont = fontCache->fallbackFontForCharacter(m_
fontDescription, hint, m_fontFallbackList->primarySimpleFontData(m_fontDescripti
on)); |
| 190 | 188 |
| 191 return m_visitedSystemFonts.add(hint, fallbackFont).storedValue->value; | 189 return m_visitedSystemFonts.add(hint, fallbackFont).storedValue->value; |
| 192 } | 190 } |
| 193 | 191 |
| 194 } // namespace blink | 192 } // namespace blink |
| OLD | NEW |