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  = cairo-cairo-font-options-t.html
27  * outPack = cairo
28  * outFile = FontOption
29  * strct   = cairo_font_options_t
30  * realStrct=
31  * ctorStrct=
32  * clss    = FontOption
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- cairo_font_options_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * structWrap:
47  * 	- cairo_font_options_t* -> FontOption
48  * module aliases:
49  * local aliases:
50  * overrides:
51  */
52 
53 module cairo.FontOption;
54 
55 public  import gtkc.cairotypes;
56 
57 private import gtkc.cairo;
58 private import glib.ConstructionException;
59 
60 
61 
62 
63 
64 
65 /**
66  * The font options specify how fonts should be rendered. Most of the
67  * time the font options implied by a surface are just right and do not
68  * need any changes, but for pixel-based targets tweaking font options
69  * may result in superior output on a particular display.
70  */
71 public class FontOption
72 {
73 	
74 	/** the main Gtk struct */
75 	protected cairo_font_options_t* cairo_font_options;
76 	
77 	
78 	public cairo_font_options_t* getFontOptionStruct()
79 	{
80 		return cairo_font_options;
81 	}
82 	
83 	
84 	/** the main Gtk struct as a void* */
85 	protected void* getStruct()
86 	{
87 		return cast(void*)cairo_font_options;
88 	}
89 	
90 	/**
91 	 * Sets our main struct and passes it to the parent class
92 	 */
93 	public this (cairo_font_options_t* cairo_font_options)
94 	{
95 		this.cairo_font_options = cairo_font_options;
96 	}
97 	
98 	/**
99 	 */
100 	
101 	/**
102 	 * Allocates a new font options object with all options initialized
103 	 *  to default values.
104 	 * Since 1.0
105 	 * Returns: a newly allocated cairo_font_options_t. Free with cairo_font_options_destroy(). This function always returns a valid pointer; if memory cannot be allocated, then a special error object is returned where all operations on the object do nothing. You can check for this with cairo_font_options_status().
106 	 */
107 	public static FontOption create()
108 	{
109 		// cairo_font_options_t * cairo_font_options_create (void);
110 		auto p = cairo_font_options_create();
111 		
112 		if(p is null)
113 		{
114 			return null;
115 		}
116 		
117 		return new FontOption(cast(cairo_font_options_t*) p);
118 	}
119 	
120 	/**
121 	 * Allocates a new font options object copying the option values from
122 	 *  original.
123 	 * Since 1.0
124 	 * Returns: a newly allocated cairo_font_options_t. Free with cairo_font_options_destroy(). This function always returns a valid pointer; if memory cannot be allocated, then a special error object is returned where all operations on the object do nothing. You can check for this with cairo_font_options_status().
125 	 */
126 	public FontOption copy()
127 	{
128 		// cairo_font_options_t * cairo_font_options_copy (const cairo_font_options_t *original);
129 		auto p = cairo_font_options_copy(cairo_font_options);
130 		
131 		if(p is null)
132 		{
133 			return null;
134 		}
135 		
136 		return new FontOption(cast(cairo_font_options_t*) p);
137 	}
138 	
139 	/**
140 	 * Destroys a cairo_font_options_t object created with
141 	 * cairo_font_options_create() or cairo_font_options_copy().
142 	 * Since 1.0
143 	 */
144 	public void destroy()
145 	{
146 		// void cairo_font_options_destroy (cairo_font_options_t *options);
147 		cairo_font_options_destroy(cairo_font_options);
148 	}
149 	
150 	/**
151 	 * Checks whether an error has previously occurred for this
152 	 * font options object
153 	 * Since 1.0
154 	 * Returns: CAIRO_STATUS_SUCCESS or CAIRO_STATUS_NO_MEMORY
155 	 */
156 	public cairo_status_t status()
157 	{
158 		// cairo_status_t cairo_font_options_status (cairo_font_options_t *options);
159 		return cairo_font_options_status(cairo_font_options);
160 	}
161 	
162 	/**
163 	 * Merges non-default options from other into options, replacing
164 	 * existing values. This operation can be thought of as somewhat
165 	 * similar to compositing other onto options with the operation
166 	 * of CAIRO_OPERATOR_OVER.
167 	 * Since 1.0
168 	 * Params:
169 	 * other = another cairo_font_options_t
170 	 */
171 	public void merge(FontOption other)
172 	{
173 		// void cairo_font_options_merge (cairo_font_options_t *options,  const cairo_font_options_t *other);
174 		cairo_font_options_merge(cairo_font_options, (other is null) ? null : other.getFontOptionStruct());
175 	}
176 	
177 	/**
178 	 * Compute a hash for the font options object; this value will
179 	 * be useful when storing an object containing a cairo_font_options_t
180 	 * in a hash table.
181 	 * Since 1.0
182 	 * Returns: the hash value for the font options object. The return value can be cast to a 32-bit type if a 32-bit hash value is needed.
183 	 */
184 	public ulong hash()
185 	{
186 		// unsigned long cairo_font_options_hash (const cairo_font_options_t *options);
187 		return cairo_font_options_hash(cairo_font_options);
188 	}
189 	
190 	/**
191 	 * Compares two font options objects for equality.
192 	 * Since 1.0
193 	 * Params:
194 	 * other = another cairo_font_options_t
195 	 * Returns: TRUE if all fields of the two font options objects match. Note that this function will return FALSE if either object is in error.
196 	 */
197 	public cairo_bool_t equal(FontOption other)
198 	{
199 		// cairo_bool_t cairo_font_options_equal (const cairo_font_options_t *options,  const cairo_font_options_t *other);
200 		return cairo_font_options_equal(cairo_font_options, (other is null) ? null : other.getFontOptionStruct());
201 	}
202 	
203 	/**
204 	 * Sets the antialiasing mode for the font options object. This
205 	 * specifies the type of antialiasing to do when rendering text.
206 	 * Since 1.0
207 	 * Params:
208 	 * antialias = the new antialiasing mode
209 	 */
210 	public void setAntialias(cairo_antialias_t antialias)
211 	{
212 		// void cairo_font_options_set_antialias (cairo_font_options_t *options,  cairo_antialias_t antialias);
213 		cairo_font_options_set_antialias(cairo_font_options, antialias);
214 	}
215 	
216 	/**
217 	 * Gets the antialiasing mode for the font options object.
218 	 * Since 1.0
219 	 * Returns: the antialiasing mode
220 	 */
221 	public cairo_antialias_t getAntialias()
222 	{
223 		// cairo_antialias_t cairo_font_options_get_antialias (const cairo_font_options_t *options);
224 		return cairo_font_options_get_antialias(cairo_font_options);
225 	}
226 	
227 	/**
228 	 * Sets the subpixel order for the font options object. The subpixel
229 	 * order specifies the order of color elements within each pixel on
230 	 * the display device when rendering with an antialiasing mode of
231 	 * CAIRO_ANTIALIAS_SUBPIXEL. See the documentation for
232 	 * cairo_subpixel_order_t for full details.
233 	 * Since 1.0
234 	 * Params:
235 	 * subpixelOrder = the new subpixel order
236 	 */
237 	public void setSubpixelOrder(cairo_subpixel_order_t subpixelOrder)
238 	{
239 		// void cairo_font_options_set_subpixel_order  (cairo_font_options_t *options,  cairo_subpixel_order_t subpixel_order);
240 		cairo_font_options_set_subpixel_order(cairo_font_options, subpixelOrder);
241 	}
242 	
243 	/**
244 	 * Gets the subpixel order for the font options object.
245 	 * See the documentation for cairo_subpixel_order_t for full details.
246 	 * Since 1.0
247 	 * Returns: the subpixel order for the font options object
248 	 */
249 	public cairo_subpixel_order_t getSubpixelOrder()
250 	{
251 		// cairo_subpixel_order_t cairo_font_options_get_subpixel_order  (const cairo_font_options_t *options);
252 		return cairo_font_options_get_subpixel_order(cairo_font_options);
253 	}
254 	
255 	/**
256 	 * Sets the hint style for font outlines for the font options object.
257 	 * This controls whether to fit font outlines to the pixel grid,
258 	 * and if so, whether to optimize for fidelity or contrast.
259 	 * See the documentation for cairo_hint_style_t for full details.
260 	 * Since 1.0
261 	 * Params:
262 	 * hintStyle = the new hint style
263 	 */
264 	public void setHintStyle(cairo_hint_style_t hintStyle)
265 	{
266 		// void cairo_font_options_set_hint_style (cairo_font_options_t *options,  cairo_hint_style_t hint_style);
267 		cairo_font_options_set_hint_style(cairo_font_options, hintStyle);
268 	}
269 	
270 	/**
271 	 * Gets the hint style for font outlines for the font options object.
272 	 * See the documentation for cairo_hint_style_t for full details.
273 	 * Since 1.0
274 	 * Returns: the hint style for the font options object
275 	 */
276 	public cairo_hint_style_t getHintStyle()
277 	{
278 		// cairo_hint_style_t cairo_font_options_get_hint_style (const cairo_font_options_t *options);
279 		return cairo_font_options_get_hint_style(cairo_font_options);
280 	}
281 	
282 	/**
283 	 * Sets the metrics hinting mode for the font options object. This
284 	 * controls whether metrics are quantized to integer values in
285 	 * device units.
286 	 * See the documentation for cairo_hint_metrics_t for full details.
287 	 * Since 1.0
288 	 * Params:
289 	 * hintMetrics = the new metrics hinting mode
290 	 */
291 	public void setHintMetrics(cairo_hint_metrics_t hintMetrics)
292 	{
293 		// void cairo_font_options_set_hint_metrics (cairo_font_options_t *options,  cairo_hint_metrics_t hint_metrics);
294 		cairo_font_options_set_hint_metrics(cairo_font_options, hintMetrics);
295 	}
296 	
297 	/**
298 	 * Gets the metrics hinting mode for the font options object.
299 	 * See the documentation for cairo_hint_metrics_t for full details.
300 	 * Since 1.0
301 	 * Returns: the metrics hinting mode for the font options object
302 	 */
303 	public cairo_hint_metrics_t getHintMetrics()
304 	{
305 		// cairo_hint_metrics_t cairo_font_options_get_hint_metrics  (const cairo_font_options_t *options);
306 		return cairo_font_options_get_hint_metrics(cairo_font_options);
307 	}
308 }