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-User-Fonts.html
27  * outPack = cairo
28  * outFile = UserFontFace
29  * strct   = cairo_font_face_t
30  * realStrct=
31  * ctorStrct=
32  * clss    = UserFontFace
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- cairo_user_font_face_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * structWrap:
47  * 	- cairo_font_face_t* -> UserFontFace
48  * module aliases:
49  * local aliases:
50  * overrides:
51  */
52 
53 module cairo.UserFontFace;
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 user-font feature allows the cairo user to provide drawings for glyphs
68  * in a font. This is most useful in implementing fonts in non-standard
69  * formats, like SVG fonts and Flash fonts, but can also be used by games and
70  * other application to draw "funky" fonts.
71  */
72 public class UserFontFace
73 {
74 	
75 	/** the main Gtk struct */
76 	protected cairo_font_face_t* cairo_font_face;
77 	
78 	
79 	public cairo_font_face_t* getUserFontFaceStruct()
80 	{
81 		return cairo_font_face;
82 	}
83 	
84 	
85 	/** the main Gtk struct as a void* */
86 	protected void* getStruct()
87 	{
88 		return cast(void*)cairo_font_face;
89 	}
90 	
91 	/**
92 	 * Sets our main struct and passes it to the parent class
93 	 */
94 	public this (cairo_font_face_t* cairo_font_face)
95 	{
96 		this.cairo_font_face = cairo_font_face;
97 	}
98 	
99 	/**
100 	 */
101 	
102 	/**
103 	 * Creates a new user font-face.
104 	 * Use the setter functions to associate callbacks with the returned
105 	 * user font. The only mandatory callback is render_glyph.
106 	 * After the font-face is created, the user can attach arbitrary data
107 	 * (the actual font data) to it using cairo_font_face_set_user_data()
108 	 * and access it from the user-font callbacks by using
109 	 * cairo_scaled_font_get_font_face() followed by
110 	 * cairo_font_face_get_user_data().
111 	 * Since 1.8
112 	 * Returns: a newly created cairo_font_face_t. Free with cairo_font_face_destroy() when you are done using it.
113 	 */
114 	public static UserFontFace create()
115 	{
116 		// cairo_font_face_t * cairo_user_font_face_create (void);
117 		auto p = cairo_user_font_face_create();
118 		
119 		if(p is null)
120 		{
121 			return null;
122 		}
123 		
124 		return new UserFontFace(cast(cairo_font_face_t*) p);
125 	}
126 	
127 	/**
128 	 * Sets the scaled-font initialization function of a user-font.
129 	 * See cairo_user_scaled_font_init_func_t for details of how the callback
130 	 * works.
131 	 * The font-face should not be immutable or a CAIRO_STATUS_USER_FONT_IMMUTABLE
132 	 * error will occur. A user font-face is immutable as soon as a scaled-font
133 	 * is created from it.
134 	 * Since 1.8
135 	 * Params:
136 	 * initFunc = The init callback, or NULL
137 	 */
138 	public void setInitFunc(cairo_user_scaled_font_init_func_t initFunc)
139 	{
140 		// void cairo_user_font_face_set_init_func (cairo_font_face_t *font_face,  cairo_user_scaled_font_init_func_t init_func);
141 		cairo_user_font_face_set_init_func(cairo_font_face, initFunc);
142 	}
143 	
144 	/**
145 	 * Gets the scaled-font initialization function of a user-font.
146 	 * Since 1.8
147 	 * Returns: The init callback of font_face or NULL if none set or an error has occurred.
148 	 */
149 	public cairo_user_scaled_font_init_func_t getInitFunc()
150 	{
151 		// cairo_user_scaled_font_init_func_t cairo_user_font_face_get_init_func  (cairo_font_face_t *font_face);
152 		return cairo_user_font_face_get_init_func(cairo_font_face);
153 	}
154 	
155 	/**
156 	 * Sets the glyph rendering function of a user-font.
157 	 * See cairo_user_scaled_font_render_glyph_func_t for details of how the callback
158 	 * works.
159 	 * The font-face should not be immutable or a CAIRO_STATUS_USER_FONT_IMMUTABLE
160 	 * error will occur. A user font-face is immutable as soon as a scaled-font
161 	 * is created from it.
162 	 * The render_glyph callback is the only mandatory callback of a user-font.
163 	 * If the callback is NULL and a glyph is tried to be rendered using
164 	 * font_face, a CAIRO_STATUS_USER_FONT_ERROR will occur.
165 	 * Since 1.8
166 	 * Params:
167 	 * renderGlyphFunc = The render_glyph callback, or NULL
168 	 */
169 	public void setRenderGlyphFunc(cairo_user_scaled_font_render_glyph_func_t renderGlyphFunc)
170 	{
171 		// void cairo_user_font_face_set_render_glyph_func  (cairo_font_face_t *font_face,  cairo_user_scaled_font_render_glyph_func_t render_glyph_func);
172 		cairo_user_font_face_set_render_glyph_func(cairo_font_face, renderGlyphFunc);
173 	}
174 	
175 	/**
176 	 * Gets the glyph rendering function of a user-font.
177 	 * Since 1.8
178 	 * Returns: The render_glyph callback of font_face or NULL if none set or an error has occurred.
179 	 */
180 	public cairo_user_scaled_font_render_glyph_func_t getRenderGlyphFunc()
181 	{
182 		// cairo_user_scaled_font_render_glyph_func_t cairo_user_font_face_get_render_glyph_func  (cairo_font_face_t *font_face);
183 		return cairo_user_font_face_get_render_glyph_func(cairo_font_face);
184 	}
185 	
186 	/**
187 	 * Sets the unicode-to-glyph conversion function of a user-font.
188 	 * See cairo_user_scaled_font_unicode_to_glyph_func_t for details of how the callback
189 	 * works.
190 	 * The font-face should not be immutable or a CAIRO_STATUS_USER_FONT_IMMUTABLE
191 	 * error will occur. A user font-face is immutable as soon as a scaled-font
192 	 * is created from it.
193 	 * Since 1.8
194 	 * Params:
195 	 * unicodeToGlyphFunc = The unicode_to_glyph callback, or NULL
196 	 */
197 	public void setUnicodeToGlyphFunc(cairo_user_scaled_font_unicode_to_glyph_func_t unicodeToGlyphFunc)
198 	{
199 		// void cairo_user_font_face_set_unicode_to_glyph_func  (cairo_font_face_t *font_face,  cairo_user_scaled_font_unicode_to_glyph_func_t unicode_to_glyph_func);
200 		cairo_user_font_face_set_unicode_to_glyph_func(cairo_font_face, unicodeToGlyphFunc);
201 	}
202 	
203 	/**
204 	 * Gets the unicode-to-glyph conversion function of a user-font.
205 	 * Since 1.8
206 	 * Returns: The unicode_to_glyph callback of font_face or NULL if none set or an error occurred.
207 	 */
208 	public cairo_user_scaled_font_unicode_to_glyph_func_t getUnicodeToGlyphFunc()
209 	{
210 		// cairo_user_scaled_font_unicode_to_glyph_func_t cairo_user_font_face_get_unicode_to_glyph_func  (cairo_font_face_t *font_face);
211 		return cairo_user_font_face_get_unicode_to_glyph_func(cairo_font_face);
212 	}
213 	
214 	/**
215 	 * Sets th text-to-glyphs conversion function of a user-font.
216 	 * See cairo_user_scaled_font_text_to_glyphs_func_t for details of how the callback
217 	 * works.
218 	 * The font-face should not be immutable or a CAIRO_STATUS_USER_FONT_IMMUTABLE
219 	 * error will occur. A user font-face is immutable as soon as a scaled-font
220 	 * is created from it.
221 	 * Since 1.8
222 	 * Params:
223 	 * textToGlyphsFunc = The text_to_glyphs callback, or NULL
224 	 */
225 	public void setTextToGlyphsFunc(cairo_user_scaled_font_text_to_glyphs_func_t textToGlyphsFunc)
226 	{
227 		// void cairo_user_font_face_set_text_to_glyphs_func  (cairo_font_face_t *font_face,  cairo_user_scaled_font_text_to_glyphs_func_t text_to_glyphs_func);
228 		cairo_user_font_face_set_text_to_glyphs_func(cairo_font_face, textToGlyphsFunc);
229 	}
230 	
231 	/**
232 	 * Gets the text-to-glyphs conversion function of a user-font.
233 	 * Since 1.8
234 	 * Returns: The text_to_glyphs callback of font_face or NULL if none set or an error occurred.
235 	 */
236 	public cairo_user_scaled_font_text_to_glyphs_func_t getTextToGlyphsFunc()
237 	{
238 		// cairo_user_scaled_font_text_to_glyphs_func_t cairo_user_font_face_get_text_to_glyphs_func  (cairo_font_face_t *font_face);
239 		return cairo_user_font_face_get_text_to_glyphs_func(cairo_font_face);
240 	}
241 }