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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |layout|, including set layout text as |text|, font | 67 // Setup pango |layout|; set the |text|, the font description based on |font|, |
68 // description based on |font|, width as |width| in PANGO_SCALE for RTL lcoale, | 68 // the |width| in PANGO_SCALE for RTL locale, the base |text_direction|, |
69 // and set up whether auto-detect directionality, alignment, ellipsis, word | 69 // alignment, ellipsis, word wrapping, resolution, etc. |
70 // wrapping, resolution etc. | |
71 void SetupPangoLayout(PangoLayout* layout, | 70 void SetupPangoLayout(PangoLayout* layout, |
72 const string16& text, | 71 const string16& text, |
73 const gfx::Font& font, | 72 const gfx::Font& font, |
74 int width, | 73 int width, |
75 base::i18n::TextDirection text_direction, | 74 base::i18n::TextDirection text_direction, |
76 int flags); | 75 int flags); |
77 | 76 |
78 // Setup pango layout |layout| the same way as SetupPangoLayout(), except this | 77 // Setup pango layout |layout| the same way as SetupPangoLayout(), except this |
79 // sets the font description based on |font_description|. | 78 // sets the font description based on |font_description|. |
80 void SetupPangoLayoutWithFontDescription( | 79 void SetupPangoLayoutWithFontDescription( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 size_t GetPangoFontSizeInPixels(PangoFontDescription* pango_font); | 114 size_t GetPangoFontSizeInPixels(PangoFontDescription* pango_font); |
116 | 115 |
117 // Retrieves the Pango metrics for a Pango font description. Caches the metrics | 116 // Retrieves the Pango metrics for a Pango font description. Caches the metrics |
118 // and never frees them. The metrics objects are relatively small and very | 117 // and never frees them. The metrics objects are relatively small and very |
119 // expensive to look up. | 118 // expensive to look up. |
120 PangoFontMetrics* GetPangoFontMetrics(PangoFontDescription* desc); | 119 PangoFontMetrics* GetPangoFontMetrics(PangoFontDescription* desc); |
121 | 120 |
122 } // namespace gfx | 121 } // namespace gfx |
123 | 122 |
124 #endif // UI_GFX_PANGO_UTIL_H_ | 123 #endif // UI_GFX_PANGO_UTIL_H_ |
OLD | NEW |