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 gtkc.cairotypes; 56 57 private import gtkc.cairo; 58 private import glib.ConstructionException; 59 60 61 62 63 64 65 /** 66 * The user-font feature allows the cairo user to provide drawings for glyphs 67 * in a font. This is most useful in implementing fonts in non-standard 68 * formats, like SVG fonts and Flash fonts, but can also be used by games and 69 * other application to draw "funky" fonts. 70 */ 71 public class UserFontFace 72 { 73 74 /** the main Gtk struct */ 75 protected cairo_font_face_t* cairo_font_face; 76 77 78 public cairo_font_face_t* getUserFontFaceStruct() 79 { 80 return cairo_font_face; 81 } 82 83 84 /** the main Gtk struct as a void* */ 85 protected void* getStruct() 86 { 87 return cast(void*)cairo_font_face; 88 } 89 90 /** 91 * Sets our main struct and passes it to the parent class 92 */ 93 public this (cairo_font_face_t* cairo_font_face) 94 { 95 this.cairo_font_face = cairo_font_face; 96 } 97 98 /** 99 */ 100 101 /** 102 * Creates a new user font-face. 103 * Use the setter functions to associate callbacks with the returned 104 * user font. The only mandatory callback is render_glyph. 105 * After the font-face is created, the user can attach arbitrary data 106 * (the actual font data) to it using cairo_font_face_set_user_data() 107 * and access it from the user-font callbacks by using 108 * cairo_scaled_font_get_font_face() followed by 109 * cairo_font_face_get_user_data(). 110 * Since 1.8 111 * Returns: a newly created cairo_font_face_t. Free with cairo_font_face_destroy() when you are done using it. 112 */ 113 public static UserFontFace create() 114 { 115 // cairo_font_face_t * cairo_user_font_face_create (void); 116 auto p = cairo_user_font_face_create(); 117 118 if(p is null) 119 { 120 return null; 121 } 122 123 return new UserFontFace(cast(cairo_font_face_t*) p); 124 } 125 126 /** 127 * Sets the scaled-font initialization function of a user-font. 128 * See cairo_user_scaled_font_init_func_t for details of how the callback 129 * works. 130 * The font-face should not be immutable or a CAIRO_STATUS_USER_FONT_IMMUTABLE 131 * error will occur. A user font-face is immutable as soon as a scaled-font 132 * is created from it. 133 * Since 1.8 134 * Params: 135 * initFunc = The init callback, or NULL 136 */ 137 public void setInitFunc(cairo_user_scaled_font_init_func_t initFunc) 138 { 139 // void cairo_user_font_face_set_init_func (cairo_font_face_t *font_face, cairo_user_scaled_font_init_func_t init_func); 140 cairo_user_font_face_set_init_func(cairo_font_face, initFunc); 141 } 142 143 /** 144 * Gets the scaled-font initialization function of a user-font. 145 * Since 1.8 146 * Returns: The init callback of font_face or NULL if none set or an error has occurred. 147 */ 148 public cairo_user_scaled_font_init_func_t getInitFunc() 149 { 150 // cairo_user_scaled_font_init_func_t cairo_user_font_face_get_init_func (cairo_font_face_t *font_face); 151 return cairo_user_font_face_get_init_func(cairo_font_face); 152 } 153 154 /** 155 * Sets the glyph rendering function of a user-font. 156 * See cairo_user_scaled_font_render_glyph_func_t for details of how the callback 157 * works. 158 * The font-face should not be immutable or a CAIRO_STATUS_USER_FONT_IMMUTABLE 159 * error will occur. A user font-face is immutable as soon as a scaled-font 160 * is created from it. 161 * The render_glyph callback is the only mandatory callback of a user-font. 162 * If the callback is NULL and a glyph is tried to be rendered using 163 * font_face, a CAIRO_STATUS_USER_FONT_ERROR will occur. 164 * Since 1.8 165 * Params: 166 * renderGlyphFunc = The render_glyph callback, or NULL 167 */ 168 public void setRenderGlyphFunc(cairo_user_scaled_font_render_glyph_func_t renderGlyphFunc) 169 { 170 // 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); 171 cairo_user_font_face_set_render_glyph_func(cairo_font_face, renderGlyphFunc); 172 } 173 174 /** 175 * Gets the glyph rendering function of a user-font. 176 * Since 1.8 177 * Returns: The render_glyph callback of font_face or NULL if none set or an error has occurred. 178 */ 179 public cairo_user_scaled_font_render_glyph_func_t getRenderGlyphFunc() 180 { 181 // cairo_user_scaled_font_render_glyph_func_t cairo_user_font_face_get_render_glyph_func (cairo_font_face_t *font_face); 182 return cairo_user_font_face_get_render_glyph_func(cairo_font_face); 183 } 184 185 /** 186 * Sets the unicode-to-glyph conversion function of a user-font. 187 * See cairo_user_scaled_font_unicode_to_glyph_func_t for details of how the callback 188 * works. 189 * The font-face should not be immutable or a CAIRO_STATUS_USER_FONT_IMMUTABLE 190 * error will occur. A user font-face is immutable as soon as a scaled-font 191 * is created from it. 192 * Since 1.8 193 * Params: 194 * unicodeToGlyphFunc = The unicode_to_glyph callback, or NULL 195 */ 196 public void setUnicodeToGlyphFunc(cairo_user_scaled_font_unicode_to_glyph_func_t unicodeToGlyphFunc) 197 { 198 // 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); 199 cairo_user_font_face_set_unicode_to_glyph_func(cairo_font_face, unicodeToGlyphFunc); 200 } 201 202 /** 203 * Gets the unicode-to-glyph conversion function of a user-font. 204 * Since 1.8 205 * Returns: The unicode_to_glyph callback of font_face or NULL if none set or an error occurred. 206 */ 207 public cairo_user_scaled_font_unicode_to_glyph_func_t getUnicodeToGlyphFunc() 208 { 209 // cairo_user_scaled_font_unicode_to_glyph_func_t cairo_user_font_face_get_unicode_to_glyph_func (cairo_font_face_t *font_face); 210 return cairo_user_font_face_get_unicode_to_glyph_func(cairo_font_face); 211 } 212 213 /** 214 * Sets th text-to-glyphs conversion function of a user-font. 215 * See cairo_user_scaled_font_text_to_glyphs_func_t for details of how the callback 216 * works. 217 * The font-face should not be immutable or a CAIRO_STATUS_USER_FONT_IMMUTABLE 218 * error will occur. A user font-face is immutable as soon as a scaled-font 219 * is created from it. 220 * Since 1.8 221 * Params: 222 * textToGlyphsFunc = The text_to_glyphs callback, or NULL 223 */ 224 public void setTextToGlyphsFunc(cairo_user_scaled_font_text_to_glyphs_func_t textToGlyphsFunc) 225 { 226 // 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); 227 cairo_user_font_face_set_text_to_glyphs_func(cairo_font_face, textToGlyphsFunc); 228 } 229 230 /** 231 * Gets the text-to-glyphs conversion function of a user-font. 232 * Since 1.8 233 * Returns: The text_to_glyphs callback of font_face or NULL if none set or an error occurred. 234 */ 235 public cairo_user_scaled_font_text_to_glyphs_func_t getTextToGlyphsFunc() 236 { 237 // cairo_user_scaled_font_text_to_glyphs_func_t cairo_user_font_face_get_text_to_glyphs_func (cairo_font_face_t *font_face); 238 return cairo_user_font_face_get_text_to_glyphs_func(cairo_font_face); 239 } 240 }