| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chrome/browser/android/vr_shell/textures/ui_texture.h" | 5 #include "chrome/browser/android/vr_shell/textures/ui_texture.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 gfx::Font default_font(kDefaultFontFamily, size); | 186 gfx::Font default_font(kDefaultFontFamily, size); |
| 187 std::vector<gfx::Font> fonts{default_font}; | 187 std::vector<gfx::Font> fonts{default_font}; |
| 188 | 188 |
| 189 std::set<std::string> names; | 189 std::set<std::string> names; |
| 190 // TODO(acondor): Query BrowserProcess to obtain the application locale. | 190 // TODO(acondor): Query BrowserProcess to obtain the application locale. |
| 191 for (UChar32 c : CollectDifferentChars(text)) { | 191 for (UChar32 c : CollectDifferentChars(text)) { |
| 192 std::string name; | 192 std::string name; |
| 193 bool found_name = GetFallbackFontNameForChar(default_font, c, "", &name); | 193 bool found_name = GetFallbackFontNameForChar(default_font, c, "", &name); |
| 194 if (!found_name) | 194 if (!found_name) |
| 195 return false; | 195 return false; |
| 196 if (name.empty()) | 196 if (!name.empty()) |
| 197 names.insert(name); | 197 names.insert(name); |
| 198 } | 198 } |
| 199 for (const auto& name : names) | 199 for (const auto& name : names) { |
| 200 DCHECK(!name.empty()); |
| 200 fonts.push_back(gfx::Font(name, size)); | 201 fonts.push_back(gfx::Font(name, size)); |
| 202 } |
| 201 *font_list = gfx::FontList(fonts); | 203 *font_list = gfx::FontList(fonts); |
| 202 return true; | 204 return true; |
| 203 } | 205 } |
| 204 | 206 |
| 205 void UiTexture::SetForceFontFallbackFailureForTesting(bool force) { | 207 void UiTexture::SetForceFontFallbackFailureForTesting(bool force) { |
| 206 force_font_fallback_failure_for_testing_ = force; | 208 force_font_fallback_failure_for_testing_ = force; |
| 207 } | 209 } |
| 208 | 210 |
| 209 } // namespace vr_shell | 211 } // namespace vr_shell |
| OLD | NEW |