alternative to assert
[gtkD.git] / src / cairoLib / ScaledFont.d
blobb7b0d796163e8e51d0ca6b9a7ae9bd55f80461fd
1 /*
2 * This file is part of duit.
4 * duit 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 * duit 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 duit; 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 * local aliases:
49 module cairoLib.ScaledFont;
51 private import cairoLib.cairoLibtypes;
53 private import lib.cairoLib;
55 private import glib.Str;
57 /**
58 * Description
60 public class ScaledFont
63 /** the main Gtk struct */
64 protected cairo_scaled_font_t* cairo_scaled_font;
67 public cairo_scaled_font_t* getScaledFontStruct()
69 return cairo_scaled_font;
73 /** the main Gtk struct as a void* */
74 protected void* getStruct()
76 return cast(void*)cairo_scaled_font;
79 /**
80 * Sets our main struct and passes it to the parent class
82 public this (cairo_scaled_font_t* cairo_scaled_font)
84 this.cairo_scaled_font = cairo_scaled_font;
87 /**
91 /**
92 * Creates a cairo_scaled_font_t object from a font face and matrices that
93 * describe the size of the font and the environment in which it will
94 * be used.
95 * font_face:
96 * a cairo_font_face_t
97 * font_matrix:
98 * font space to user space transformation matrix for the
99 * font. In the simplest case of a N point font, this matrix is
100 * just a scale by N, but it can also be used to shear the font
101 * or stretch it unequally along the two axes. See
102 * cairo_set_font_matrix().
103 * ctm:
104 * user to device transformation matrix with which the font will
105 * be used.
106 * options:
107 * options to use when getting metrics for the font and
108 * rendering with it.
109 * Returns:
110 * a newly created cairo_scaled_font_t. Destroy with
111 * cairo_scaled_font_destroy()
113 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)
115 // 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);
116 return cairo_scaled_font_create(fontFace, fontMatrix, ctm, options);
120 * Increases the reference count on scaled_font by one. This prevents
121 * scaled_font from being destroyed until a matching call to
122 * cairo_scaled_font_destroy() is made.
123 * scaled_font:
124 * a cairo_scaled_font_t, (may be NULL in which case
125 * this function does nothing)
126 * Returns:
127 * the referenced cairo_scaled_font_t
129 public cairo_scaled_font_t* reference()
131 // cairo_scaled_font_t* cairo_scaled_font_reference (cairo_scaled_font_t *scaled_font);
132 return cairo_scaled_font_reference(cairo_scaled_font);
136 * Decreases the reference count on font by one. If the result
137 * is zero, then font and all associated resources are freed.
138 * See cairo_scaled_font_reference().
139 * scaled_font:
140 * a cairo_scaled_font_t
142 public void destroy()
144 // void cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font);
145 cairo_scaled_font_destroy(cairo_scaled_font);
149 * Checks whether an error has previously occurred for this
150 * scaled_font.
151 * scaled_font:
152 * a cairo_scaled_font_t
153 * Returns:
154 * CAIRO_STATUS_SUCCESS or another error such as
155 * CAIRO_STATUS_NO_MEMORY.
157 public cairo_status_t status()
159 // cairo_status_t cairo_scaled_font_status (cairo_scaled_font_t *scaled_font);
160 return cairo_scaled_font_status(cairo_scaled_font);
165 * Gets the metrics for a cairo_scaled_font_t.
166 * scaled_font:
167 * a cairo_scaled_font_t
168 * extents:
169 * a cairo_font_extents_t which to store the retrieved extents.
171 public void extents(cairo_font_extents_t* extents)
173 // void cairo_scaled_font_extents (cairo_scaled_font_t *scaled_font, cairo_font_extents_t *extents);
174 cairo_scaled_font_extents(cairo_scaled_font, extents);
179 * Gets the extents for a string of text. The extents describe a
180 * user-space rectangle that encloses the "inked" portion of the text
181 * drawn at the origin (0,0) (as it would be drawn by cairo_show_text()
182 * if the cairo graphics state were set to the same font_face,
183 * font_matrix, ctm, and font_options as scaled_font). Additionally,
184 * the x_advance and y_advance values indicate the amount by which the
185 * current point would be advanced by cairo_show_text().
186 * Note that whitespace characters do not directly contribute to the
187 * size of the rectangle (extents.width and extents.height). They do
188 * contribute indirectly by changing the position of non-whitespace
189 * characters. In particular, trailing whitespace characters are
190 * likely to not affect the size of the rectangle, though they will
191 * affect the x_advance and y_advance values.
192 * scaled_font:
193 * a cairo_scaled_font_t
194 * utf8:
195 * a string of text, encoded in UTF-8
196 * extents:
197 * a cairo_text_extents_t which to store the retrieved extents.
198 * Since 1.2
200 public void textExtents(char[] utf8, cairo_text_extents_t* extents)
202 // void cairo_scaled_font_text_extents (cairo_scaled_font_t *scaled_font, const char *utf8, cairo_text_extents_t *extents);
203 cairo_scaled_font_text_extents(cairo_scaled_font, Str.toStringz(utf8), extents);
207 * Gets the extents for an array of glyphs. The extents describe a
208 * user-space rectangle that encloses the "inked" portion of the
209 * glyphs, (as they would be drawn by cairo_show_glyphs() if the cairo
210 * graphics state were set to the same font_face, font_matrix, ctm,
211 * and font_options as scaled_font). Additionally, the x_advance and
212 * y_advance values indicate the amount by which the current point
213 * would be advanced by cairo_show_glyphs.
214 * Note that whitespace glyphs do not contribute to the size of the
215 * rectangle (extents.width and extents.height).
216 * scaled_font:
217 * a cairo_scaled_font_t
218 * glyphs:
219 * an array of glyph IDs with X and Y offsets.
220 * num_glyphs:
221 * the number of glyphs in the glyphs array
222 * extents:
223 * a cairo_text_extents_t which to store the retrieved extents.
225 public void glyphExtents(cairo_glyph_t* glyphs, int numGlyphs, cairo_text_extents_t* extents)
227 // void cairo_scaled_font_glyph_extents (cairo_scaled_font_t *scaled_font, cairo_glyph_t *glyphs, int num_glyphs, cairo_text_extents_t *extents);
228 cairo_scaled_font_glyph_extents(cairo_scaled_font, glyphs, numGlyphs, extents);
232 * Gets the font face that this scaled font was created for.
233 * scaled_font:
234 * a cairo_scaled_font_t
235 * Returns:
236 * The cairo_font_face_t with which scaled_font was
237 * created.
238 * Since 1.2
240 public cairo_font_face_t* getFontFace()
242 // cairo_font_face_t* cairo_scaled_font_get_font_face (cairo_scaled_font_t *scaled_font);
243 return cairo_scaled_font_get_font_face(cairo_scaled_font);
247 * Stores the font options with which scaled_font was created into
248 * options.
249 * scaled_font:
250 * a cairo_scaled_font_t
251 * options:
252 * return value for the font options
253 * Since 1.2
255 public void getFontOptions(cairo_font_options_t* options)
257 // void cairo_scaled_font_get_font_options (cairo_scaled_font_t *scaled_font, cairo_font_options_t *options);
258 cairo_scaled_font_get_font_options(cairo_scaled_font, options);
262 * Stores the font matrix with which scaled_font was created into
263 * matrix.
264 * scaled_font:
265 * a cairo_scaled_font_t
266 * font_matrix:
267 * return value for the matrix
268 * Since 1.2
270 public void getFontMatrix(cairo_matrix_t* fontMatrix)
272 // void cairo_scaled_font_get_font_matrix (cairo_scaled_font_t *scaled_font, cairo_matrix_t *font_matrix);
273 cairo_scaled_font_get_font_matrix(cairo_scaled_font, fontMatrix);
277 * Stores the CTM with which scaled_font was created into ctm.
278 * scaled_font:
279 * a cairo_scaled_font_t
280 * ctm:
281 * return value for the CTM
282 * Since 1.2
284 public void getCtm(cairo_matrix_t* ctm)
286 // void cairo_scaled_font_get_ctm (cairo_scaled_font_t *scaled_font, cairo_matrix_t *ctm);
287 cairo_scaled_font_get_ctm(cairo_scaled_font, ctm);
291 * This function returns the type of the backend used to create
292 * a scaled font. See cairo_font_type_t for available types.
293 * scaled_font:
294 * a cairo_scaled_font_t
295 * Returns:
296 * The type of scaled_font.
297 * Since 1.2
299 public cairo_font_type_t getType()
301 // cairo_font_type_t cairo_scaled_font_get_type (cairo_scaled_font_t *scaled_font);
302 return cairo_scaled_font_get_type(cairo_scaled_font);