alternative to assert
[gtkD.git] / gtkD / src / cairoLib / ScaledFont.d
blob90dbb8ae6f65ad4383c37d298827600f8db43f94
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 = cairo-Scaled-Fonts.html
26 * outPack = cairoLib
27 * outFile = ScaledFont
28 * strct = cairo_scaled_font_t
29 * realStrct=
30 * ctorStrct=
31 * clss = ScaledFont
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - cairo_scaled_font_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - glib.Str
45 * structWrap:
46 * module aliases:
47 * local aliases:
50 module cairoLib.ScaledFont;
52 version(noAssert)
54 version(Tango)
56 import tango.io.Stdout; // use the tango loging?
60 private import gtkc.cairoLibtypes;
62 private import gtkc.cairoLib;
65 private import glib.Str;
70 /**
71 * Description
73 public class ScaledFont
76 /** the main Gtk struct */
77 protected cairo_scaled_font_t* cairo_scaled_font;
80 public cairo_scaled_font_t* getScaledFontStruct()
82 return cairo_scaled_font;
86 /** the main Gtk struct as a void* */
87 protected void* getStruct()
89 return cast(void*)cairo_scaled_font;
92 /**
93 * Sets our main struct and passes it to the parent class
95 public this (cairo_scaled_font_t* cairo_scaled_font)
97 version(noAssert)
99 if ( cairo_scaled_font is null )
101 int zero = 0;
102 version(Tango)
104 Stdout("struct cairo_scaled_font is null on constructor").newline;
106 else
108 printf("struct cairo_scaled_font is null on constructor");
110 zero = zero / zero;
113 else
115 assert(cairo_scaled_font !is null, "struct cairo_scaled_font is null on constructor");
117 this.cairo_scaled_font = cairo_scaled_font;
125 * Creates a cairo_scaled_font_t object from a font face and matrices that
126 * describe the size of the font and the environment in which it will
127 * be used.
128 * font_face:
129 * a cairo_font_face_t
130 * font_matrix:
131 * font space to user space transformation matrix for the
132 * font. In the simplest case of a N point font, this matrix is
133 * just a scale by N, but it can also be used to shear the font
134 * or stretch it unequally along the two axes. See
135 * cairo_set_font_matrix().
136 * ctm:
137 * user to device transformation matrix with which the font will
138 * be used.
139 * options:
140 * options to use when getting metrics for the font and
141 * rendering with it.
142 * Returns:
143 * a newly created cairo_scaled_font_t. Destroy with
144 * cairo_scaled_font_destroy()
146 public static cairo_scaled_font_t* create(cairo_font_face_t* fontFace, cairo_matrix_t* fontMatrix, cairo_matrix_t* ctm, cairo_font_options_t* options)
148 // cairo_scaled_font_t* cairo_scaled_font_create (cairo_font_face_t *font_face, const cairo_matrix_t *font_matrix, const cairo_matrix_t *ctm, const cairo_font_options_t *options);
149 return cairo_scaled_font_create(fontFace, fontMatrix, ctm, options);
153 * Increases the reference count on scaled_font by one. This prevents
154 * scaled_font from being destroyed until a matching call to
155 * cairo_scaled_font_destroy() is made.
156 * scaled_font:
157 * a cairo_scaled_font_t, (may be NULL in which case
158 * this function does nothing)
159 * Returns:
160 * the referenced cairo_scaled_font_t
162 public cairo_scaled_font_t* reference()
164 // cairo_scaled_font_t* cairo_scaled_font_reference (cairo_scaled_font_t *scaled_font);
165 return cairo_scaled_font_reference(cairo_scaled_font);
169 * Decreases the reference count on font by one. If the result
170 * is zero, then font and all associated resources are freed.
171 * See cairo_scaled_font_reference().
172 * scaled_font:
173 * a cairo_scaled_font_t
175 public void destroy()
177 // void cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font);
178 cairo_scaled_font_destroy(cairo_scaled_font);
182 * Checks whether an error has previously occurred for this
183 * scaled_font.
184 * scaled_font:
185 * a cairo_scaled_font_t
186 * Returns:
187 * CAIRO_STATUS_SUCCESS or another error such as
188 * CAIRO_STATUS_NO_MEMORY.
190 public cairo_status_t status()
192 // cairo_status_t cairo_scaled_font_status (cairo_scaled_font_t *scaled_font);
193 return cairo_scaled_font_status(cairo_scaled_font);
198 * Gets the metrics for a cairo_scaled_font_t.
199 * scaled_font:
200 * a cairo_scaled_font_t
201 * extents:
202 * a cairo_font_extents_t which to store the retrieved extents.
204 public void extents(cairo_font_extents_t* extents)
206 // void cairo_scaled_font_extents (cairo_scaled_font_t *scaled_font, cairo_font_extents_t *extents);
207 cairo_scaled_font_extents(cairo_scaled_font, extents);
212 * Gets the extents for a string of text. The extents describe a
213 * user-space rectangle that encloses the "inked" portion of the text
214 * drawn at the origin (0,0) (as it would be drawn by cairo_show_text()
215 * if the cairo graphics state were set to the same font_face,
216 * font_matrix, ctm, and font_options as scaled_font). Additionally,
217 * the x_advance and y_advance values indicate the amount by which the
218 * current point would be advanced by cairo_show_text().
219 * Note that whitespace characters do not directly contribute to the
220 * size of the rectangle (extents.width and extents.height). They do
221 * contribute indirectly by changing the position of non-whitespace
222 * characters. In particular, trailing whitespace characters are
223 * likely to not affect the size of the rectangle, though they will
224 * affect the x_advance and y_advance values.
225 * scaled_font:
226 * a cairo_scaled_font_t
227 * utf8:
228 * a string of text, encoded in UTF-8
229 * extents:
230 * a cairo_text_extents_t which to store the retrieved extents.
231 * Since 1.2
233 public void textExtents(char[] utf8, cairo_text_extents_t* extents)
235 // void cairo_scaled_font_text_extents (cairo_scaled_font_t *scaled_font, const char *utf8, cairo_text_extents_t *extents);
236 cairo_scaled_font_text_extents(cairo_scaled_font, Str.toStringz(utf8), extents);
240 * Gets the extents for an array of glyphs. The extents describe a
241 * user-space rectangle that encloses the "inked" portion of the
242 * glyphs, (as they would be drawn by cairo_show_glyphs() if the cairo
243 * graphics state were set to the same font_face, font_matrix, ctm,
244 * and font_options as scaled_font). Additionally, the x_advance and
245 * y_advance values indicate the amount by which the current point
246 * would be advanced by cairo_show_glyphs.
247 * Note that whitespace glyphs do not contribute to the size of the
248 * rectangle (extents.width and extents.height).
249 * scaled_font:
250 * a cairo_scaled_font_t
251 * glyphs:
252 * an array of glyph IDs with X and Y offsets.
253 * num_glyphs:
254 * the number of glyphs in the glyphs array
255 * extents:
256 * a cairo_text_extents_t which to store the retrieved extents.
258 public void glyphExtents(cairo_glyph_t* glyphs, int numGlyphs, cairo_text_extents_t* extents)
260 // void cairo_scaled_font_glyph_extents (cairo_scaled_font_t *scaled_font, cairo_glyph_t *glyphs, int num_glyphs, cairo_text_extents_t *extents);
261 cairo_scaled_font_glyph_extents(cairo_scaled_font, glyphs, numGlyphs, extents);
265 * Gets the font face that this scaled font was created for.
266 * scaled_font:
267 * a cairo_scaled_font_t
268 * Returns:
269 * The cairo_font_face_t with which scaled_font was
270 * created.
271 * Since 1.2
273 public cairo_font_face_t* getFontFace()
275 // cairo_font_face_t* cairo_scaled_font_get_font_face (cairo_scaled_font_t *scaled_font);
276 return cairo_scaled_font_get_font_face(cairo_scaled_font);
280 * Stores the font options with which scaled_font was created into
281 * options.
282 * scaled_font:
283 * a cairo_scaled_font_t
284 * options:
285 * return value for the font options
286 * Since 1.2
288 public void getFontOptions(cairo_font_options_t* options)
290 // void cairo_scaled_font_get_font_options (cairo_scaled_font_t *scaled_font, cairo_font_options_t *options);
291 cairo_scaled_font_get_font_options(cairo_scaled_font, options);
295 * Stores the font matrix with which scaled_font was created into
296 * matrix.
297 * scaled_font:
298 * a cairo_scaled_font_t
299 * font_matrix:
300 * return value for the matrix
301 * Since 1.2
303 public void getFontMatrix(cairo_matrix_t* fontMatrix)
305 // void cairo_scaled_font_get_font_matrix (cairo_scaled_font_t *scaled_font, cairo_matrix_t *font_matrix);
306 cairo_scaled_font_get_font_matrix(cairo_scaled_font, fontMatrix);
310 * Stores the CTM with which scaled_font was created into ctm.
311 * scaled_font:
312 * a cairo_scaled_font_t
313 * ctm:
314 * return value for the CTM
315 * Since 1.2
317 public void getCtm(cairo_matrix_t* ctm)
319 // void cairo_scaled_font_get_ctm (cairo_scaled_font_t *scaled_font, cairo_matrix_t *ctm);
320 cairo_scaled_font_get_ctm(cairo_scaled_font, ctm);
324 * This function returns the type of the backend used to create
325 * a scaled font. See cairo_font_type_t for available types.
326 * scaled_font:
327 * a cairo_scaled_font_t
328 * Returns:
329 * The type of scaled_font.
330 * Since 1.2
332 public cairo_font_type_t getType()
334 // cairo_font_type_t cairo_scaled_font_get_type (cairo_scaled_font_t *scaled_font);
335 return cairo_scaled_font_get_type(cairo_scaled_font);