Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(698)

Unified Diff: chrome/browser/android/vr_shell/textures/ui_texture.cc

Issue 2846023002: VR: Get fallback fonts for set of characters rather than full string. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/textures/ui_texture.cc
diff --git a/chrome/browser/android/vr_shell/textures/ui_texture.cc b/chrome/browser/android/vr_shell/textures/ui_texture.cc
index 3b0743239bb1edb9ba772efe3ed8168d085e5f2a..b5edf11cafcede42e9f3c72f548c09787a5aa0e8 100644
--- a/chrome/browser/android/vr_shell/textures/ui_texture.cc
+++ b/chrome/browser/android/vr_shell/textures/ui_texture.cc
@@ -44,6 +44,10 @@ gfx::FontList UiTexture::GetFontList(int size, base::string16 text) {
gfx::Font default_font(kDefaultFontFamily, size);
std::vector<gfx::Font> fonts{default_font};
+ std::set<wchar_t> characters;
+ for (base::i18n::UTF16CharIterator it(&text); !it.end(); it.Advance()) {
+ characters.insert(it.get());
+ }
// TODO(acondor): Obtain fallback fonts with gfx::GetFallbackFonts
// (which is not implemented for android yet) in order to avoid
// querying per character.
@@ -51,10 +55,10 @@ gfx::FontList UiTexture::GetFontList(int size, base::string16 text) {
sk_sp<SkFontMgr> font_mgr(SkFontMgr::RefDefault());
std::set<std::string> names;
// TODO(acondor): Query BrowserProcess to obtain the application locale.
- for (base::i18n::UTF16CharIterator it(&text); !it.end(); it.Advance()) {
+ for (wchar_t character : characters) {
sk_sp<SkTypeface> tf(font_mgr->matchFamilyStyleCharacter(
- default_font.GetFontName().c_str(), SkFontStyle(), nullptr, 0,
- it.get()));
+ kDefaultFontFamily, SkFontStyle(), nullptr, 0, character));
+
// TODO(acondor): How should we handle no matching font?
if (!tf)
continue;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698