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

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

Issue 8575020: Improve RenderTextWin font fallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Disabling more under XP. Created 9 years 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/gfx/render_text_unittest.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_linux.h" 5 #include "ui/gfx/render_text_linux.h"
6 6
7 #include <pango/pangocairo.h> 7 #include <pango/pangocairo.h>
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/i18n/break_iterator.h" 10 #include "base/i18n/break_iterator.h"
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // Vertically centered. 277 // Vertically centered.
278 int text_y = offset.y() + ((bounds.height() - text_height) / 2); 278 int text_y = offset.y() + ((bounds.height() - text_height) / 2);
279 // TODO(xji): need to use SkCanvas->drawPosText() for gpu acceleration. 279 // TODO(xji): need to use SkCanvas->drawPosText() for gpu acceleration.
280 cairo_move_to(cr, offset.x(), text_y); 280 cairo_move_to(cr, offset.x(), text_y);
281 pango_cairo_show_layout(cr, layout_); 281 pango_cairo_show_layout(cr, layout_);
282 282
283 cairo_restore(cr); 283 cairo_restore(cr);
284 } 284 }
285 285
286 size_t RenderTextLinux::IndexOfAdjacentGrapheme(size_t index, bool next) { 286 size_t RenderTextLinux::IndexOfAdjacentGrapheme(size_t index, bool next) {
287 if (index > text().length())
288 return text().length();
287 EnsureLayout(); 289 EnsureLayout();
288 return Utf16IndexOfAdjacentGrapheme(Utf16IndexToUtf8Index(index), next); 290 return Utf16IndexOfAdjacentGrapheme(Utf16IndexToUtf8Index(index), next);
289 } 291 }
290 292
291 GSList* RenderTextLinux::GetRunContainingPosition(size_t position) const { 293 GSList* RenderTextLinux::GetRunContainingPosition(size_t position) const {
292 GSList* run = current_line_->runs; 294 GSList* run = current_line_->runs;
293 while (run) { 295 while (run) {
294 PangoItem* item = reinterpret_cast<PangoLayoutRun*>(run->data)->item; 296 PangoItem* item = reinterpret_cast<PangoLayoutRun*>(run->data)->item;
295 size_t run_start = Utf8IndexToUtf16Index(item->offset); 297 size_t run_start = Utf8IndexToUtf16Index(item->offset);
296 size_t run_end = Utf8IndexToUtf16Index(item->offset + item->length); 298 size_t run_end = Utf8IndexToUtf16Index(item->offset + item->length);
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 } 685 }
684 686
685 void RenderTextLinux::GetSelectionBounds(std::vector<Rect>* bounds) { 687 void RenderTextLinux::GetSelectionBounds(std::vector<Rect>* bounds) {
686 if (selection_visual_bounds_.empty()) 688 if (selection_visual_bounds_.empty())
687 CalculateSubstringBounds(GetSelectionStart(), GetCursorPosition(), 689 CalculateSubstringBounds(GetSelectionStart(), GetCursorPosition(),
688 &selection_visual_bounds_); 690 &selection_visual_bounds_);
689 *bounds = selection_visual_bounds_; 691 *bounds = selection_visual_bounds_;
690 } 692 }
691 693
692 } // namespace gfx 694 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698