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