Index: ui/gfx/pango_util.h |
diff --git a/ui/gfx/pango_util.h b/ui/gfx/pango_util.h |
index a49ffaab379769a2741be63ab0fd12dd8d625b6b..7cd7720903fa627a4d2ecf2109f98054412c5af9 100644 |
--- a/ui/gfx/pango_util.h |
+++ b/ui/gfx/pango_util.h |
@@ -6,15 +6,35 @@ |
#define UI_GFX_PANGO_UTIL_H_ |
#pragma once |
+#include <cairo/cairo.h> |
#include <pango/pango.h> |
+ |
#include "base/i18n/rtl.h" |
#include "base/string16.h" |
+#include "ui/base/ui_export.h" |
+#include "third_party/skia/include/core/SkColor.h" |
// TODO(xji): move other pango related functions from gtk_util to here. |
namespace gfx { |
class Font; |
+class PlatformFontPango; |
+class Rect; |
+ |
+// Uses Pango to draw text onto |cr|. This is the public method for d |
+void UI_EXPORT DrawTextOntoCairoSurface(cairo_t* cr, |
+ const string16& text, |
+ const gfx::Font& font, |
+ const gfx::Rect& bounds, |
+ const gfx::Rect& clip, |
+ const SkColor& text_color, |
+ int flags); |
+ |
+// ---------------------------------------------------------------------------- |
+// All other methods in this file are only to be used within the ui/ directory. |
+// They are shared with internal skia interfaces. |
+// ---------------------------------------------------------------------------- |
// Setup pango layout |layout|, including set layout text as |text|, font |
// description based on |font|, width as |width| in PANGO_SCALE for RTL lcoale, |
@@ -26,6 +46,33 @@ void SetupPangoLayout(PangoLayout* layout, |
int width, |
base::i18n::TextDirection text_direction, |
int flags); |
+ |
+// Get Pango's calculated size of |layout| and modify |text_rect| within |
+// |bounds|. |
+void AdjustTextRectBasedOnLayout(PangoLayout* layout, |
+ const gfx::Rect& bounds, |
+ int flags, |
+ gfx::Rect* text_rect); |
+ |
+// Draws the |layout| (pango tuple of font, actual text, etc) onto |cr| using |
+// |text_color| as the cairo pattern. |
+void DrawPangoLayout(cairo_t* cr, |
+ PangoLayout* layout, |
+ const Font& font, |
+ const gfx::Rect& bounds, |
+ const gfx::Rect& text_rect, |
+ const SkColor& text_color, |
+ base::i18n::TextDirection text_direction, |
+ int flags); |
+ |
+// Draw an underline under the text using |cr|, which must already be |
+// initialized with the correct source. |extra_edge_width| is added to the |
+// outer edge of the line. |
+void DrawPangoTextUnderline(cairo_t* cr, |
+ gfx::PlatformFontPango* platform_font, |
+ double extra_edge_width, |
+ const Rect& text_rect); |
+ |
} // namespace gfx |
#endif // UI_GFX_PANGO_UTIL_H_ |