alternative to assert
[gtkD.git] / gtkD / src / pango / PgFontMetrics.d
blob028deeac602f2beb0560fff02248d7d9cd10af74
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile =
26 * outPack = pango
27 * outFile = PgFontMetrics
28 * strct = PangoFontMetrics
29 * realStrct=
30 * ctorStrct=
31 * clss = PgFontMetrics
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - pango_font_metrics_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - pango.PgContext
45 * - pango.PgItem
46 * - pango.PgLayout
47 * - pango.PgFontDescription
48 * - pango.PgFontFamily
49 * - pango.PgFontFace
50 * - pango.PgFontMap
51 * - pango.PgFontsetSimple
52 * - pango.PgAttribute
53 * - pango.PgAttributeList
54 * - pango.PgLanguage
55 * - pango.PgTabArray
56 * - pango.PgLayout
57 * - pango.PgLayoutIter
58 * - pango.PgScriptIter
59 * structWrap:
60 * - PangoAttribute* -> PgAttribute
61 * - PangoAttributeList* -> PgAttributeList
62 * - PangoContext* -> PgContext
63 * - PangoFontDescription* -> PgFontDescription
64 * - PangoFontFace* -> PgFontFace
65 * - PangoFontFamily* -> PgFontFamily
66 * - PangoFontMap* -> PgFontMap
67 * - PangoFontsetSimple* -> PgFontsetSimple
68 * - PangoItem* -> PgItem
69 * - PangoLanguage* -> PgLanguage
70 * - PangoLayout* -> PgLayout
71 * - PangoLayoutIter* -> PgLayoutIter
72 * - PangoScriptIter* -> PgScriptIter
73 * - PangoTabArray* -> PgTabArray
74 * module aliases:
75 * local aliases:
78 module pango.PgFontMetrics;
80 version(noAssert)
82 version(Tango)
84 import tango.io.Stdout; // use the tango loging?
88 private import gtkc.pangotypes;
90 private import gtkc.pango;
93 private import pango.PgContext;
94 private import pango.PgItem;
95 private import pango.PgLayout;
96 private import pango.PgFontDescription;
97 private import pango.PgFontFamily;
98 private import pango.PgFontFace;
99 private import pango.PgFontMap;
100 private import pango.PgFontsetSimple;
101 private import pango.PgAttribute;
102 private import pango.PgAttributeList;
103 private import pango.PgLanguage;
104 private import pango.PgTabArray;
105 private import pango.PgLayout;
106 private import pango.PgLayoutIter;
107 private import pango.PgScriptIter;
113 * Description
114 * Pango supports a flexible architecture where a
115 * particular rendering architecture can supply an
116 * implementation of fonts. The PangoFont structure
117 * represents an abstract rendering-system-independent font.
118 * Pango provides routines to list available fonts, and
119 * to load a font of a given description.
121 public class PgFontMetrics
124 /** the main Gtk struct */
125 protected PangoFontMetrics* pangoFontMetrics;
128 public PangoFontMetrics* getPgFontMetricsStruct()
130 return pangoFontMetrics;
134 /** the main Gtk struct as a void* */
135 protected void* getStruct()
137 return cast(void*)pangoFontMetrics;
141 * Sets our main struct and passes it to the parent class
143 public this (PangoFontMetrics* pangoFontMetrics)
145 version(noAssert)
147 if ( pangoFontMetrics is null )
149 int zero = 0;
150 version(Tango)
152 Stdout("struct pangoFontMetrics is null on constructor").newline;
154 else
156 printf("struct pangoFontMetrics is null on constructor");
158 zero = zero / zero;
161 else
163 assert(pangoFontMetrics !is null, "struct pangoFontMetrics is null on constructor");
165 this.pangoFontMetrics = pangoFontMetrics;
218 * Increase the reference count of a font metrics structure by one.
219 * metrics:
220 * a PangoFontMetrics structure
221 * Returns:
222 * metrics
224 public PangoFontMetrics* doref()
226 // PangoFontMetrics* pango_font_metrics_ref (PangoFontMetrics *metrics);
227 return pango_font_metrics_ref(pangoFontMetrics);
231 * Decrease the reference count of a font metrics structure by one. If
232 * the result is zero, frees the structure and any associated
233 * memory.
234 * metrics:
235 * a PangoFontMetrics structure
237 public void unref()
239 // void pango_font_metrics_unref (PangoFontMetrics *metrics);
240 pango_font_metrics_unref(pangoFontMetrics);
244 * Gets the ascent from a font metrics structure. The ascent is
245 * the distance from the baseline to the logical top of a line
246 * of text. (The logical top may be above or below the top of the
247 * actual drawn ink. It is necessary to lay out the text to figure
248 * where the ink will be.)
249 * metrics:
250 * a PangoFontMetrics structure
251 * Returns:
252 * the ascent, in Pango units. (1 point == PANGO_SCALE Pango units.)
254 public int getAscent()
256 // int pango_font_metrics_get_ascent (PangoFontMetrics *metrics);
257 return pango_font_metrics_get_ascent(pangoFontMetrics);
261 * Gets the descent from a font metrics structure. The descent is
262 * the distance from the baseline to the logical bottom of a line
263 * of text. (The logical bottom may be above or below the bottom of the
264 * actual drawn ink. It is necessary to lay out the text to figure
265 * where the ink will be.)
266 * metrics:
267 * a PangoFontMetrics structure
268 * Returns:
269 * the descent, in Pango units. (1 point == PANGO_SCALE Pango units.)
271 public int getDescent()
273 // int pango_font_metrics_get_descent (PangoFontMetrics *metrics);
274 return pango_font_metrics_get_descent(pangoFontMetrics);
278 * Gets the approximate character width for a font metrics structure.
279 * This is merely a representative value useful, for example, for
280 * determining the initial size for a window. Actual characters in
281 * text will be wider and narrower than this.
282 * metrics:
283 * a PangoFontMetrics structure
284 * Returns:
285 * the character width, in Pango units. (1 point == PANGO_SCALE Pango units.)
287 public int getApproximateCharWidth()
289 // int pango_font_metrics_get_approximate_char_width (PangoFontMetrics *metrics);
290 return pango_font_metrics_get_approximate_char_width(pangoFontMetrics);
294 * Gets the approximate digit width for a font metrics structure.
295 * This is merely a representative value useful, for example, for
296 * determining the initial size for a window. Actual digits in
297 * text can be wider or narrower than this, though this value
298 * is generally somewhat more accurate than the result of
299 * pango_font_metrics_get_approximate_char_width() for digits.
300 * metrics:
301 * a PangoFontMetrics structure
302 * Returns:
303 * the digit width, in Pango units. (1 point == PANGO_SCALE Pango units.)
305 public int getApproximateDigitWidth()
307 // int pango_font_metrics_get_approximate_digit_width (PangoFontMetrics *metrics);
308 return pango_font_metrics_get_approximate_digit_width(pangoFontMetrics);
312 * Gets the suggested thickness to draw for the underline.
313 * metrics:
314 * a PangoFontMetrics structure
315 * Returns:
316 * the suggested underline thickness, in Pango units.
317 * Since 1.6
319 public int getUnderlineThickness()
321 // int pango_font_metrics_get_underline_thickness (PangoFontMetrics *metrics);
322 return pango_font_metrics_get_underline_thickness(pangoFontMetrics);
326 * Gets the suggested position to draw the underline.
327 * The value returned is the distance above the
328 * baseline of the top of the underline. Since most fonts have
329 * underline positions beneath the baseline, this value is typically
330 * negative.
331 * metrics:
332 * a PangoFontMetrics structure
333 * Returns:
334 * the suggested underline position, in Pango units.
335 * Since 1.6
337 public int getUnderlinePosition()
339 // int pango_font_metrics_get_underline_position (PangoFontMetrics *metrics);
340 return pango_font_metrics_get_underline_position(pangoFontMetrics);
344 * Gets the suggested thickness to draw for the strikethrough.
345 * metrics:
346 * a PangoFontMetrics structure
347 * Returns:
348 * the suggested strikethrough thickness, in Pango units.
349 * Since 1.6
351 public int getStrikethroughThickness()
353 // int pango_font_metrics_get_strikethrough_thickness (PangoFontMetrics *metrics);
354 return pango_font_metrics_get_strikethrough_thickness(pangoFontMetrics);
358 * Gets the suggested position to draw the strikethrough.
359 * The value returned is the distance above the
360 * baseline of the top of the strikethrough.
361 * metrics:
362 * a PangoFontMetrics structure
363 * Returns:
364 * the suggested strikethrough position, in Pango units.
365 * Since 1.6
367 public int getStrikethroughPosition()
369 // int pango_font_metrics_get_strikethrough_position (PangoFontMetrics *metrics);
370 return pango_font_metrics_get_strikethrough_position(pangoFontMetrics);