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

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

Issue 19666006: Supports FontList in Textfield. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes examples and unittests. Created 7 years, 4 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 | Annotate | Revision Log
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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 ApplyCompositionAndSelectionStyles(); 530 ApplyCompositionAndSelectionStyles();
531 531
532 // Build the list of runs from the script items and ranged colors/styles. 532 // Build the list of runs from the script items and ranged colors/styles.
533 // TODO(msw): Only break for bold/italic, not color etc. See TextRun comment. 533 // TODO(msw): Only break for bold/italic, not color etc. See TextRun comment.
534 internal::StyleIterator style(colors(), styles()); 534 internal::StyleIterator style(colors(), styles());
535 SCRIPT_ITEM* script_item = &script_items[0]; 535 SCRIPT_ITEM* script_item = &script_items[0];
536 const size_t max_run_length = kMaxGlyphs / 2; 536 const size_t max_run_length = kMaxGlyphs / 2;
537 for (size_t run_break = 0; run_break < layout_text_length;) { 537 for (size_t run_break = 0; run_break < layout_text_length;) {
538 internal::TextRun* run = new internal::TextRun(); 538 internal::TextRun* run = new internal::TextRun();
539 run->range.set_start(run_break); 539 run->range.set_start(run_break);
540 run->font = GetFont(); 540 run->font = GetPrimaryFont();
541 run->font_style = (style.style(BOLD) ? Font::BOLD : 0) | 541 run->font_style = (style.style(BOLD) ? Font::BOLD : 0) |
542 (style.style(ITALIC) ? Font::ITALIC : 0); 542 (style.style(ITALIC) ? Font::ITALIC : 0);
543 DeriveFontIfNecessary(run->font.GetFontSize(), run->font.GetHeight(), 543 DeriveFontIfNecessary(run->font.GetFontSize(), run->font.GetHeight(),
544 run->font_style, &run->font); 544 run->font_style, &run->font);
545 run->foreground = style.color(); 545 run->foreground = style.color();
546 run->strike = style.style(STRIKE); 546 run->strike = style.style(STRIKE);
547 run->diagonal_strike = style.style(DIAGONAL_STRIKE); 547 run->diagonal_strike = style.style(DIAGONAL_STRIKE);
548 run->underline = style.style(UNDERLINE); 548 run->underline = style.style(UNDERLINE);
549 run->script_analysis = script_item->a; 549 run->script_analysis = script_item->a;
550 550
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 size_t position = LayoutIndexToTextIndex(run->range.end()); 841 size_t position = LayoutIndexToTextIndex(run->range.end());
842 position = IndexOfAdjacentGrapheme(position, CURSOR_BACKWARD); 842 position = IndexOfAdjacentGrapheme(position, CURSOR_BACKWARD);
843 return SelectionModel(position, CURSOR_FORWARD); 843 return SelectionModel(position, CURSOR_FORWARD);
844 } 844 }
845 845
846 RenderText* RenderText::CreateInstance() { 846 RenderText* RenderText::CreateInstance() {
847 return new RenderTextWin; 847 return new RenderTextWin;
848 } 848 }
849 849
850 } // namespace gfx 850 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698