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

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: sync 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
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 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 return SelectionModel(text().length(), caret, SelectionModel::TRAILING); 213 return SelectionModel(text().length(), caret, SelectionModel::TRAILING);
214 } else { // RTL. 214 } else { // RTL.
215 size_t caret = Utf8IndexToUtf16Index(item->offset); 215 size_t caret = Utf8IndexToUtf16Index(item->offset);
216 return SelectionModel(text().length(), caret, SelectionModel::LEADING); 216 return SelectionModel(text().length(), caret, SelectionModel::LEADING);
217 } 217 }
218 } 218 }
219 } 219 }
220 return SelectionModel(0, 0, SelectionModel::LEADING); 220 return SelectionModel(0, 0, SelectionModel::LEADING);
221 } 221 }
222 222
223 bool RenderTextLinux::IsCursorablePosition(size_t position) { 223 bool RenderTextLinux::IsCursorablePosition(size_t position, bool is_trailing) {
msw 2011/11/29 20:42:00 |is_trailing| is unused here... does it really hav
224 if (position == 0 && text().empty()) 224 if (position == 0 && text().empty())
225 return true; 225 return true;
226 226
227 EnsureLayout(); 227 EnsureLayout();
228 return (position < static_cast<size_t>(num_log_attrs_) && 228 return (position < static_cast<size_t>(num_log_attrs_) &&
229 log_attrs_[position].is_cursor_position); 229 log_attrs_[position].is_cursor_position);
230 } 230 }
231 231
232 void RenderTextLinux::UpdateLayout() { 232 void RenderTextLinux::UpdateLayout() {
233 ResetLayout(); 233 ResetLayout();
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 size_t RenderTextLinux::Utf8IndexToUtf16Index(size_t index) const { 651 size_t RenderTextLinux::Utf8IndexToUtf16Index(size_t index) const {
652 int32_t utf16_index = 0; 652 int32_t utf16_index = 0;
653 UErrorCode ec = U_ZERO_ERROR; 653 UErrorCode ec = U_ZERO_ERROR;
654 u_strFromUTF8(NULL, 0, &utf16_index, layout_text_, index, &ec); 654 u_strFromUTF8(NULL, 0, &utf16_index, layout_text_, index, &ec);
655 DCHECK(ec == U_BUFFER_OVERFLOW_ERROR || 655 DCHECK(ec == U_BUFFER_OVERFLOW_ERROR ||
656 ec == U_STRING_NOT_TERMINATED_WARNING); 656 ec == U_STRING_NOT_TERMINATED_WARNING);
657 return utf16_index; 657 return utf16_index;
658 } 658 }
659 659
660 } // namespace gfx 660 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698