Upload tizen 2.0 beta source
[external/pango1.0.git] / pango / pangocairo.h
1 /* Pango
2  * pangocairo.h:
3  *
4  * Copyright (C) 1999, 2004 Red Hat, Inc.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #ifndef __PANGOCAIRO_H__
23 #define __PANGOCAIRO_H__
24
25 #include <pango/pango.h>
26 #include <cairo.h>
27
28 G_BEGIN_DECLS
29
30 /**
31  * PangoCairoFont:
32  *
33  * #PangoCairoFont is an interface exported by fonts for
34  * use with Cairo. The actual type of the font will depend
35  * on the particular font technology Cairo was compiled to use.
36  *
37  * Since: 1.18
38  **/
39 typedef struct _PangoCairoFont      PangoCairoFont;
40 #define PANGO_TYPE_CAIRO_FONT       (pango_cairo_font_get_type ())
41 #define PANGO_CAIRO_FONT(object)    (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CAIRO_FONT, PangoCairoFont))
42 #define PANGO_IS_CAIRO_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_CAIRO_FONT))
43
44 /**
45  * PangoCairoFontMap:
46  *
47  * #PangoCairoFontMap is an interface exported by font maps for
48  * use with Cairo. The actual type of the font map will depend
49  * on the particular font technology Cairo was compiled to use.
50  *
51  * Since: 1.10
52  **/
53 typedef struct _PangoCairoFontMap        PangoCairoFontMap;
54 #define PANGO_TYPE_CAIRO_FONT_MAP       (pango_cairo_font_map_get_type ())
55 #define PANGO_CAIRO_FONT_MAP(object)    (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CAIRO_FONT_MAP, PangoCairoFontMap))
56 #define PANGO_IS_CAIRO_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_CAIRO_FONT_MAP))
57
58 typedef void (* PangoCairoShapeRendererFunc) (cairo_t        *cr,
59                                               PangoAttrShape *attr,
60                                               gboolean        do_path,
61                                               gpointer        data);
62
63 /*
64  * PangoCairoFontMap
65  */
66 GType         pango_cairo_font_map_get_type          (void) G_GNUC_CONST;
67
68 PangoFontMap *pango_cairo_font_map_new               (void);
69 PangoFontMap *pango_cairo_font_map_new_for_font_type (cairo_font_type_t fonttype);
70 PangoFontMap *pango_cairo_font_map_get_default       (void);
71 void          pango_cairo_font_map_set_default       (PangoCairoFontMap *fontmap);
72 cairo_font_type_t pango_cairo_font_map_get_font_type (PangoCairoFontMap *fontmap);
73
74 void          pango_cairo_font_map_set_resolution (PangoCairoFontMap *fontmap,
75                                                    double             dpi);
76 double        pango_cairo_font_map_get_resolution (PangoCairoFontMap *fontmap);
77 #ifndef PANGO_DISABLE_DEPRECATED
78 PangoContext *pango_cairo_font_map_create_context (PangoCairoFontMap *fontmap);
79 #endif
80
81 /*
82  * PangoCairoFont
83  */
84 GType         pango_cairo_font_get_type               (void) G_GNUC_CONST;
85
86 cairo_scaled_font_t *pango_cairo_font_get_scaled_font (PangoCairoFont *font);
87
88 /* Update a Pango context for the current state of a cairo context
89  */
90 void         pango_cairo_update_context (cairo_t      *cr,
91                                          PangoContext *context);
92
93 void                        pango_cairo_context_set_font_options (PangoContext               *context,
94                                                                   const cairo_font_options_t *options);
95 const cairo_font_options_t *pango_cairo_context_get_font_options (PangoContext               *context);
96
97 void               pango_cairo_context_set_resolution     (PangoContext       *context,
98                                                            double              dpi);
99 double             pango_cairo_context_get_resolution     (PangoContext       *context);
100
101 void                        pango_cairo_context_set_shape_renderer (PangoContext                *context,
102                                                                     PangoCairoShapeRendererFunc  func,
103                                                                     gpointer                     data,
104                                                                     GDestroyNotify               dnotify);
105 PangoCairoShapeRendererFunc pango_cairo_context_get_shape_renderer (PangoContext                *context,
106                                                                     gpointer                    *data);
107
108 /* Convenience
109  */
110 PangoContext *pango_cairo_create_context (cairo_t   *cr);
111 PangoLayout *pango_cairo_create_layout (cairo_t     *cr);
112 void         pango_cairo_update_layout (cairo_t     *cr,
113                                         PangoLayout *layout);
114
115 /*
116  * Rendering
117  */
118 void pango_cairo_show_glyph_string (cairo_t          *cr,
119                                     PangoFont        *font,
120                                     PangoGlyphString *glyphs);
121 void pango_cairo_show_glyph_item   (cairo_t          *cr,
122                                     const char       *text,
123                                     PangoGlyphItem   *glyph_item);
124 void pango_cairo_show_layout_line  (cairo_t          *cr,
125                                     PangoLayoutLine  *line);
126 void pango_cairo_show_layout       (cairo_t          *cr,
127                                     PangoLayout      *layout);
128
129 void pango_cairo_show_error_underline (cairo_t       *cr,
130                                        double         x,
131                                        double         y,
132                                        double         width,
133                                        double         height);
134
135 /*
136  * Rendering to a path
137  */
138 void pango_cairo_glyph_string_path (cairo_t          *cr,
139                                     PangoFont        *font,
140                                     PangoGlyphString *glyphs);
141 void pango_cairo_layout_line_path  (cairo_t          *cr,
142                                     PangoLayoutLine  *line);
143 void pango_cairo_layout_path       (cairo_t          *cr,
144                                     PangoLayout      *layout);
145
146 void pango_cairo_error_underline_path (cairo_t       *cr,
147                                        double         x,
148                                        double         y,
149                                        double         width,
150                                        double         height);
151
152 G_END_DECLS
153
154 #endif /* __PANGOCAIRO_H__ */