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