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

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

Issue 142523003: Renames gfx::FontList::Derive* family. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced. Created 6 years, 10 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
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/views/examples/text_example.cc » ('j') | 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_pango.h" 5 #include "ui/gfx/render_text_pango.h"
6 6
7 #include <pango/pangocairo.h> 7 #include <pango/pangocairo.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 BreakList<bool>::const_iterator bold = styles()[BOLD].breaks().begin(); 346 BreakList<bool>::const_iterator bold = styles()[BOLD].breaks().begin();
347 BreakList<bool>::const_iterator italic = styles()[ITALIC].breaks().begin(); 347 BreakList<bool>::const_iterator italic = styles()[ITALIC].breaks().begin();
348 while (bold != styles()[BOLD].breaks().end() && 348 while (bold != styles()[BOLD].breaks().end() &&
349 italic != styles()[ITALIC].breaks().end()) { 349 italic != styles()[ITALIC].breaks().end()) {
350 const int style = (bold->second ? Font::BOLD : 0) | 350 const int style = (bold->second ? Font::BOLD : 0) |
351 (italic->second ? Font::ITALIC : 0); 351 (italic->second ? Font::ITALIC : 0);
352 const size_t bold_end = styles()[BOLD].GetRange(bold).end(); 352 const size_t bold_end = styles()[BOLD].GetRange(bold).end();
353 const size_t italic_end = styles()[ITALIC].GetRange(italic).end(); 353 const size_t italic_end = styles()[ITALIC].GetRange(italic).end();
354 const size_t style_end = std::min(bold_end, italic_end); 354 const size_t style_end = std::min(bold_end, italic_end);
355 if (style != font_list().GetFontStyle()) { 355 if (style != font_list().GetFontStyle()) {
356 FontList derived_font_list = font_list().DeriveFontList(style); 356 FontList derived_font_list = font_list().DeriveWithStyle(style);
357 ScopedPangoFontDescription desc(pango_font_description_from_string( 357 ScopedPangoFontDescription desc(pango_font_description_from_string(
358 derived_font_list.GetFontDescriptionString().c_str())); 358 derived_font_list.GetFontDescriptionString().c_str()));
359 359
360 PangoAttribute* pango_attr = pango_attr_font_desc_new(desc.get()); 360 PangoAttribute* pango_attr = pango_attr_font_desc_new(desc.get());
361 pango_attr->start_index = 361 pango_attr->start_index =
362 TextIndexToLayoutIndex(std::max(bold->first, italic->first)); 362 TextIndexToLayoutIndex(std::max(bold->first, italic->first));
363 pango_attr->end_index = TextIndexToLayoutIndex(style_end); 363 pango_attr->end_index = TextIndexToLayoutIndex(style_end);
364 pango_attr_list_insert(attrs, pango_attr); 364 pango_attr_list_insert(attrs, pango_attr);
365 } 365 }
366 bold += bold_end == style_end ? 1 : 0; 366 bold += bold_end == style_end ? 1 : 0;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 int glyph_index) const { 522 int glyph_index) const {
523 return LayoutIndexToTextIndex(run->item->offset + 523 return LayoutIndexToTextIndex(run->item->offset +
524 run->glyphs->log_clusters[glyph_index]); 524 run->glyphs->log_clusters[glyph_index]);
525 } 525 }
526 526
527 RenderText* RenderText::CreateInstance() { 527 RenderText* RenderText::CreateInstance() {
528 return new RenderTextPango; 528 return new RenderTextPango;
529 } 529 }
530 530
531 } // namespace gfx 531 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/views/examples/text_example.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698