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_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 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
276 cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 0, 0); | 276 cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 0, 0); |
277 cairo_t* cr = cairo_create(surface); | 277 cairo_t* cr = cairo_create(surface); |
278 | 278 |
279 layout_ = pango_cairo_create_layout(cr); | 279 layout_ = pango_cairo_create_layout(cr); |
280 cairo_destroy(cr); | 280 cairo_destroy(cr); |
281 cairo_surface_destroy(surface); | 281 cairo_surface_destroy(surface); |
282 | 282 |
283 SetupPangoLayoutWithFontDescription(layout_, | 283 SetupPangoLayoutWithFontDescription(layout_, |
284 GetDisplayText(), | 284 GetDisplayText(), |
285 font_list().GetFontDescriptionString(), | 285 font_list().GetFontDescriptionString(), |
286 display_rect().width(), | 286 0, |
msw
2012/08/09 19:54:50
Why not continue to pass in the width here? It's a
Alexei Svitkine (slow)
2012/08/09 20:03:01
See the pango_layout_set_width() call below that j
| |
287 GetTextDirection(), | 287 GetTextDirection(), |
288 Canvas::DefaultCanvasTextAlignment()); | 288 Canvas::DefaultCanvasTextAlignment()); |
289 | 289 |
290 // No width set so that the x-axis position is relative to the start of the | 290 // No width set so that the x-axis position is relative to the start of the |
291 // text. ToViewPoint and ToTextPoint take care of the position conversion | 291 // text. ToViewPoint and ToTextPoint take care of the position conversion |
292 // between text space and view spaces. | 292 // between text space and view spaces. |
293 pango_layout_set_width(layout_, -1); | 293 pango_layout_set_width(layout_, -1); |
294 // TODO(xji): If RenderText will be used for displaying purpose, such as | 294 // TODO(xji): If RenderText will be used for displaying purpose, such as |
295 // label, we will need to remove the single-line-mode setting. | 295 // label, we will need to remove the single-line-mode setting. |
296 pango_layout_set_single_paragraph_mode(layout_, true); | 296 pango_layout_set_single_paragraph_mode(layout_, true); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
540 if (selection_visual_bounds_.empty()) | 540 if (selection_visual_bounds_.empty()) |
541 selection_visual_bounds_ = CalculateSubstringBounds(selection()); | 541 selection_visual_bounds_ = CalculateSubstringBounds(selection()); |
542 return selection_visual_bounds_; | 542 return selection_visual_bounds_; |
543 } | 543 } |
544 | 544 |
545 RenderText* RenderText::CreateInstance() { | 545 RenderText* RenderText::CreateInstance() { |
546 return new RenderTextLinux; | 546 return new RenderTextLinux; |
547 } | 547 } |
548 | 548 |
549 } // namespace gfx | 549 } // namespace gfx |
OLD | NEW |