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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
639 int best_partial_font_missing_char_count = INT_MAX; | 639 int best_partial_font_missing_char_count = INT_MAX; |
640 Font best_partial_font = original_font; | 640 Font best_partial_font = original_font; |
641 bool using_best_partial_font = false; | 641 bool using_best_partial_font = false; |
642 Font current_font; | 642 Font current_font; |
643 | 643 |
644 run->logical_clusters.reset(new WORD[run_length]); | 644 run->logical_clusters.reset(new WORD[run_length]); |
645 while (fonts.NextFont(¤t_font)) { | 645 while (fonts.NextFont(¤t_font)) { |
646 HRESULT hr = ShapeTextRunWithFont(run, current_font); | 646 HRESULT hr = ShapeTextRunWithFont(run, current_font); |
647 | 647 |
648 bool glyphs_missing = false; | 648 bool glyphs_missing = false; |
649 if (hr == USP_E_SCRIPT_NOT_IN_FONT) { | 649 if (hr == USP_E_SCRIPT_NOT_IN_FONT || |
Vitaly Buka (NO REVIEWS)
2012/10/08 23:32:51
I don't know why, but this error happens on JA XP
| |
650 hr == __HRESULT_FROM_WIN32(ERROR_INVALID_WINDOW_HANDLE)) { | |
650 glyphs_missing = true; | 651 glyphs_missing = true; |
651 } else if (hr == S_OK) { | 652 } else if (hr == S_OK) { |
652 // If |hr| is S_OK, there could still be missing glyphs in the output. | 653 // If |hr| is S_OK, there could still be missing glyphs in the output. |
653 // http://msdn.microsoft.com/en-us/library/windows/desktop/dd368564.aspx | 654 // http://msdn.microsoft.com/en-us/library/windows/desktop/dd368564.aspx |
654 const int missing_count = CountCharsWithMissingGlyphs(run); | 655 const int missing_count = CountCharsWithMissingGlyphs(run); |
655 // Track the font that produced the least missing glyphs. | 656 // Track the font that produced the least missing glyphs. |
656 if (missing_count < best_partial_font_missing_char_count) { | 657 if (missing_count < best_partial_font_missing_char_count) { |
657 best_partial_font_missing_char_count = missing_count; | 658 best_partial_font_missing_char_count = missing_count; |
658 best_partial_font = run->font; | 659 best_partial_font = run->font; |
659 } | 660 } |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
828 size_t position = LayoutIndexToTextIndex(run->range.end()); | 829 size_t position = LayoutIndexToTextIndex(run->range.end()); |
829 position = IndexOfAdjacentGrapheme(position, CURSOR_BACKWARD); | 830 position = IndexOfAdjacentGrapheme(position, CURSOR_BACKWARD); |
830 return SelectionModel(position, CURSOR_FORWARD); | 831 return SelectionModel(position, CURSOR_FORWARD); |
831 } | 832 } |
832 | 833 |
833 RenderText* RenderText::CreateInstance() { | 834 RenderText* RenderText::CreateInstance() { |
834 return new RenderTextWin; | 835 return new RenderTextWin; |
835 } | 836 } |
836 | 837 |
837 } // namespace gfx | 838 } // namespace gfx |
OLD | NEW |