| Index: ui/gfx/render_text_win.cc
|
| diff --git a/ui/gfx/render_text_win.cc b/ui/gfx/render_text_win.cc
|
| index f79577fde0aa9314cd61ddd7b5f209ee71ae1ae4..122d7c15a5096f1c0f8ffd7df0544578e6572dcc 100644
|
| --- a/ui/gfx/render_text_win.cc
|
| +++ b/ui/gfx/render_text_win.cc
|
| @@ -15,7 +15,7 @@
|
| #include "base/win/windows_version.h"
|
| #include "third_party/icu/source/common/unicode/uchar.h"
|
| #include "ui/gfx/canvas.h"
|
| -#include "ui/gfx/font_fallback_win.h"
|
| +#include "ui/gfx/font_fallback.h"
|
| #include "ui/gfx/font_smoothing_win.h"
|
| #include "ui/gfx/platform_font_win.h"
|
| #include "ui/gfx/utf16_indexing.h"
|
| @@ -1060,7 +1060,8 @@ void RenderTextWin::LayoutTextRun(internal::TextRun* run) {
|
| const size_t run_length = run->range.length();
|
| const wchar_t* run_text = &(GetLayoutText()[run->range.start()]);
|
| Font original_font = run->font;
|
| - LinkedFontsIterator fonts(original_font);
|
| + std::vector<std::string> fallback_fonts =
|
| + GetFallbackFontFamilies(original_font.GetFontName());
|
| bool tried_cached_font = false;
|
| bool tried_fallback = false;
|
| // Keep track of the font that is able to display the greatest number of
|
| @@ -1068,11 +1069,14 @@ void RenderTextWin::LayoutTextRun(internal::TextRun* run) {
|
| // in the case where no font is able to display the entire run.
|
| int best_partial_font_missing_char_count = INT_MAX;
|
| Font best_partial_font = original_font;
|
| - Font current_font;
|
|
|
| run->logical_clusters.reset(new WORD[run_length]);
|
| - while (fonts.NextFont(¤t_font)) {
|
| - HRESULT hr = ShapeTextRunWithFont(run, current_font);
|
| + Font current_font;
|
| + bool next_font_set = false;
|
| + for (size_t i = 0; i < fallback_fonts.size();) {
|
| + HRESULT hr = ShapeTextRunWithFont(run, next_font_set ?
|
| + current_font : Font(fallback_fonts[i++], original_font.GetFontSize()));
|
| + next_font_set = false;
|
|
|
| bool glyphs_missing = false;
|
| if (hr == USP_E_SCRIPT_NOT_IN_FONT) {
|
| @@ -1106,7 +1110,8 @@ void RenderTextWin::LayoutTextRun(internal::TextRun* run) {
|
| std::map<std::string, Font>::const_iterator it =
|
| successful_substitute_fonts_.find(original_font.GetFontName());
|
| if (it != successful_substitute_fonts_.end()) {
|
| - fonts.SetNextFont(it->second);
|
| + current_font = it->second;
|
| + next_font_set = true;
|
| continue;
|
| }
|
| }
|
| @@ -1120,7 +1125,8 @@ void RenderTextWin::LayoutTextRun(internal::TextRun* run) {
|
| Font fallback_font;
|
| if (ChooseFallbackFont(cached_hdc_, run->font, run_text, run_length,
|
| &fallback_font)) {
|
| - fonts.SetNextFont(fallback_font);
|
| + current_font = fallback_font;
|
| + next_font_set = true;
|
| continue;
|
| }
|
| }
|
|
|