Chromium Code Reviews| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 // (which is not implemented for android yet) in order to avoid | 48 // (which is not implemented for android yet) in order to avoid |
| 49 // querying per character. | 49 // querying per character. |
| 50 | 50 |
| 51 sk_sp<SkFontMgr> font_mgr(SkFontMgr::RefDefault()); | 51 sk_sp<SkFontMgr> font_mgr(SkFontMgr::RefDefault()); |
| 52 std::set<std::string> names; | 52 std::set<std::string> names; |
| 53 // TODO(acondor): Query BrowserProcess to obtain the application locale. | 53 // TODO(acondor): Query BrowserProcess to obtain the application locale. |
| 54 for (base::i18n::UTF16CharIterator it(&text); !it.end(); it.Advance()) { | 54 for (base::i18n::UTF16CharIterator it(&text); !it.end(); it.Advance()) { |
| 55 sk_sp<SkTypeface> tf(font_mgr->matchFamilyStyleCharacter( | 55 sk_sp<SkTypeface> tf(font_mgr->matchFamilyStyleCharacter( |
| 56 default_font.GetFontName().c_str(), SkFontStyle(), nullptr, 0, | 56 default_font.GetFontName().c_str(), SkFontStyle(), nullptr, 0, |
| 57 it.get())); | 57 it.get())); |
| 58 if (!tf) | |
| 59 continue; | |
|
cjgrant
2017/04/25 16:40:06
If we hit this, does it mean that some characters
mthiesse
2017/04/25 16:47:59
Yes, I'll add a TODO to address this when we move
| |
| 58 SkString sk_name; | 60 SkString sk_name; |
| 59 tf->getFamilyName(&sk_name); | 61 tf->getFamilyName(&sk_name); |
| 60 std::string name(sk_name.c_str()); | 62 std::string name(sk_name.c_str()); |
| 61 if (name != kDefaultFontFamily) | 63 if (name != kDefaultFontFamily) |
| 62 names.insert(name); | 64 names.insert(name); |
| 63 } | 65 } |
| 64 for (const auto& name : names) | 66 for (const auto& name : names) |
| 65 fonts.push_back(gfx::Font(name, size)); | 67 fonts.push_back(gfx::Font(name, size)); |
| 66 return gfx::FontList(fonts); | 68 return gfx::FontList(fonts); |
| 67 } | 69 } |
| 68 | 70 |
| 69 } // namespace vr_shell | 71 } // namespace vr_shell |
| OLD | NEW |