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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 } | 155 } |
| 156 | 156 |
| 157 bool UiTexture::IsRTL() { | 157 bool UiTexture::IsRTL() { |
| 158 return base::i18n::IsRTL(); | 158 return base::i18n::IsRTL(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 gfx::FontList UiTexture::GetDefaultFontList(int size) { | 161 gfx::FontList UiTexture::GetDefaultFontList(int size) { |
| 162 return gfx::FontList(gfx::Font(kDefaultFontFamily, size)); | 162 return gfx::FontList(gfx::Font(kDefaultFontFamily, size)); |
| 163 } | 163 } |
| 164 | 164 |
| 165 bool UiTexture::CheckFontList(int size, base::string16 text) { | |
|
cjgrant
2017/05/25 17:47:24
I thought this change would use the existing chara
Ian Vollick
2017/05/26 03:48:09
It's true, they are slow. I may be misunderstandin
| |
| 166 gfx::Font default_font(kDefaultFontFamily, size); | |
| 167 | |
| 168 // TODO(acondor): Query BrowserProcess to obtain the application locale. | |
| 169 for (UChar32 c : CollectDifferentChars(text)) { | |
| 170 std::string name = GetFallbackFontNameForChar(default_font, c, ""); | |
|
cjgrant
2017/05/25 17:47:24
Up to you, but probably don't need "name";
if (Get
Ian Vollick
2017/05/26 03:48:09
The code ended up being structured differently, an
| |
| 171 if (name.empty()) { | |
| 172 // This happens a lot? | |
|
acondor_
2017/05/25 15:51:42
GetFallbackFontNameForChar assumes that the defaul
cjgrant
2017/05/25 17:47:24
The comment and print look like leftover debug?
Ian Vollick
2017/05/26 03:48:09
Yeah, as we chatted about offline, this was in a W
| |
| 173 LOG(ERROR) << "couldn't handle this char: " << c; | |
| 174 return false; | |
| 175 } | |
| 176 } | |
| 177 return true; | |
| 178 } | |
| 179 | |
| 165 gfx::FontList UiTexture::GetFontList(int size, base::string16 text) { | 180 gfx::FontList UiTexture::GetFontList(int size, base::string16 text) { |
| 166 gfx::Font default_font(kDefaultFontFamily, size); | 181 gfx::Font default_font(kDefaultFontFamily, size); |
| 167 std::vector<gfx::Font> fonts{default_font}; | 182 std::vector<gfx::Font> fonts{default_font}; |
| 168 | 183 |
| 169 std::set<std::string> names; | 184 std::set<std::string> names; |
| 170 // TODO(acondor): Query BrowserProcess to obtain the application locale. | 185 // TODO(acondor): Query BrowserProcess to obtain the application locale. |
| 171 for (UChar32 c : CollectDifferentChars(text)) { | 186 for (UChar32 c : CollectDifferentChars(text)) { |
| 172 std::string name = GetFallbackFontNameForChar(default_font, c, ""); | 187 std::string name = GetFallbackFontNameForChar(default_font, c, ""); |
| 173 if (!name.empty()) | 188 if (!name.empty()) |
| 174 names.insert(name); | 189 names.insert(name); |
| 175 } | 190 } |
| 176 for (const auto& name : names) | 191 for (const auto& name : names) |
| 177 fonts.push_back(gfx::Font(name, size)); | 192 fonts.push_back(gfx::Font(name, size)); |
| 178 return gfx::FontList(fonts); | 193 return gfx::FontList(fonts); |
| 179 } | 194 } |
| 180 | 195 |
| 181 } // namespace vr_shell | 196 } // namespace vr_shell |
| OLD | NEW |