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
28G_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 **/
39typedef 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 **/
53typedef 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 */
72typedef void (* PangoCairoShapeRendererFunc) (cairo_t *cr,
73 PangoAttrShape *attr,
74 gboolean do_path,
75 gpointer data);
76
77/*
78 * PangoCairoFontMap
79 */
80PANGO_AVAILABLE_IN_1_10
81GType pango_cairo_font_map_get_type (void) G_GNUC_CONST;
82
83PANGO_AVAILABLE_IN_1_10
84PangoFontMap *pango_cairo_font_map_new (void);
85PANGO_AVAILABLE_IN_1_18
86PangoFontMap *pango_cairo_font_map_new_for_font_type (cairo_font_type_t fonttype);
87PANGO_AVAILABLE_IN_1_10
88PangoFontMap *pango_cairo_font_map_get_default (void);
89PANGO_AVAILABLE_IN_1_22
90void pango_cairo_font_map_set_default (PangoCairoFontMap *fontmap);
91PANGO_AVAILABLE_IN_1_18
92cairo_font_type_t pango_cairo_font_map_get_font_type (PangoCairoFontMap *fontmap);
93
94PANGO_AVAILABLE_IN_1_10
95void pango_cairo_font_map_set_resolution (PangoCairoFontMap *fontmap,
96 double dpi);
97PANGO_AVAILABLE_IN_1_10
98double pango_cairo_font_map_get_resolution (PangoCairoFontMap *fontmap);
99#ifndef PANGO_DISABLE_DEPRECATED
100PANGO_DEPRECATED_IN_1_22_FOR(pango_font_map_create_context)
101PangoContext *pango_cairo_font_map_create_context (PangoCairoFontMap *fontmap);
102#endif
103
104/*
105 * PangoCairoFont
106 */
107PANGO_AVAILABLE_IN_1_18
108GType pango_cairo_font_get_type (void) G_GNUC_CONST;
109
110PANGO_AVAILABLE_IN_1_18
111cairo_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 */
115PANGO_AVAILABLE_IN_1_10
116void pango_cairo_update_context (cairo_t *cr,
117 PangoContext *context);
118
119PANGO_AVAILABLE_IN_1_10
120void pango_cairo_context_set_font_options (PangoContext *context,
121 const cairo_font_options_t *options);
122PANGO_AVAILABLE_IN_1_10
123const cairo_font_options_t *pango_cairo_context_get_font_options (PangoContext *context);
124
125PANGO_AVAILABLE_IN_1_10
126void pango_cairo_context_set_resolution (PangoContext *context,
127 double dpi);
128PANGO_AVAILABLE_IN_1_10
129double pango_cairo_context_get_resolution (PangoContext *context);
130
131PANGO_AVAILABLE_IN_1_18
132void pango_cairo_context_set_shape_renderer (PangoContext *context,
133 PangoCairoShapeRendererFunc func,
134 gpointer data,
135 GDestroyNotify dnotify);
136PANGO_AVAILABLE_IN_1_18
137PangoCairoShapeRendererFunc pango_cairo_context_get_shape_renderer (PangoContext *context,
138 gpointer *data);
139
140/* Convenience
141 */
142PANGO_AVAILABLE_IN_1_22
143PangoContext *pango_cairo_create_context (cairo_t *cr);
144PANGO_AVAILABLE_IN_ALL
145PangoLayout *pango_cairo_create_layout (cairo_t *cr);
146PANGO_AVAILABLE_IN_1_10
147void pango_cairo_update_layout (cairo_t *cr,
148 PangoLayout *layout);
149
150/*
151 * Rendering
152 */
153PANGO_AVAILABLE_IN_1_10
154void pango_cairo_show_glyph_string (cairo_t *cr,
155 PangoFont *font,
156 PangoGlyphString *glyphs);
157PANGO_AVAILABLE_IN_1_22
158void pango_cairo_show_glyph_item (cairo_t *cr,
159 const char *text,
160 PangoGlyphItem *glyph_item);
161PANGO_AVAILABLE_IN_1_10
162void pango_cairo_show_layout_line (cairo_t *cr,
163 PangoLayoutLine *line);
164PANGO_AVAILABLE_IN_1_10
165void pango_cairo_show_layout (cairo_t *cr,
166 PangoLayout *layout);
167
168PANGO_AVAILABLE_IN_1_14
169void 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 */
178PANGO_AVAILABLE_IN_1_10
179void pango_cairo_glyph_string_path (cairo_t *cr,
180 PangoFont *font,
181 PangoGlyphString *glyphs);
182PANGO_AVAILABLE_IN_1_10
183void pango_cairo_layout_line_path (cairo_t *cr,
184 PangoLayoutLine *line);
185PANGO_AVAILABLE_IN_1_10
186void pango_cairo_layout_path (cairo_t *cr,
187 PangoLayout *layout);
188
189PANGO_AVAILABLE_IN_1_14
190void pango_cairo_error_underline_path (cairo_t *cr,
191 double x,
192 double y,
193 double width,
194 double height);
195
196G_END_DECLS
197
198#endif /* __PANGOCAIRO_H__ */
199