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-cairo-font-face-t.html 27 * outPack = cairo 28 * outFile = FontFace 29 * strct = cairo_font_face_t 30 * realStrct= 31 * ctorStrct= 32 * clss = FontFace 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - cairo_font_face_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * structWrap: 47 * - cairo_font_face_t* -> FontFace 48 * module aliases: 49 * local aliases: 50 * overrides: 51 */ 52 53 module cairo.FontFace; 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 * cairo_font_face_t represents a particular font at a particular weight, 65 * slant, and other characteristic but no size, transformation, or size. 66 * 67 * Font faces are created using font-backend-specific 68 * constructors, typically of the form 69 * cairo_backend_font_face_create(), 70 * or implicitly using the toy text API by way of 71 * cairo_select_font_face(). The resulting face can be accessed using 72 * cairo_get_font_face(). 73 */ 74 public class FontFace 75 { 76 77 /** the main Gtk struct */ 78 protected cairo_font_face_t* cairo_font_face; 79 80 81 /** Get the main Gtk struct */ 82 public cairo_font_face_t* getFontFaceStruct() 83 { 84 return cairo_font_face; 85 } 86 87 88 /** the main Gtk struct as a void* */ 89 protected void* getStruct() 90 { 91 return cast(void*)cairo_font_face; 92 } 93 94 /** 95 * Sets our main struct and passes it to the parent class 96 */ 97 public this (cairo_font_face_t* cairo_font_face) 98 { 99 this.cairo_font_face = cairo_font_face; 100 } 101 102 /** 103 */ 104 105 /** 106 * Increases the reference count on font_face by one. This prevents 107 * font_face from being destroyed until a matching call to 108 * cairo_font_face_destroy() is made. 109 * The number of references to a cairo_font_face_t can be get using 110 * cairo_font_face_get_reference_count(). 111 * Since 1.0 112 * Returns: the referenced cairo_font_face_t. 113 */ 114 public FontFace reference() 115 { 116 // cairo_font_face_t * cairo_font_face_reference (cairo_font_face_t *font_face); 117 auto p = cairo_font_face_reference(cairo_font_face); 118 119 if(p is null) 120 { 121 return null; 122 } 123 124 return new FontFace(cast(cairo_font_face_t*) p); 125 } 126 127 /** 128 * Decreases the reference count on font_face by one. If the result 129 * is zero, then font_face and all associated resources are freed. 130 * See cairo_font_face_reference(). 131 * Since 1.0 132 */ 133 public void destroy() 134 { 135 // void cairo_font_face_destroy (cairo_font_face_t *font_face); 136 cairo_font_face_destroy(cairo_font_face); 137 } 138 139 /** 140 * Checks whether an error has previously occurred for this 141 * font face 142 * Since 1.0 143 * Returns: CAIRO_STATUS_SUCCESS or another error such as CAIRO_STATUS_NO_MEMORY. 144 */ 145 public cairo_status_t status() 146 { 147 // cairo_status_t cairo_font_face_status (cairo_font_face_t *font_face); 148 return cairo_font_face_status(cairo_font_face); 149 } 150 151 /** 152 * This function returns the type of the backend used to create 153 * a font face. See cairo_font_type_t for available types. 154 * Since 1.2 155 * Returns: The type of font_face. 156 */ 157 public cairo_font_type_t getType() 158 { 159 // cairo_font_type_t cairo_font_face_get_type (cairo_font_face_t *font_face); 160 return cairo_font_face_get_type(cairo_font_face); 161 } 162 163 /** 164 * Returns the current reference count of font_face. 165 * Since 1.4 166 * Returns: the current reference count of font_face. If the object is a nil object, 0 will be returned. 167 */ 168 public uint getReferenceCount() 169 { 170 // unsigned int cairo_font_face_get_reference_count (cairo_font_face_t *font_face); 171 return cairo_font_face_get_reference_count(cairo_font_face); 172 } 173 174 /** 175 * Attach user data to font_face. To remove user data from a font face, 176 * call this function with the key that was used to set it and NULL 177 * for data. 178 * Since 1.0 179 * Params: 180 * key = the address of a cairo_user_data_key_t to attach the user data to 181 * userData = the user data to attach to the font face 182 * destroy = a cairo_destroy_func_t which will be called when the 183 * font face is destroyed or when new user data is attached using the 184 * same key. 185 * Returns: CAIRO_STATUS_SUCCESS or CAIRO_STATUS_NO_MEMORY if a slot could not be allocated for the user data. 186 */ 187 public cairo_status_t setUserData(cairo_user_data_key_t* key, void* userData, cairo_destroy_func_t destroy) 188 { 189 // cairo_status_t cairo_font_face_set_user_data (cairo_font_face_t *font_face, const cairo_user_data_key_t *key, void *user_data, cairo_destroy_func_t destroy); 190 return cairo_font_face_set_user_data(cairo_font_face, key, userData, destroy); 191 } 192 193 /** 194 * Return user data previously attached to font_face using the specified 195 * key. If no user data has been attached with the given key this 196 * function returns NULL. 197 * Since 1.0 198 * Params: 199 * key = the address of the cairo_user_data_key_t the user data was 200 * attached to 201 * Returns: the user data previously attached or NULL. 202 */ 203 public void* getUserData(cairo_user_data_key_t* key) 204 { 205 // void * cairo_font_face_get_user_data (cairo_font_face_t *font_face, const cairo_user_data_key_t *key); 206 return cairo_font_face_get_user_data(cairo_font_face, key); 207 } 208 }