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.
35 *
36 * The actual type of the font will depend on the particular
37 * font technology Cairo was compiled to use.
38 *
39 * Since: 1.18
40 **/
41typedef struct _PangoCairoFont PangoCairoFont;
42
43/* This is a hack because PangoCairo is hijacking the Pango namespace, but
44 * consumers of the PangoCairo API expect these symbols to live under the
45 * PangoCairo namespace.
46 */
47#ifdef __GI_SCANNER__
48#define PANGO_CAIRO_TYPE_FONT (pango_cairo_font_get_type())
49#define PANGO_CAIRO_FONT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PANGO_CAIRO_TYPE_FONT, PangoCairoFont))
50#define PANGO_CAIRO_IS_FONT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PANGO_CAIRO_TYPE_FONT))
51#else
52#define PANGO_TYPE_CAIRO_FONT (pango_cairo_font_get_type ())
53#define PANGO_CAIRO_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CAIRO_FONT, PangoCairoFont))
54#define PANGO_IS_CAIRO_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_CAIRO_FONT))
55#endif
56
57/**
58 * PangoCairoFontMap:
59 *
60 * `PangoCairoFontMap` is an interface exported by font maps for
61 * use with Cairo.
62 *
63 * The actual type of the font map will depend on the particular
64 * font technology Cairo was compiled to use.
65 *
66 * Since: 1.10
67 **/
68typedef struct _PangoCairoFontMap PangoCairoFontMap;
69
70#ifdef __GI_SCANNER__
71#define PANGO_CAIRO_TYPE_FONT_MAP (pango_cairo_font_map_get_type())
72#define PANGO_CAIRO_FONT_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PANGO_CAIRO_TYPE_FONT_MAP, PangoCairoFontMap))
73#define PANGO_CAIRO_IS_FONT_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PANGO_CAIRO_TYPE_FONT_MAP))
74#else
75#define PANGO_TYPE_CAIRO_FONT_MAP (pango_cairo_font_map_get_type ())
76#define PANGO_CAIRO_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CAIRO_FONT_MAP, PangoCairoFontMap))
77#define PANGO_IS_CAIRO_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_CAIRO_FONT_MAP))
78#endif
79
80/**
81 * PangoCairoShapeRendererFunc:
82 * @cr: a Cairo context with current point set to where the shape should
83 * be rendered
84 * @attr: the %PANGO_ATTR_SHAPE to render
85 * @do_path: whether only the shape path should be appended to current
86 * path of @cr and no filling/stroking done. This will be set
87 * to %TRUE when called from pango_cairo_layout_path() and
88 * pango_cairo_layout_line_path() rendering functions.
89 * @data: (closure): user data passed to pango_cairo_context_set_shape_renderer()
90 *
91 * Function type for rendering attributes of type %PANGO_ATTR_SHAPE
92 * with Pango's Cairo renderer.
93 */
94typedef void (* PangoCairoShapeRendererFunc) (cairo_t *cr,
95 PangoAttrShape *attr,
96 gboolean do_path,
97 gpointer data);
98
99/*
100 * PangoCairoFontMap
101 */
102PANGO_AVAILABLE_IN_1_10
103GType pango_cairo_font_map_get_type (void) G_GNUC_CONST;
104
105PANGO_AVAILABLE_IN_1_10
106PangoFontMap *pango_cairo_font_map_new (void);
107PANGO_AVAILABLE_IN_1_18
108PangoFontMap *pango_cairo_font_map_new_for_font_type (cairo_font_type_t fonttype);
109PANGO_AVAILABLE_IN_1_10
110PangoFontMap *pango_cairo_font_map_get_default (void);
111PANGO_AVAILABLE_IN_1_22
112void pango_cairo_font_map_set_default (PangoCairoFontMap *fontmap);
113PANGO_AVAILABLE_IN_1_18
114cairo_font_type_t pango_cairo_font_map_get_font_type (PangoCairoFontMap *fontmap);
115
116PANGO_AVAILABLE_IN_1_10
117void pango_cairo_font_map_set_resolution (PangoCairoFontMap *fontmap,
118 double dpi);
119PANGO_AVAILABLE_IN_1_10
120double pango_cairo_font_map_get_resolution (PangoCairoFontMap *fontmap);
121#ifndef PANGO_DISABLE_DEPRECATED
122PANGO_DEPRECATED_IN_1_22_FOR(pango_font_map_create_context)
123PangoContext *pango_cairo_font_map_create_context (PangoCairoFontMap *fontmap);
124#endif
125
126/*
127 * PangoCairoFont
128 */
129PANGO_AVAILABLE_IN_1_18
130GType pango_cairo_font_get_type (void) G_GNUC_CONST;
131
132PANGO_AVAILABLE_IN_1_18
133cairo_scaled_font_t *pango_cairo_font_get_scaled_font (PangoCairoFont *font);
134
135/* Update a Pango context for the current state of a cairo context
136 */
137PANGO_AVAILABLE_IN_1_10
138void pango_cairo_update_context (cairo_t *cr,
139 PangoContext *context);
140
141PANGO_AVAILABLE_IN_1_10
142void pango_cairo_context_set_font_options (PangoContext *context,
143 const cairo_font_options_t *options);
144PANGO_AVAILABLE_IN_1_10
145const cairo_font_options_t *pango_cairo_context_get_font_options (PangoContext *context);
146
147PANGO_AVAILABLE_IN_1_10
148void pango_cairo_context_set_resolution (PangoContext *context,
149 double dpi);
150PANGO_AVAILABLE_IN_1_10
151double pango_cairo_context_get_resolution (PangoContext *context);
152
153PANGO_AVAILABLE_IN_1_18
154void pango_cairo_context_set_shape_renderer (PangoContext *context,
155 PangoCairoShapeRendererFunc func,
156 gpointer data,
157 GDestroyNotify dnotify);
158PANGO_AVAILABLE_IN_1_18
159PangoCairoShapeRendererFunc pango_cairo_context_get_shape_renderer (PangoContext *context,
160 gpointer *data);
161
162/* Convenience
163 */
164PANGO_AVAILABLE_IN_1_22
165PangoContext *pango_cairo_create_context (cairo_t *cr);
166PANGO_AVAILABLE_IN_ALL
167PangoLayout *pango_cairo_create_layout (cairo_t *cr);
168PANGO_AVAILABLE_IN_1_10
169void pango_cairo_update_layout (cairo_t *cr,
170 PangoLayout *layout);
171
172/*
173 * Rendering
174 */
175PANGO_AVAILABLE_IN_1_10
176void pango_cairo_show_glyph_string (cairo_t *cr,
177 PangoFont *font,
178 PangoGlyphString *glyphs);
179PANGO_AVAILABLE_IN_1_22
180void pango_cairo_show_glyph_item (cairo_t *cr,
181 const char *text,
182 PangoGlyphItem *glyph_item);
183PANGO_AVAILABLE_IN_1_10
184void pango_cairo_show_layout_line (cairo_t *cr,
185 PangoLayoutLine *line);
186PANGO_AVAILABLE_IN_1_10
187void pango_cairo_show_layout (cairo_t *cr,
188 PangoLayout *layout);
189
190PANGO_AVAILABLE_IN_1_14
191void pango_cairo_show_error_underline (cairo_t *cr,
192 double x,
193 double y,
194 double width,
195 double height);
196
197/*
198 * Rendering to a path
199 */
200PANGO_AVAILABLE_IN_1_10
201void pango_cairo_glyph_string_path (cairo_t *cr,
202 PangoFont *font,
203 PangoGlyphString *glyphs);
204PANGO_AVAILABLE_IN_1_10
205void pango_cairo_layout_line_path (cairo_t *cr,
206 PangoLayoutLine *line);
207PANGO_AVAILABLE_IN_1_10
208void pango_cairo_layout_path (cairo_t *cr,
209 PangoLayout *layout);
210
211PANGO_AVAILABLE_IN_1_14
212void pango_cairo_error_underline_path (cairo_t *cr,
213 double x,
214 double y,
215 double width,
216 double height);
217
218G_END_DECLS
219
220#endif /* __PANGOCAIRO_H__ */
221

source code of include/pango-1.0/pango/pangocairo.h