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 | /** |
59 | * PangoCairoShapeRendererFunc: |
60 | * @cr: a Cairo context with current point set to where the shape should |
61 | * be rendered |
62 | * @attr: the %PANGO_ATTR_SHAPE to render |
63 | * @do_path: whether only the shape path should be appended to current |
64 | * path of @cr and no filling/stroking done. This will be set |
65 | * to %TRUE when called from pango_cairo_layout_path() and |
66 | * pango_cairo_layout_line_path() rendering functions. |
67 | * @data: user data passed to pango_cairo_context_set_shape_renderer() |
68 | * |
69 | * Function type for rendering attributes of type %PANGO_ATTR_SHAPE |
70 | * with Pango's Cairo renderer. |
71 | */ |
72 | typedef void (* PangoCairoShapeRendererFunc) (cairo_t *cr, |
73 | PangoAttrShape *attr, |
74 | gboolean do_path, |
75 | gpointer data); |
76 | |
77 | /* |
78 | * PangoCairoFontMap |
79 | */ |
80 | PANGO_AVAILABLE_IN_1_10 |
81 | GType pango_cairo_font_map_get_type (void) G_GNUC_CONST; |
82 | |
83 | PANGO_AVAILABLE_IN_1_10 |
84 | PangoFontMap *pango_cairo_font_map_new (void); |
85 | PANGO_AVAILABLE_IN_1_18 |
86 | PangoFontMap *pango_cairo_font_map_new_for_font_type (cairo_font_type_t fonttype); |
87 | PANGO_AVAILABLE_IN_1_10 |
88 | PangoFontMap *pango_cairo_font_map_get_default (void); |
89 | PANGO_AVAILABLE_IN_1_22 |
90 | void pango_cairo_font_map_set_default (PangoCairoFontMap *fontmap); |
91 | PANGO_AVAILABLE_IN_1_18 |
92 | cairo_font_type_t pango_cairo_font_map_get_font_type (PangoCairoFontMap *fontmap); |
93 | |
94 | PANGO_AVAILABLE_IN_1_10 |
95 | void pango_cairo_font_map_set_resolution (PangoCairoFontMap *fontmap, |
96 | double dpi); |
97 | PANGO_AVAILABLE_IN_1_10 |
98 | double pango_cairo_font_map_get_resolution (PangoCairoFontMap *fontmap); |
99 | #ifndef PANGO_DISABLE_DEPRECATED |
100 | PANGO_DEPRECATED_IN_1_22_FOR(pango_font_map_create_context) |
101 | PangoContext *pango_cairo_font_map_create_context (PangoCairoFontMap *fontmap); |
102 | #endif |
103 | |
104 | /* |
105 | * PangoCairoFont |
106 | */ |
107 | PANGO_AVAILABLE_IN_1_18 |
108 | GType pango_cairo_font_get_type (void) G_GNUC_CONST; |
109 | |
110 | PANGO_AVAILABLE_IN_1_18 |
111 | cairo_scaled_font_t *pango_cairo_font_get_scaled_font (PangoCairoFont *font); |
112 | |
113 | /* Update a Pango context for the current state of a cairo context |
114 | */ |
115 | PANGO_AVAILABLE_IN_1_10 |
116 | void pango_cairo_update_context (cairo_t *cr, |
117 | PangoContext *context); |
118 | |
119 | PANGO_AVAILABLE_IN_1_10 |
120 | void pango_cairo_context_set_font_options (PangoContext *context, |
121 | const cairo_font_options_t *options); |
122 | PANGO_AVAILABLE_IN_1_10 |
123 | const cairo_font_options_t *pango_cairo_context_get_font_options (PangoContext *context); |
124 | |
125 | PANGO_AVAILABLE_IN_1_10 |
126 | void pango_cairo_context_set_resolution (PangoContext *context, |
127 | double dpi); |
128 | PANGO_AVAILABLE_IN_1_10 |
129 | double pango_cairo_context_get_resolution (PangoContext *context); |
130 | |
131 | PANGO_AVAILABLE_IN_1_18 |
132 | void pango_cairo_context_set_shape_renderer (PangoContext *context, |
133 | PangoCairoShapeRendererFunc func, |
134 | gpointer data, |
135 | GDestroyNotify dnotify); |
136 | PANGO_AVAILABLE_IN_1_18 |
137 | PangoCairoShapeRendererFunc pango_cairo_context_get_shape_renderer (PangoContext *context, |
138 | gpointer *data); |
139 | |
140 | /* Convenience |
141 | */ |
142 | PANGO_AVAILABLE_IN_1_22 |
143 | PangoContext *pango_cairo_create_context (cairo_t *cr); |
144 | PANGO_AVAILABLE_IN_ALL |
145 | PangoLayout *pango_cairo_create_layout (cairo_t *cr); |
146 | PANGO_AVAILABLE_IN_1_10 |
147 | void pango_cairo_update_layout (cairo_t *cr, |
148 | PangoLayout *layout); |
149 | |
150 | /* |
151 | * Rendering |
152 | */ |
153 | PANGO_AVAILABLE_IN_1_10 |
154 | void pango_cairo_show_glyph_string (cairo_t *cr, |
155 | PangoFont *font, |
156 | PangoGlyphString *glyphs); |
157 | PANGO_AVAILABLE_IN_1_22 |
158 | void pango_cairo_show_glyph_item (cairo_t *cr, |
159 | const char *text, |
160 | PangoGlyphItem *glyph_item); |
161 | PANGO_AVAILABLE_IN_1_10 |
162 | void pango_cairo_show_layout_line (cairo_t *cr, |
163 | PangoLayoutLine *line); |
164 | PANGO_AVAILABLE_IN_1_10 |
165 | void pango_cairo_show_layout (cairo_t *cr, |
166 | PangoLayout *layout); |
167 | |
168 | PANGO_AVAILABLE_IN_1_14 |
169 | void pango_cairo_show_error_underline (cairo_t *cr, |
170 | double x, |
171 | double y, |
172 | double width, |
173 | double height); |
174 | |
175 | /* |
176 | * Rendering to a path |
177 | */ |
178 | PANGO_AVAILABLE_IN_1_10 |
179 | void pango_cairo_glyph_string_path (cairo_t *cr, |
180 | PangoFont *font, |
181 | PangoGlyphString *glyphs); |
182 | PANGO_AVAILABLE_IN_1_10 |
183 | void pango_cairo_layout_line_path (cairo_t *cr, |
184 | PangoLayoutLine *line); |
185 | PANGO_AVAILABLE_IN_1_10 |
186 | void pango_cairo_layout_path (cairo_t *cr, |
187 | PangoLayout *layout); |
188 | |
189 | PANGO_AVAILABLE_IN_1_14 |
190 | void pango_cairo_error_underline_path (cairo_t *cr, |
191 | double x, |
192 | double y, |
193 | double width, |
194 | double height); |
195 | |
196 | G_END_DECLS |
197 | |
198 | #endif /* __PANGOCAIRO_H__ */ |
199 | |