OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/gfx/render_text_win.h" | 5 #include "ui/gfx/render_text_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/i18n/break_iterator.h" | 9 #include "base/i18n/break_iterator.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 const wchar_t* run_text = &(GetLayoutText()[run->range.start()]); | 677 const wchar_t* run_text = &(GetLayoutText()[run->range.start()]); |
678 Font original_font = run->font; | 678 Font original_font = run->font; |
679 LinkedFontsIterator fonts(original_font); | 679 LinkedFontsIterator fonts(original_font); |
680 bool tried_cached_font = false; | 680 bool tried_cached_font = false; |
681 bool tried_fallback = false; | 681 bool tried_fallback = false; |
682 // Keep track of the font that is able to display the greatest number of | 682 // Keep track of the font that is able to display the greatest number of |
683 // characters for which ScriptShape() returned S_OK. This font will be used | 683 // characters for which ScriptShape() returned S_OK. This font will be used |
684 // in the case where no font is able to display the entire run. | 684 // in the case where no font is able to display the entire run. |
685 int best_partial_font_missing_char_count = INT_MAX; | 685 int best_partial_font_missing_char_count = INT_MAX; |
686 Font best_partial_font = original_font; | 686 Font best_partial_font = original_font; |
687 bool using_best_partial_font = false; | |
688 Font current_font; | 687 Font current_font; |
689 | 688 |
690 run->logical_clusters.reset(new WORD[run_length]); | 689 run->logical_clusters.reset(new WORD[run_length]); |
691 while (fonts.NextFont(¤t_font)) { | 690 while (fonts.NextFont(¤t_font)) { |
692 HRESULT hr = ShapeTextRunWithFont(run, current_font); | 691 HRESULT hr = ShapeTextRunWithFont(run, current_font); |
693 | 692 |
694 bool glyphs_missing = false; | 693 bool glyphs_missing = false; |
695 if (hr == USP_E_SCRIPT_NOT_IN_FONT) { | 694 if (hr == USP_E_SCRIPT_NOT_IN_FONT) { |
696 glyphs_missing = true; | 695 glyphs_missing = true; |
697 } else if (hr == S_OK) { | 696 } else if (hr == S_OK) { |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 size_t position = LayoutIndexToTextIndex(run->range.end()); | 896 size_t position = LayoutIndexToTextIndex(run->range.end()); |
898 position = IndexOfAdjacentGrapheme(position, CURSOR_BACKWARD); | 897 position = IndexOfAdjacentGrapheme(position, CURSOR_BACKWARD); |
899 return SelectionModel(position, CURSOR_FORWARD); | 898 return SelectionModel(position, CURSOR_FORWARD); |
900 } | 899 } |
901 | 900 |
902 RenderText* RenderText::CreateInstance() { | 901 RenderText* RenderText::CreateInstance() { |
903 return new RenderTextWin; | 902 return new RenderTextWin; |
904 } | 903 } |
905 | 904 |
906 } // namespace gfx | 905 } // namespace gfx |
OLD | NEW |