| 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. | 
| 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 |  **/ | 
| 41 | typedef 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 |  **/ | 
| 68 | typedef 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 |  */ | 
| 94 | typedef void (* PangoCairoShapeRendererFunc) (cairo_t        *cr, | 
| 95 | 					      PangoAttrShape *attr, | 
| 96 | 					      gboolean        do_path, | 
| 97 | 					      gpointer        data); | 
| 98 |  | 
| 99 | /* | 
| 100 |  * PangoCairoFontMap | 
| 101 |  */ | 
| 102 | PANGO_AVAILABLE_IN_1_10 | 
| 103 | GType         pango_cairo_font_map_get_type          (void) G_GNUC_CONST; | 
| 104 |  | 
| 105 | PANGO_AVAILABLE_IN_1_10 | 
| 106 | PangoFontMap *pango_cairo_font_map_new               (void); | 
| 107 | PANGO_AVAILABLE_IN_1_18 | 
| 108 | PangoFontMap *pango_cairo_font_map_new_for_font_type (cairo_font_type_t fonttype); | 
| 109 | PANGO_AVAILABLE_IN_1_10 | 
| 110 | PangoFontMap *pango_cairo_font_map_get_default       (void); | 
| 111 | PANGO_AVAILABLE_IN_1_22 | 
| 112 | void          pango_cairo_font_map_set_default       (PangoCairoFontMap *fontmap); | 
| 113 | PANGO_AVAILABLE_IN_1_18 | 
| 114 | cairo_font_type_t pango_cairo_font_map_get_font_type (PangoCairoFontMap *fontmap); | 
| 115 |  | 
| 116 | PANGO_AVAILABLE_IN_1_10 | 
| 117 | void          pango_cairo_font_map_set_resolution (PangoCairoFontMap *fontmap, | 
| 118 | 						   double             dpi); | 
| 119 | PANGO_AVAILABLE_IN_1_10 | 
| 120 | double        pango_cairo_font_map_get_resolution (PangoCairoFontMap *fontmap); | 
| 121 | #ifndef PANGO_DISABLE_DEPRECATED | 
| 122 | PANGO_DEPRECATED_IN_1_22_FOR(pango_font_map_create_context) | 
| 123 | PangoContext *pango_cairo_font_map_create_context (PangoCairoFontMap *fontmap); | 
| 124 | #endif | 
| 125 |  | 
| 126 | /* | 
| 127 |  * PangoCairoFont | 
| 128 |  */ | 
| 129 | PANGO_AVAILABLE_IN_1_18 | 
| 130 | GType         pango_cairo_font_get_type               (void) G_GNUC_CONST; | 
| 131 |  | 
| 132 | PANGO_AVAILABLE_IN_1_18 | 
| 133 | cairo_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 |  */ | 
| 137 | PANGO_AVAILABLE_IN_1_10 | 
| 138 | void         pango_cairo_update_context (cairo_t      *cr, | 
| 139 | 					 PangoContext *context); | 
| 140 |  | 
| 141 | PANGO_AVAILABLE_IN_1_10 | 
| 142 | void                        pango_cairo_context_set_font_options (PangoContext               *context, | 
| 143 | 								  const cairo_font_options_t *options); | 
| 144 | PANGO_AVAILABLE_IN_1_10 | 
| 145 | const cairo_font_options_t *pango_cairo_context_get_font_options (PangoContext               *context); | 
| 146 |  | 
| 147 | PANGO_AVAILABLE_IN_1_10 | 
| 148 | void               pango_cairo_context_set_resolution     (PangoContext       *context, | 
| 149 | 							   double              dpi); | 
| 150 | PANGO_AVAILABLE_IN_1_10 | 
| 151 | double             pango_cairo_context_get_resolution     (PangoContext       *context); | 
| 152 |  | 
| 153 | PANGO_AVAILABLE_IN_1_18 | 
| 154 | void                        pango_cairo_context_set_shape_renderer (PangoContext                *context, | 
| 155 | 								    PangoCairoShapeRendererFunc  func, | 
| 156 | 								    gpointer                     data, | 
| 157 | 								    GDestroyNotify               dnotify); | 
| 158 | PANGO_AVAILABLE_IN_1_18 | 
| 159 | PangoCairoShapeRendererFunc pango_cairo_context_get_shape_renderer (PangoContext                *context, | 
| 160 | 								    gpointer                    *data); | 
| 161 |  | 
| 162 | /* Convenience | 
| 163 |  */ | 
| 164 | PANGO_AVAILABLE_IN_1_22 | 
| 165 | PangoContext *pango_cairo_create_context (cairo_t   *cr); | 
| 166 | PANGO_AVAILABLE_IN_ALL | 
| 167 | PangoLayout *pango_cairo_create_layout (cairo_t     *cr); | 
| 168 | PANGO_AVAILABLE_IN_1_10 | 
| 169 | void         pango_cairo_update_layout (cairo_t     *cr, | 
| 170 | 					PangoLayout *layout); | 
| 171 |  | 
| 172 | /* | 
| 173 |  * Rendering | 
| 174 |  */ | 
| 175 | PANGO_AVAILABLE_IN_1_10 | 
| 176 | void pango_cairo_show_glyph_string (cairo_t          *cr, | 
| 177 | 				    PangoFont        *font, | 
| 178 | 				    PangoGlyphString *glyphs); | 
| 179 | PANGO_AVAILABLE_IN_1_22 | 
| 180 | void pango_cairo_show_glyph_item   (cairo_t          *cr, | 
| 181 | 				    const char       *text, | 
| 182 | 				    PangoGlyphItem   *glyph_item); | 
| 183 | PANGO_AVAILABLE_IN_1_10 | 
| 184 | void pango_cairo_show_layout_line  (cairo_t          *cr, | 
| 185 | 				    PangoLayoutLine  *line); | 
| 186 | PANGO_AVAILABLE_IN_1_10 | 
| 187 | void pango_cairo_show_layout       (cairo_t          *cr, | 
| 188 | 				    PangoLayout      *layout); | 
| 189 |  | 
| 190 | PANGO_AVAILABLE_IN_1_14 | 
| 191 | void 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 |  */ | 
| 200 | PANGO_AVAILABLE_IN_1_10 | 
| 201 | void pango_cairo_glyph_string_path (cairo_t          *cr, | 
| 202 | 				    PangoFont        *font, | 
| 203 | 				    PangoGlyphString *glyphs); | 
| 204 | PANGO_AVAILABLE_IN_1_10 | 
| 205 | void pango_cairo_layout_line_path  (cairo_t          *cr, | 
| 206 | 				    PangoLayoutLine  *line); | 
| 207 | PANGO_AVAILABLE_IN_1_10 | 
| 208 | void pango_cairo_layout_path       (cairo_t          *cr, | 
| 209 | 				    PangoLayout      *layout); | 
| 210 |  | 
| 211 | PANGO_AVAILABLE_IN_1_14 | 
| 212 | void pango_cairo_error_underline_path (cairo_t       *cr, | 
| 213 | 				       double         x, | 
| 214 | 				       double         y, | 
| 215 | 				       double         width, | 
| 216 | 				       double         height); | 
| 217 |  | 
| 218 | G_END_DECLS | 
| 219 |  | 
| 220 | #endif /* __PANGOCAIRO_H__ */ | 
| 221 |  |