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

Side by Side Diff: ui/gfx/render_text_win.cc

Issue 11087016: Create font with DEFAULT_CHARSET instead of ANSI_CHARSET. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 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 unified diff | Download patch
« ui/gfx/platform_font_win.cc ('K') | « ui/gfx/platform_font_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(&current_font)) { 645 while (fonts.NextFont(&current_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 ||
650 hr == HRESULT_FROM_WIN32(ERROR_INVALID_WINDOW_HANDLE)) {
msw 2012/10/12 21:34:55 It seems like this should trash the invalid |cache
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
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
OLDNEW
« ui/gfx/platform_font_win.cc ('K') | « ui/gfx/platform_font_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698