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 * Description 67 * cairo_font_face_t represents a particular font at a particular weight, 68 * slant, and other characteristic but no size, transformation, or size. 69 * Font faces are created using font-backend-specific 70 * constructors, typically of the form 71 * cairo_backend_font_face_create(), or implicitly 72 * 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 * 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 */ 132 public void destroy() 133 { 134 // void cairo_font_face_destroy (cairo_font_face_t *font_face); 135 cairo_font_face_destroy(cairo_font_face); 136 } 137 138 /** 139 * Checks whether an error has previously occurred for this 140 * font face 141 * Returns: CAIRO_STATUS_SUCCESS or another error such as CAIRO_STATUS_NO_MEMORY. 142 */ 143 public cairo_status_t status() 144 { 145 // cairo_status_t cairo_font_face_status (cairo_font_face_t *font_face); 146 return cairo_font_face_status(cairo_font_face); 147 } 148 149 /** 150 * This function returns the type of the backend used to create 151 * a font face. See cairo_font_type_t for available types. 152 * Since 1.2 153 * Returns: The type of font_face. 154 */ 155 public cairo_font_type_t getType() 156 { 157 // cairo_font_type_t cairo_font_face_get_type (cairo_font_face_t *font_face); 158 return cairo_font_face_get_type(cairo_font_face); 159 } 160 161 /** 162 * Returns the current reference count of font_face. 163 * Since 1.4 164 * Returns: the current reference count of font_face. If the object is a nil object, 0 will be returned. 165 */ 166 public uint getReferenceCount() 167 { 168 // unsigned int cairo_font_face_get_reference_count (cairo_font_face_t *font_face); 169 return cairo_font_face_get_reference_count(cairo_font_face); 170 } 171 172 /** 173 * Attach user data to font_face. To remove user data from a font face, 174 * call this function with the key that was used to set it and NULL 175 * for data. 176 * Params: 177 * key = the address of a cairo_user_data_key_t to attach the user data to 178 * userData = the user data to attach to the font face 179 * destroy = a cairo_destroy_func_t which will be called when the 180 * font face is destroyed or when new user data is attached using the 181 * same key. 182 * Returns: CAIRO_STATUS_SUCCESS or CAIRO_STATUS_NO_MEMORY if a slot could not be allocated for the user data. 183 */ 184 public cairo_status_t setUserData(cairo_user_data_key_t* key, void* userData, cairo_destroy_func_t destroy) 185 { 186 // 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); 187 return cairo_font_face_set_user_data(cairo_font_face, key, userData, destroy); 188 } 189 190 /** 191 * Return user data previously attached to font_face using the specified 192 * key. If no user data has been attached with the given key this 193 * function returns NULL. 194 * Params: 195 * key = the address of the cairo_user_data_key_t the user data was 196 * attached to 197 * Returns: the user data previously attached or NULL. 198 */ 199 public void* getUserData(cairo_user_data_key_t* key) 200 { 201 // void * cairo_font_face_get_user_data (cairo_font_face_t *font_face, const cairo_user_data_key_t *key); 202 return cairo_font_face_get_user_data(cairo_font_face, key); 203 } 204 }