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