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 #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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
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 GFX_EXPORT DrawTextOntoCairoSurface(cairo_t* cr, |
55 const base::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, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_ |
OLD | NEW |