| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 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 // Get Pango's calculated size of |layout| and modify |text_rect| within | |
| 88 // |bounds|. | |
| 89 void AdjustTextRectBasedOnLayout(PangoLayout* layout, | |
| 90 const gfx::Rect& bounds, | |
| 91 int flags, | |
| 92 gfx::Rect* text_rect); | |
| 93 | |
| 94 // 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 |
| 95 // |text_color| as the cairo pattern. | 88 // |text_color| as the cairo pattern. |
| 96 void DrawPangoLayout(cairo_t* cr, | 89 void DrawPangoLayout(cairo_t* cr, |
| 97 PangoLayout* layout, | 90 PangoLayout* layout, |
| 98 const Font& font, | 91 const Font& font, |
| 99 const gfx::Rect& bounds, | 92 const gfx::Rect& bounds, |
| 100 const gfx::Rect& text_rect, | 93 const gfx::Rect& text_rect, |
| 101 SkColor text_color, | 94 SkColor text_color, |
| 102 base::i18n::TextDirection text_direction, | 95 base::i18n::TextDirection text_direction, |
| 103 int flags); | 96 int flags); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 114 size_t GetPangoFontSizeInPixels(PangoFontDescription* pango_font); | 107 size_t GetPangoFontSizeInPixels(PangoFontDescription* pango_font); |
| 115 | 108 |
| 116 // 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 |
| 117 // 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 |
| 118 // expensive to look up. | 111 // expensive to look up. |
| 119 PangoFontMetrics* GetPangoFontMetrics(PangoFontDescription* desc); | 112 PangoFontMetrics* GetPangoFontMetrics(PangoFontDescription* desc); |
| 120 | 113 |
| 121 } // namespace gfx | 114 } // namespace gfx |
| 122 | 115 |
| 123 #endif // UI_GFX_PANGO_UTIL_H_ | 116 #endif // UI_GFX_PANGO_UTIL_H_ |
| OLD | NEW |