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

Side by Side Diff: ui/gfx/pango_util.h

Issue 16051006: ui/gfx: Use base::string16 now that string16 was moved into base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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
« no previous file with comments | « ui/gfx/font_unittest.cc ('k') | ui/gfx/pango_util.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 #ifndef UI_GFX_PANGO_UTIL_H_ 5 #ifndef UI_GFX_PANGO_UTIL_H_
6 #define UI_GFX_PANGO_UTIL_H_ 6 #define UI_GFX_PANGO_UTIL_H_
7 7
8 #include <cairo/cairo.h> 8 #include <cairo/cairo.h>
9 #include <pango/pango.h> 9 #include <pango/pango.h>
10 #include <string> 10 #include <string>
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 PangoFontDescription* get() { return description_; } 45 PangoFontDescription* get() { return description_; }
46 46
47 private: 47 private:
48 PangoFontDescription* description_; 48 PangoFontDescription* description_;
49 49
50 DISALLOW_COPY_AND_ASSIGN(ScopedPangoFontDescription); 50 DISALLOW_COPY_AND_ASSIGN(ScopedPangoFontDescription);
51 }; 51 };
52 52
53 // Uses Pango to draw text onto |cr|. This is the public method for d 53 // Uses Pango to draw text onto |cr|. This is the public method for d
54 void UI_EXPORT DrawTextOntoCairoSurface(cairo_t* cr, 54 void UI_EXPORT DrawTextOntoCairoSurface(cairo_t* cr,
55 const string16& text, 55 const base::string16& text,
56 const gfx::Font& font, 56 const gfx::Font& font,
57 const gfx::Rect& bounds, 57 const gfx::Rect& bounds,
58 const gfx::Rect& clip, 58 const gfx::Rect& clip,
59 SkColor text_color, 59 SkColor text_color,
60 int flags); 60 int flags);
61 61
62 // ---------------------------------------------------------------------------- 62 // ----------------------------------------------------------------------------
63 // All other methods in this file are only to be used within the ui/ directory. 63 // All other methods in this file are only to be used within the ui/ directory.
64 // They are shared with internal skia interfaces. 64 // They are shared with internal skia interfaces.
65 // ---------------------------------------------------------------------------- 65 // ----------------------------------------------------------------------------
66 66
67 // Setup pango |layout|; set the |text|, the font description based on |font|, 67 // Setup pango |layout|; set the |text|, the font description based on |font|,
68 // the |width| in PANGO_SCALE for RTL locale, the base |text_direction|, 68 // the |width| in PANGO_SCALE for RTL locale, the base |text_direction|,
69 // alignment, ellipsis, word wrapping, resolution, etc. 69 // alignment, ellipsis, word wrapping, resolution, etc.
70 void SetupPangoLayout(PangoLayout* layout, 70 void SetupPangoLayout(PangoLayout* layout,
71 const string16& text, 71 const base::string16& text,
72 const gfx::Font& font, 72 const gfx::Font& font,
73 int width, 73 int width,
74 base::i18n::TextDirection text_direction, 74 base::i18n::TextDirection text_direction,
75 int flags); 75 int flags);
76 76
77 // Setup pango layout |layout| the same way as SetupPangoLayout(), except this 77 // Setup pango layout |layout| the same way as SetupPangoLayout(), except this
78 // sets the font description based on |font_description|. 78 // sets the font description based on |font_description|.
79 void SetupPangoLayoutWithFontDescription( 79 void SetupPangoLayoutWithFontDescription(
80 PangoLayout* layout, 80 PangoLayout* layout,
81 const string16& text, 81 const base::string16& text,
82 const std::string& font_description, 82 const std::string& font_description,
83 int width, 83 int width,
84 base::i18n::TextDirection text_direction, 84 base::i18n::TextDirection text_direction,
85 int flags); 85 int flags);
86 86
87 // Draws the |layout| (pango tuple of font, actual text, etc) onto |cr| using 87 // Draws the |layout| (pango tuple of font, actual text, etc) onto |cr| using
88 // |text_color| as the cairo pattern. 88 // |text_color| as the cairo pattern.
89 void DrawPangoLayout(cairo_t* cr, 89 void DrawPangoLayout(cairo_t* cr,
90 PangoLayout* layout, 90 PangoLayout* layout,
91 const Font& font, 91 const Font& font,
(...skipping 15 matching lines...) Expand all
107 size_t GetPangoFontSizeInPixels(PangoFontDescription* pango_font); 107 size_t GetPangoFontSizeInPixels(PangoFontDescription* pango_font);
108 108
109 // Retrieves the Pango metrics for a Pango font description. Caches the metrics 109 // Retrieves the Pango metrics for a Pango font description. Caches the metrics
110 // and never frees them. The metrics objects are relatively small and very 110 // and never frees them. The metrics objects are relatively small and very
111 // expensive to look up. 111 // expensive to look up.
112 PangoFontMetrics* GetPangoFontMetrics(PangoFontDescription* desc); 112 PangoFontMetrics* GetPangoFontMetrics(PangoFontDescription* desc);
113 113
114 } // namespace gfx 114 } // namespace gfx
115 115
116 #endif // UI_GFX_PANGO_UTIL_H_ 116 #endif // UI_GFX_PANGO_UTIL_H_
OLDNEW
« no previous file with comments | « ui/gfx/font_unittest.cc ('k') | ui/gfx/pango_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698