1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 /* 25 * Conversion parameters: 26 * inFile = cairo-User-Fonts.html 27 * outPack = cairo 28 * outFile = UserFontFace 29 * strct = cairo_font_face_t 30 * realStrct= 31 * ctorStrct= 32 * clss = UserFontFace 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - cairo_user_font_face_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * structWrap: 47 * - cairo_font_face_t* -> UserFontFace 48 * module aliases: 49 * local aliases: 50 * overrides: 51 */ 52 53 module cairo.UserFontFace; 54 55 public import cairo.c.types; 56 57 private import cairo.c.functions; 58 private import glib.ConstructionException; 59 60 61 62 63 /** 64 * The user-font feature allows the cairo user to provide drawings for glyphs 65 * in a font. This is most useful in implementing fonts in non-standard 66 * formats, like SVG fonts and Flash fonts, but can also be used by games and 67 * other application to draw "funky" fonts. 68 */ 69 public class UserFontFace 70 { 71 72 /** the main Gtk struct */ 73 protected cairo_font_face_t* cairo_font_face; 74 75 76 /** Get the main Gtk struct */ 77 public cairo_font_face_t* getUserFontFaceStruct() 78 { 79 return cairo_font_face; 80 } 81 82 83 /** the main Gtk struct as a void* */ 84 protected void* getStruct() 85 { 86 return cast(void*)cairo_font_face; 87 } 88 89 /** 90 * Sets our main struct and passes it to the parent class 91 */ 92 public this (cairo_font_face_t* cairo_font_face) 93 { 94 this.cairo_font_face = cairo_font_face; 95 } 96 97 /** 98 */ 99 100 /** 101 * Creates a new user font-face. 102 * Use the setter functions to associate callbacks with the returned 103 * user font. The only mandatory callback is render_glyph. 104 * After the font-face is created, the user can attach arbitrary data 105 * (the actual font data) to it using cairo_font_face_set_user_data() 106 * and access it from the user-font callbacks by using 107 * cairo_scaled_font_get_font_face() followed by 108 * cairo_font_face_get_user_data(). 109 * Since 1.8 110 * Returns: a newly created cairo_font_face_t. Free with cairo_font_face_destroy() when you are done using it. 111 */ 112 public static UserFontFace create() 113 { 114 // cairo_font_face_t * cairo_user_font_face_create (void); 115 auto p = cairo_user_font_face_create(); 116 117 if(p is null) 118 { 119 return null; 120 } 121 122 return new UserFontFace(cast(cairo_font_face_t*) p); 123 } 124 125 /** 126 * Sets the scaled-font initialization function of a user-font. 127 * See cairo_user_scaled_font_init_func_t for details of how the callback 128 * works. 129 * The font-face should not be immutable or a CAIRO_STATUS_USER_FONT_IMMUTABLE 130 * error will occur. A user font-face is immutable as soon as a scaled-font 131 * is created from it. 132 * Since 1.8 133 * Params: 134 * initFunc = The init callback, or NULL 135 */ 136 public void setInitFunc(cairo_user_scaled_font_init_func_t initFunc) 137 { 138 // void cairo_user_font_face_set_init_func (cairo_font_face_t *font_face, cairo_user_scaled_font_init_func_t init_func); 139 cairo_user_font_face_set_init_func(cairo_font_face, initFunc); 140 } 141 142 /** 143 * Gets the scaled-font initialization function of a user-font. 144 * Since 1.8 145 * Returns: The init callback of font_face or NULL if none set or an error has occurred. 146 */ 147 public cairo_user_scaled_font_init_func_t getInitFunc() 148 { 149 // cairo_user_scaled_font_init_func_t cairo_user_font_face_get_init_func (cairo_font_face_t *font_face); 150 return cairo_user_font_face_get_init_func(cairo_font_face); 151 } 152 153 /** 154 * Sets the glyph rendering function of a user-font. 155 * See cairo_user_scaled_font_render_glyph_func_t for details of how the callback 156 * works. 157 * The font-face should not be immutable or a CAIRO_STATUS_USER_FONT_IMMUTABLE 158 * error will occur. A user font-face is immutable as soon as a scaled-font 159 * is created from it. 160 * The render_glyph callback is the only mandatory callback of a user-font. 161 * If the callback is NULL and a glyph is tried to be rendered using 162 * font_face, a CAIRO_STATUS_USER_FONT_ERROR will occur. 163 * Since 1.8 164 * Params: 165 * renderGlyphFunc = The render_glyph callback, or NULL 166 */ 167 public void setRenderGlyphFunc(cairo_user_scaled_font_render_glyph_func_t renderGlyphFunc) 168 { 169 // void cairo_user_font_face_set_render_glyph_func (cairo_font_face_t *font_face, cairo_user_scaled_font_render_glyph_func_t render_glyph_func); 170 cairo_user_font_face_set_render_glyph_func(cairo_font_face, renderGlyphFunc); 171 } 172 173 /** 174 * Gets the glyph rendering function of a user-font. 175 * Since 1.8 176 * Returns: The render_glyph callback of font_face or NULL if none set or an error has occurred. 177 */ 178 public cairo_user_scaled_font_render_glyph_func_t getRenderGlyphFunc() 179 { 180 // cairo_user_scaled_font_render_glyph_func_t cairo_user_font_face_get_render_glyph_func (cairo_font_face_t *font_face); 181 return cairo_user_font_face_get_render_glyph_func(cairo_font_face); 182 } 183 184 /** 185 * Sets the unicode-to-glyph conversion function of a user-font. 186 * See cairo_user_scaled_font_unicode_to_glyph_func_t for details of how the callback 187 * works. 188 * The font-face should not be immutable or a CAIRO_STATUS_USER_FONT_IMMUTABLE 189 * error will occur. A user font-face is immutable as soon as a scaled-font 190 * is created from it. 191 * Since 1.8 192 * Params: 193 * unicodeToGlyphFunc = The unicode_to_glyph callback, or NULL 194 */ 195 public void setUnicodeToGlyphFunc(cairo_user_scaled_font_unicode_to_glyph_func_t unicodeToGlyphFunc) 196 { 197 // void cairo_user_font_face_set_unicode_to_glyph_func (cairo_font_face_t *font_face, cairo_user_scaled_font_unicode_to_glyph_func_t unicode_to_glyph_func); 198 cairo_user_font_face_set_unicode_to_glyph_func(cairo_font_face, unicodeToGlyphFunc); 199 } 200 201 /** 202 * Gets the unicode-to-glyph conversion function of a user-font. 203 * Since 1.8 204 * Returns: The unicode_to_glyph callback of font_face or NULL if none set or an error occurred. 205 */ 206 public cairo_user_scaled_font_unicode_to_glyph_func_t getUnicodeToGlyphFunc() 207 { 208 // cairo_user_scaled_font_unicode_to_glyph_func_t cairo_user_font_face_get_unicode_to_glyph_func (cairo_font_face_t *font_face); 209 return cairo_user_font_face_get_unicode_to_glyph_func(cairo_font_face); 210 } 211 212 /** 213 * Sets th text-to-glyphs conversion function of a user-font. 214 * See cairo_user_scaled_font_text_to_glyphs_func_t for details of how the callback 215 * works. 216 * The font-face should not be immutable or a CAIRO_STATUS_USER_FONT_IMMUTABLE 217 * error will occur. A user font-face is immutable as soon as a scaled-font 218 * is created from it. 219 * Since 1.8 220 * Params: 221 * textToGlyphsFunc = The text_to_glyphs callback, or NULL 222 */ 223 public void setTextToGlyphsFunc(cairo_user_scaled_font_text_to_glyphs_func_t textToGlyphsFunc) 224 { 225 // void cairo_user_font_face_set_text_to_glyphs_func (cairo_font_face_t *font_face, cairo_user_scaled_font_text_to_glyphs_func_t text_to_glyphs_func); 226 cairo_user_font_face_set_text_to_glyphs_func(cairo_font_face, textToGlyphsFunc); 227 } 228 229 /** 230 * Gets the text-to-glyphs conversion function of a user-font. 231 * Since 1.8 232 * Returns: The text_to_glyphs callback of font_face or NULL if none set or an error occurred. 233 */ 234 public cairo_user_scaled_font_text_to_glyphs_func_t getTextToGlyphsFunc() 235 { 236 // cairo_user_scaled_font_text_to_glyphs_func_t cairo_user_font_face_get_text_to_glyphs_func (cairo_font_face_t *font_face); 237 return cairo_user_font_face_get_text_to_glyphs_func(cairo_font_face); 238 } 239 }