1 /* 2 * Distributed under the Boost Software License, Version 1.0. 3 * (See accompanying file LICENSE_1_0.txt or copy at 4 * http://www.boost.org/LICENSE_1_0.txt) 5 */ 6 module pango.c.cairo; 7 8 import pango.c.attributes; 9 import pango.c.bidi_type; 10 import pango.c.break_; 11 import pango.c.context; 12 import pango.c.coverage; 13 import pango.c.engine; 14 import pango.c.font; 15 import pango.c.fontmap; 16 import pango.c.fontset; 17 import pango.c.glyph_item; 18 import pango.c.glyph; 19 import pango.c.gravity; 20 import pango.c.item; 21 import pango.c.language; 22 import pango.c.layout; 23 import pango.c.matrix; 24 import pango.c.modules; 25 import pango.c.renderer; 26 import pango.c.script; 27 import pango.c.tabs; 28 import pango.c.types; 29 import pango.c.utils; 30 import pango.c.win32; 31 32 import glib; 33 import gobject; 34 import cairo.c.cairo; 35 36 37 extern (C): 38 39 /** 40 * PangoCairoFont: 41 * 42 * #PangoCairoFont is an interface exported by fonts for 43 * use with Cairo. The actual type of the font will depend 44 * on the particular font technology Cairo was compiled to use. 45 * 46 * Since: 1.18 47 **/ 48 struct PangoCairoFont; 49 50 /** 51 * PangoCairoFontMap: 52 * 53 * #PangoCairoFontMap is an interface exported by font maps for 54 * use with Cairo. The actual type of the font map will depend 55 * on the particular font technology Cairo was compiled to use. 56 * 57 * Since: 1.10 58 **/ 59 struct PangoCairoFontMap; 60 61 /** 62 * PangoCairoShapeRendererFunc: 63 * @cr: a Cairo context with current point set to where the shape should 64 * be rendered 65 * @attr: the %PANGO_ATTR_SHAPE to render 66 * @do_path: whether only the shape path should be appended to current 67 * path of @cr and no filling/stroking done. This will be set 68 * to %TRUE when called from pango_cairo_layout_path() and 69 * pango_cairo_layout_line_path() rendering functions. 70 * @data: user data passed to pango_cairo_context_set_shape_renderer() 71 * 72 * Function type for rendering attributes of type %PANGO_ATTR_SHAPE 73 * with Pango's Cairo renderer. 74 */ 75 alias PangoCairoShapeRendererFunc = void function (cairo_t *cr, 76 PangoAttrShape *attr, 77 gboolean do_path, 78 gpointer data); 79 80 /* 81 * PangoCairoFontMap 82 */ 83 pure GType pango_cairo_font_map_get_type (); 84 85 PangoFontMap *pango_cairo_font_map_new (); 86 PangoFontMap *pango_cairo_font_map_new_for_font_type (cairo_font_type_t fonttype); 87 PangoFontMap *pango_cairo_font_map_get_default (); 88 void pango_cairo_font_map_set_default (PangoCairoFontMap *fontmap); 89 cairo_font_type_t pango_cairo_font_map_get_font_type (PangoCairoFontMap *fontmap); 90 91 void pango_cairo_font_map_set_resolution (PangoCairoFontMap *fontmap, 92 double dpi); 93 double pango_cairo_font_map_get_resolution (PangoCairoFontMap *fontmap); 94 95 /* 96 * PangoCairoFont 97 */ 98 pure GType pango_cairo_font_get_type (); 99 100 cairo_scaled_font_t *pango_cairo_font_get_scaled_font (PangoCairoFont *font); 101 102 /* Update a Pango context for the current state of a cairo context 103 */ 104 void pango_cairo_update_context (cairo_t *cr, 105 PangoContext *context); 106 107 void pango_cairo_context_set_font_options (PangoContext *context, 108 const(cairo_font_options_t) *options); 109 const(cairo_font_options_t) *pango_cairo_context_get_font_options (PangoContext *context); 110 111 void pango_cairo_context_set_resolution (PangoContext *context, 112 double dpi); 113 double pango_cairo_context_get_resolution (PangoContext *context); 114 115 void pango_cairo_context_set_shape_renderer (PangoContext *context, 116 PangoCairoShapeRendererFunc func, 117 gpointer data, 118 GDestroyNotify dnotify); 119 PangoCairoShapeRendererFunc pango_cairo_context_get_shape_renderer (PangoContext *context, 120 gpointer *data); 121 122 /* Convenience 123 */ 124 PangoContext *pango_cairo_create_context (cairo_t *cr); 125 PangoLayout *pango_cairo_create_layout (cairo_t *cr); 126 void pango_cairo_update_layout (cairo_t *cr, 127 PangoLayout *layout); 128 129 /* 130 * Rendering 131 */ 132 void pango_cairo_show_glyph_string (cairo_t *cr, 133 PangoFont *font, 134 PangoGlyphString *glyphs); 135 void pango_cairo_show_glyph_item (cairo_t *cr, 136 const(char) *text, 137 PangoGlyphItem *glyph_item); 138 void pango_cairo_show_layout_line (cairo_t *cr, 139 PangoLayoutLine *line); 140 void pango_cairo_show_layout (cairo_t *cr, 141 PangoLayout *layout); 142 143 void pango_cairo_show_error_underline (cairo_t *cr, 144 double x, 145 double y, 146 double width, 147 double height); 148 149 /* 150 * Rendering to a path 151 */ 152 void pango_cairo_glyph_string_path (cairo_t *cr, 153 PangoFont *font, 154 PangoGlyphString *glyphs); 155 void pango_cairo_layout_line_path (cairo_t *cr, 156 PangoLayoutLine *line); 157 void pango_cairo_layout_path (cairo_t *cr, 158 PangoLayout *layout); 159 160 void pango_cairo_error_underline_path (cairo_t *cr, 161 double x, 162 double y, 163 double width, 164 double height); 165