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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 // Build the list of runs from the script items and ranged styles. Use an | 571 // Build the list of runs from the script items and ranged styles. Use an |
572 // empty color BreakList to avoid breaking runs at color boundaries. | 572 // empty color BreakList to avoid breaking runs at color boundaries. |
573 BreakList<SkColor> empty_colors; | 573 BreakList<SkColor> empty_colors; |
574 empty_colors.SetMax(text().length()); | 574 empty_colors.SetMax(text().length()); |
575 internal::StyleIterator style(empty_colors, styles()); | 575 internal::StyleIterator style(empty_colors, styles()); |
576 SCRIPT_ITEM* script_item = &script_items[0]; | 576 SCRIPT_ITEM* script_item = &script_items[0]; |
577 const size_t max_run_length = kMaxGlyphs / 2; | 577 const size_t max_run_length = kMaxGlyphs / 2; |
578 for (size_t run_break = 0; run_break < layout_text_length;) { | 578 for (size_t run_break = 0; run_break < layout_text_length;) { |
579 internal::TextRun* run = new internal::TextRun(); | 579 internal::TextRun* run = new internal::TextRun(); |
580 run->range.set_start(run_break); | 580 run->range.set_start(run_break); |
581 run->font = GetFont(); | 581 run->font = GetPrimaryFont(); |
582 run->font_style = (style.style(BOLD) ? Font::BOLD : 0) | | 582 run->font_style = (style.style(BOLD) ? Font::BOLD : 0) | |
583 (style.style(ITALIC) ? Font::ITALIC : 0); | 583 (style.style(ITALIC) ? Font::ITALIC : 0); |
584 DeriveFontIfNecessary(run->font.GetFontSize(), run->font.GetHeight(), | 584 DeriveFontIfNecessary(run->font.GetFontSize(), run->font.GetHeight(), |
585 run->font_style, &run->font); | 585 run->font_style, &run->font); |
586 run->strike = style.style(STRIKE); | 586 run->strike = style.style(STRIKE); |
587 run->diagonal_strike = style.style(DIAGONAL_STRIKE); | 587 run->diagonal_strike = style.style(DIAGONAL_STRIKE); |
588 run->underline = style.style(UNDERLINE); | 588 run->underline = style.style(UNDERLINE); |
589 run->script_analysis = script_item->a; | 589 run->script_analysis = script_item->a; |
590 | 590 |
591 // Find the next break and advance the iterators as needed. | 591 // Find the next break and advance the iterators as needed. |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 size_t position = LayoutIndexToTextIndex(run->range.end()); | 897 size_t position = LayoutIndexToTextIndex(run->range.end()); |
898 position = IndexOfAdjacentGrapheme(position, CURSOR_BACKWARD); | 898 position = IndexOfAdjacentGrapheme(position, CURSOR_BACKWARD); |
899 return SelectionModel(position, CURSOR_FORWARD); | 899 return SelectionModel(position, CURSOR_FORWARD); |
900 } | 900 } |
901 | 901 |
902 RenderText* RenderText::CreateInstance() { | 902 RenderText* RenderText::CreateInstance() { |
903 return new RenderTextWin; | 903 return new RenderTextWin; |
904 } | 904 } |
905 | 905 |
906 } // namespace gfx | 906 } // namespace gfx |
OLD | NEW |