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 = 27 * outPack = pango 28 * outFile = PgFontFace 29 * strct = PangoFontFace 30 * realStrct= 31 * ctorStrct= 32 * clss = PgFontFace 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = GObject 38 * implements: 39 * prefixes: 40 * - pango_font_face_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * - pango.PgFontDescription 48 * structWrap: 49 * - PangoFontDescription* -> PgFontDescription 50 * module aliases: 51 * local aliases: 52 * overrides: 53 */ 54 55 module pango.PgFontFace; 56 57 public import gtkc.pangotypes; 58 59 private import gtkc.pango; 60 private import glib.ConstructionException; 61 private import gobject.ObjectG; 62 63 private import glib.Str; 64 private import pango.PgFontDescription; 65 66 67 private import gobject.ObjectG; 68 69 /** 70 * Pango supports a flexible architecture where a 71 * particular rendering architecture can supply an 72 * implementation of fonts. The PangoFont structure 73 * represents an abstract rendering-system-independent font. 74 * Pango provides routines to list available fonts, and 75 * to load a font of a given description. 76 */ 77 public class PgFontFace : ObjectG 78 { 79 80 /** the main Gtk struct */ 81 protected PangoFontFace* pangoFontFace; 82 83 84 /** Get the main Gtk struct */ 85 public PangoFontFace* getPgFontFaceStruct() 86 { 87 return pangoFontFace; 88 } 89 90 91 /** the main Gtk struct as a void* */ 92 protected override void* getStruct() 93 { 94 return cast(void*)pangoFontFace; 95 } 96 97 /** 98 * Sets our main struct and passes it to the parent class 99 */ 100 public this (PangoFontFace* pangoFontFace) 101 { 102 super(cast(GObject*)pangoFontFace); 103 this.pangoFontFace = pangoFontFace; 104 } 105 106 protected override void setStruct(GObject* obj) 107 { 108 super.setStruct(obj); 109 pangoFontFace = cast(PangoFontFace*)obj; 110 } 111 112 /** 113 */ 114 115 /** 116 * Gets a name representing the style of this face among the 117 * different faces in the PangoFontFamily for the face. This 118 * name is unique among all faces in the family and is suitable 119 * for displaying to users. 120 * Returns: the face name for the face. This string is owned by the face object and must not be modified or freed. 121 */ 122 public string getFaceName() 123 { 124 // const char * pango_font_face_get_face_name (PangoFontFace *face); 125 return Str.toString(pango_font_face_get_face_name(pangoFontFace)); 126 } 127 128 /** 129 * List the available sizes for a font. This is only applicable to bitmap 130 * fonts. For scalable fonts, stores NULL at the location pointed to by 131 * sizes and 0 at the location pointed to by n_sizes. The sizes returned 132 * are in Pango units and are sorted in ascending order. 133 * Since 1.4 134 * Params: 135 * sizes = location to store a pointer 136 * to an array of int. This array should be freed with 137 * g_free(). [out][array length=n_sizes] 138 */ 139 public void listSizes(out int[] sizes) 140 { 141 // void pango_font_face_list_sizes (PangoFontFace *face, int **sizes, int *n_sizes); 142 int* outsizes = null; 143 int nSizes; 144 145 pango_font_face_list_sizes(pangoFontFace, &outsizes, &nSizes); 146 147 sizes = outsizes[0 .. nSizes]; 148 } 149 150 /** 151 * Returns the family, style, variant, weight and stretch of 152 * a PangoFontFace. The size field of the resulting font description 153 * will be unset. 154 * Returns: a newly-created PangoFontDescription structure holding the description of the face. Use pango_font_description_free() to free the result. 155 */ 156 public PgFontDescription describe() 157 { 158 // PangoFontDescription * pango_font_face_describe (PangoFontFace *face); 159 auto p = pango_font_face_describe(pangoFontFace); 160 161 if(p is null) 162 { 163 return null; 164 } 165 166 return ObjectG.getDObject!(PgFontDescription)(cast(PangoFontDescription*) p); 167 } 168 169 /** 170 * Returns whether a PangoFontFace is synthesized by the underlying 171 * font rendering engine from another face, perhaps by shearing, emboldening, 172 * or lightening it. 173 * Since 1.18 174 * Returns: whether face is synthesized. 175 */ 176 public int isSynthesized() 177 { 178 // gboolean pango_font_face_is_synthesized (PangoFontFace *face); 179 return pango_font_face_is_synthesized(pangoFontFace); 180 } 181 }