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 = PgFontMetrics 29 * strct = PangoFontMetrics 30 * realStrct= 31 * ctorStrct= 32 * clss = PgFontMetrics 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - pango_font_metrics_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * structWrap: 47 * - PangoFontMetrics* -> PgFontMetrics 48 * module aliases: 49 * local aliases: 50 * overrides: 51 */ 52 53 module pango.PgFontMetrics; 54 55 public import gtkc.pangotypes; 56 57 private import gtkc.pango; 58 private import glib.ConstructionException; 59 private import gobject.ObjectG; 60 61 62 63 64 /** 65 * Pango supports a flexible architecture where a 66 * particular rendering architecture can supply an 67 * implementation of fonts. The PangoFont structure 68 * represents an abstract rendering-system-independent font. 69 * Pango provides routines to list available fonts, and 70 * to load a font of a given description. 71 */ 72 public class PgFontMetrics 73 { 74 75 /** the main Gtk struct */ 76 protected PangoFontMetrics* pangoFontMetrics; 77 78 79 /** Get the main Gtk struct */ 80 public PangoFontMetrics* getPgFontMetricsStruct() 81 { 82 return pangoFontMetrics; 83 } 84 85 86 /** the main Gtk struct as a void* */ 87 protected void* getStruct() 88 { 89 return cast(void*)pangoFontMetrics; 90 } 91 92 /** 93 * Sets our main struct and passes it to the parent class 94 */ 95 public this (PangoFontMetrics* pangoFontMetrics) 96 { 97 this.pangoFontMetrics = pangoFontMetrics; 98 } 99 100 /** 101 */ 102 103 /** 104 * Increase the reference count of a font metrics structure by one. 105 * Returns: metrics 106 */ 107 public PgFontMetrics doref() 108 { 109 // PangoFontMetrics * pango_font_metrics_ref (PangoFontMetrics *metrics); 110 auto p = pango_font_metrics_ref(pangoFontMetrics); 111 112 if(p is null) 113 { 114 return null; 115 } 116 117 return ObjectG.getDObject!(PgFontMetrics)(cast(PangoFontMetrics*) p); 118 } 119 120 /** 121 * Decrease the reference count of a font metrics structure by one. If 122 * the result is zero, frees the structure and any associated 123 * memory. 124 */ 125 public void unref() 126 { 127 // void pango_font_metrics_unref (PangoFontMetrics *metrics); 128 pango_font_metrics_unref(pangoFontMetrics); 129 } 130 131 /** 132 * Gets the ascent from a font metrics structure. The ascent is 133 * the distance from the baseline to the logical top of a line 134 * of text. (The logical top may be above or below the top of the 135 * actual drawn ink. It is necessary to lay out the text to figure 136 * where the ink will be.) 137 * Returns: the ascent, in Pango units. 138 */ 139 public int getAscent() 140 { 141 // int pango_font_metrics_get_ascent (PangoFontMetrics *metrics); 142 return pango_font_metrics_get_ascent(pangoFontMetrics); 143 } 144 145 /** 146 * Gets the descent from a font metrics structure. The descent is 147 * the distance from the baseline to the logical bottom of a line 148 * of text. (The logical bottom may be above or below the bottom of the 149 * actual drawn ink. It is necessary to lay out the text to figure 150 * where the ink will be.) 151 * Returns: the descent, in Pango units. 152 */ 153 public int getDescent() 154 { 155 // int pango_font_metrics_get_descent (PangoFontMetrics *metrics); 156 return pango_font_metrics_get_descent(pangoFontMetrics); 157 } 158 159 /** 160 * Gets the approximate character width for a font metrics structure. 161 * This is merely a representative value useful, for example, for 162 * determining the initial size for a window. Actual characters in 163 * text will be wider and narrower than this. 164 * Returns: the character width, in Pango units. 165 */ 166 public int getApproximateCharWidth() 167 { 168 // int pango_font_metrics_get_approximate_char_width (PangoFontMetrics *metrics); 169 return pango_font_metrics_get_approximate_char_width(pangoFontMetrics); 170 } 171 172 /** 173 * Gets the approximate digit width for a font metrics structure. 174 * This is merely a representative value useful, for example, for 175 * determining the initial size for a window. Actual digits in 176 * text can be wider or narrower than this, though this value 177 * is generally somewhat more accurate than the result of 178 * pango_font_metrics_get_approximate_char_width() for digits. 179 * Returns: the digit width, in Pango units. 180 */ 181 public int getApproximateDigitWidth() 182 { 183 // int pango_font_metrics_get_approximate_digit_width (PangoFontMetrics *metrics); 184 return pango_font_metrics_get_approximate_digit_width(pangoFontMetrics); 185 } 186 187 /** 188 * Gets the suggested thickness to draw for the underline. 189 * Since 1.6 190 * Returns: the suggested underline thickness, in Pango units. 191 */ 192 public int getUnderlineThickness() 193 { 194 // int pango_font_metrics_get_underline_thickness (PangoFontMetrics *metrics); 195 return pango_font_metrics_get_underline_thickness(pangoFontMetrics); 196 } 197 198 /** 199 * Gets the suggested position to draw the underline. 200 * The value returned is the distance above the 201 * baseline of the top of the underline. Since most fonts have 202 * underline positions beneath the baseline, this value is typically 203 * negative. 204 * Since 1.6 205 * Returns: the suggested underline position, in Pango units. 206 */ 207 public int getUnderlinePosition() 208 { 209 // int pango_font_metrics_get_underline_position (PangoFontMetrics *metrics); 210 return pango_font_metrics_get_underline_position(pangoFontMetrics); 211 } 212 213 /** 214 * Gets the suggested thickness to draw for the strikethrough. 215 * Since 1.6 216 * Returns: the suggested strikethrough thickness, in Pango units. 217 */ 218 public int getStrikethroughThickness() 219 { 220 // int pango_font_metrics_get_strikethrough_thickness (PangoFontMetrics *metrics); 221 return pango_font_metrics_get_strikethrough_thickness(pangoFontMetrics); 222 } 223 224 /** 225 * Gets the suggested position to draw the strikethrough. 226 * The value returned is the distance above the 227 * baseline of the top of the strikethrough. 228 * Since 1.6 229 * Returns: the suggested strikethrough position, in Pango units. 230 */ 231 public int getStrikethroughPosition() 232 { 233 // int pango_font_metrics_get_strikethrough_position (PangoFontMetrics *metrics); 234 return pango_font_metrics_get_strikethrough_position(pangoFontMetrics); 235 } 236 }