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