1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6 <title>FreeType-2.4.9 API Reference</title>
7 <style type="text/css">
8 body { font-family: Verdana, Geneva, Arial, Helvetica, serif;
10 background: #FFFFFF; }
12 p { text-align: justify; }
13 h1 { text-align: center; }
14 li { text-align: justify; }
15 td { padding: 0 0.5em 0 0.5em; }
16 td.left { padding: 0 0.5em 0 0.5em;
19 a:link { color: #0000EF; }
20 a:visited { color: #51188E; }
21 a:hover { color: #FF0000; }
23 span.keyword { font-family: monospace;
28 pre.colored { color: blue; }
30 ul.empty { list-style-type: none; }
35 <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td>
36 <td width="100%"></td>
37 <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
38 <center><h1>FreeType-2.4.9 API Reference</h1></center>
44 <table align=center cellspacing=5 cellpadding=0 border=0>
45 <tr><td></td><td><a href="#FT_Glyph">FT_Glyph</a></td><td></td><td><a href="#FT_OutlineGlyphRec">FT_OutlineGlyphRec</a></td><td></td><td><a href="#ft_glyph_bbox_xxx">ft_glyph_bbox_xxx</a></td></tr>
46 <tr><td></td><td><a href="#FT_GlyphRec">FT_GlyphRec</a></td><td></td><td><a href="#FT_Get_Glyph">FT_Get_Glyph</a></td><td></td><td><a href="#FT_Glyph_Get_CBox">FT_Glyph_Get_CBox</a></td></tr>
47 <tr><td></td><td><a href="#FT_BitmapGlyph">FT_BitmapGlyph</a></td><td></td><td><a href="#FT_Glyph_Copy">FT_Glyph_Copy</a></td><td></td><td><a href="#FT_Glyph_To_Bitmap">FT_Glyph_To_Bitmap</a></td></tr>
48 <tr><td></td><td><a href="#FT_BitmapGlyphRec">FT_BitmapGlyphRec</a></td><td></td><td><a href="#FT_Glyph_Transform">FT_Glyph_Transform</a></td><td></td><td><a href="#FT_Done_Glyph">FT_Done_Glyph</a></td></tr>
49 <tr><td></td><td><a href="#FT_OutlineGlyph">FT_OutlineGlyph</a></td><td></td><td><a href="#FT_Glyph_BBox_Mode">FT_Glyph_BBox_Mode</a></td><td></td><td></td></tr>
52 <table align=center width="87%"><tr><td>
53 <p>This section contains definitions used to manage glyph data through generic FT_Glyph objects. Each of them can contain a bitmap, a vector outline, or even images in other formats.</p>
54 </td></tr></table><br>
55 <table align=center width="75%"><tr><td>
56 <h4><a name="FT_Glyph">FT_Glyph</a></h4>
57 <table align=center width="87%"><tr><td>
58 Defined in FT_GLYPH_H (freetype/ftglyph.h).
59 </td></tr></table><br>
60 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
62 <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_GlyphRec_* <b>FT_Glyph</b>;
65 <table align=center width="87%"><tr><td>
66 <p>Handle to an object used to model generic glyph images. It is a pointer to the <a href="ft2-glyph_management.html#FT_GlyphRec">FT_GlyphRec</a> structure and can contain a glyph bitmap or pointer.</p>
67 </td></tr></table><br>
68 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td>
69 <p>Glyph objects are not owned by the library. You must thus release them manually (through <a href="ft2-glyph_management.html#FT_Done_Glyph">FT_Done_Glyph</a>) <i>before</i> calling <a href="ft2-base_interface.html#FT_Done_FreeType">FT_Done_FreeType</a>.</p>
73 <table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
74 <td width="100%"></td>
75 <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
77 <table align=center width="75%"><tr><td>
78 <h4><a name="FT_GlyphRec">FT_GlyphRec</a></h4>
79 <table align=center width="87%"><tr><td>
80 Defined in FT_GLYPH_H (freetype/ftglyph.h).
81 </td></tr></table><br>
82 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
84 <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_GlyphRec_
86 <a href="ft2-base_interface.html#FT_Library">FT_Library</a> library;
87 <span class="keyword">const</span> FT_Glyph_Class* clazz;
88 <a href="ft2-basic_types.html#FT_Glyph_Format">FT_Glyph_Format</a> format;
89 <a href="ft2-basic_types.html#FT_Vector">FT_Vector</a> advance;
94 <table align=center width="87%"><tr><td>
95 <p>The root glyph structure contains a given glyph image plus its advance width in 16.16 fixed float format.</p>
96 </td></tr></table><br>
97 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>fields</b></em></td></tr><tr><td>
99 <table cellpadding=3 border=0>
100 <tr valign=top><td><b>library</b></td><td>
101 <p>A handle to the FreeType library object.</p>
103 <tr valign=top><td><b>clazz</b></td><td>
104 <p>A pointer to the glyph's class. Private.</p>
106 <tr valign=top><td><b>format</b></td><td>
107 <p>The format of the glyph's image.</p>
109 <tr valign=top><td><b>advance</b></td><td>
110 <p>A 16.16 vector that gives the glyph's advance width.</p>
116 <table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
117 <td width="100%"></td>
118 <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
120 <table align=center width="75%"><tr><td>
121 <h4><a name="FT_BitmapGlyph">FT_BitmapGlyph</a></h4>
122 <table align=center width="87%"><tr><td>
123 Defined in FT_GLYPH_H (freetype/ftglyph.h).
124 </td></tr></table><br>
125 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
127 <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_BitmapGlyphRec_* <b>FT_BitmapGlyph</b>;
130 <table align=center width="87%"><tr><td>
131 <p>A handle to an object used to model a bitmap glyph image. This is a sub-class of <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a>, and a pointer to <a href="ft2-glyph_management.html#FT_BitmapGlyphRec">FT_BitmapGlyphRec</a>.</p>
132 </td></tr></table><br>
135 <table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
136 <td width="100%"></td>
137 <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
139 <table align=center width="75%"><tr><td>
140 <h4><a name="FT_BitmapGlyphRec">FT_BitmapGlyphRec</a></h4>
141 <table align=center width="87%"><tr><td>
142 Defined in FT_GLYPH_H (freetype/ftglyph.h).
143 </td></tr></table><br>
144 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
146 <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_BitmapGlyphRec_
148 <a href="ft2-glyph_management.html#FT_GlyphRec">FT_GlyphRec</a> root;
149 <a href="ft2-basic_types.html#FT_Int">FT_Int</a> left;
150 <a href="ft2-basic_types.html#FT_Int">FT_Int</a> top;
151 <a href="ft2-basic_types.html#FT_Bitmap">FT_Bitmap</a> bitmap;
153 } <b>FT_BitmapGlyphRec</b>;
156 <table align=center width="87%"><tr><td>
157 <p>A structure used for bitmap glyph images. This really is a ‘sub-class’ of <a href="ft2-glyph_management.html#FT_GlyphRec">FT_GlyphRec</a>.</p>
158 </td></tr></table><br>
159 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>fields</b></em></td></tr><tr><td>
161 <table cellpadding=3 border=0>
162 <tr valign=top><td><b>root</b></td><td>
163 <p>The root <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a> fields.</p>
165 <tr valign=top><td><b>left</b></td><td>
166 <p>The left-side bearing, i.e., the horizontal distance from the current pen position to the left border of the glyph bitmap.</p>
168 <tr valign=top><td><b>top</b></td><td>
169 <p>The top-side bearing, i.e., the vertical distance from the current pen position to the top border of the glyph bitmap. This distance is positive for upwards y!</p>
171 <tr valign=top><td><b>bitmap</b></td><td>
172 <p>A descriptor for the bitmap.</p>
176 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td>
177 <p>You can typecast an <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a> to <a href="ft2-glyph_management.html#FT_BitmapGlyph">FT_BitmapGlyph</a> if you have ‘glyph->format == FT_GLYPH_FORMAT_BITMAP’. This lets you access the bitmap's contents easily.</p>
178 <p>The corresponding pixel buffer is always owned by <a href="ft2-glyph_management.html#FT_BitmapGlyph">FT_BitmapGlyph</a> and is thus created and destroyed with it.</p>
182 <table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
183 <td width="100%"></td>
184 <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
186 <table align=center width="75%"><tr><td>
187 <h4><a name="FT_OutlineGlyph">FT_OutlineGlyph</a></h4>
188 <table align=center width="87%"><tr><td>
189 Defined in FT_GLYPH_H (freetype/ftglyph.h).
190 </td></tr></table><br>
191 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
193 <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_OutlineGlyphRec_* <b>FT_OutlineGlyph</b>;
196 <table align=center width="87%"><tr><td>
197 <p>A handle to an object used to model an outline glyph image. This is a sub-class of <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a>, and a pointer to <a href="ft2-glyph_management.html#FT_OutlineGlyphRec">FT_OutlineGlyphRec</a>.</p>
198 </td></tr></table><br>
201 <table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
202 <td width="100%"></td>
203 <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
205 <table align=center width="75%"><tr><td>
206 <h4><a name="FT_OutlineGlyphRec">FT_OutlineGlyphRec</a></h4>
207 <table align=center width="87%"><tr><td>
208 Defined in FT_GLYPH_H (freetype/ftglyph.h).
209 </td></tr></table><br>
210 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
212 <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_OutlineGlyphRec_
214 <a href="ft2-glyph_management.html#FT_GlyphRec">FT_GlyphRec</a> root;
215 <a href="ft2-outline_processing.html#FT_Outline">FT_Outline</a> outline;
217 } <b>FT_OutlineGlyphRec</b>;
220 <table align=center width="87%"><tr><td>
221 <p>A structure used for outline (vectorial) glyph images. This really is a ‘sub-class’ of <a href="ft2-glyph_management.html#FT_GlyphRec">FT_GlyphRec</a>.</p>
222 </td></tr></table><br>
223 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>fields</b></em></td></tr><tr><td>
225 <table cellpadding=3 border=0>
226 <tr valign=top><td><b>root</b></td><td>
227 <p>The root <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a> fields.</p>
229 <tr valign=top><td><b>outline</b></td><td>
230 <p>A descriptor for the outline.</p>
234 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td>
235 <p>You can typecast an <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a> to <a href="ft2-glyph_management.html#FT_OutlineGlyph">FT_OutlineGlyph</a> if you have ‘glyph->format == FT_GLYPH_FORMAT_OUTLINE’. This lets you access the outline's content easily.</p>
236 <p>As the outline is extracted from a glyph slot, its coordinates are expressed normally in 26.6 pixels, unless the flag <a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_NO_SCALE</a> was used in <a href="ft2-base_interface.html#FT_Load_Glyph">FT_Load_Glyph</a>() or <a href="ft2-base_interface.html#FT_Load_Char">FT_Load_Char</a>().</p>
237 <p>The outline's tables are always owned by the object and are destroyed with it.</p>
241 <table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
242 <td width="100%"></td>
243 <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
245 <table align=center width="75%"><tr><td>
246 <h4><a name="FT_Get_Glyph">FT_Get_Glyph</a></h4>
247 <table align=center width="87%"><tr><td>
248 Defined in FT_GLYPH_H (freetype/ftglyph.h).
249 </td></tr></table><br>
250 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
252 FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> )
253 <b>FT_Get_Glyph</b>( <a href="ft2-base_interface.html#FT_GlyphSlot">FT_GlyphSlot</a> slot,
254 <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a> *aglyph );
257 <table align=center width="87%"><tr><td>
258 <p>A function used to extract a glyph image from a slot. Note that the created <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a> object must be released with <a href="ft2-glyph_management.html#FT_Done_Glyph">FT_Done_Glyph</a>.</p>
259 </td></tr></table><br>
260 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
262 <table cellpadding=3 border=0>
263 <tr valign=top><td><b>slot</b></td><td>
264 <p>A handle to the source glyph slot.</p>
268 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>output</b></em></td></tr><tr><td>
270 <table cellpadding=3 border=0>
271 <tr valign=top><td><b>aglyph</b></td><td>
272 <p>A handle to the glyph object.</p>
276 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
277 <p>FreeType error code. 0 means success.</p>
281 <table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
282 <td width="100%"></td>
283 <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
285 <table align=center width="75%"><tr><td>
286 <h4><a name="FT_Glyph_Copy">FT_Glyph_Copy</a></h4>
287 <table align=center width="87%"><tr><td>
288 Defined in FT_GLYPH_H (freetype/ftglyph.h).
289 </td></tr></table><br>
290 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
292 FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> )
293 <b>FT_Glyph_Copy</b>( <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a> source,
294 <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a> *target );
297 <table align=center width="87%"><tr><td>
298 <p>A function used to copy a glyph image. Note that the created <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a> object must be released with <a href="ft2-glyph_management.html#FT_Done_Glyph">FT_Done_Glyph</a>.</p>
299 </td></tr></table><br>
300 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
302 <table cellpadding=3 border=0>
303 <tr valign=top><td><b>source</b></td><td>
304 <p>A handle to the source glyph object.</p>
308 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>output</b></em></td></tr><tr><td>
310 <table cellpadding=3 border=0>
311 <tr valign=top><td><b>target</b></td><td>
312 <p>A handle to the target glyph object. 0 in case of error.</p>
316 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
317 <p>FreeType error code. 0 means success.</p>
321 <table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
322 <td width="100%"></td>
323 <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
325 <table align=center width="75%"><tr><td>
326 <h4><a name="FT_Glyph_Transform">FT_Glyph_Transform</a></h4>
327 <table align=center width="87%"><tr><td>
328 Defined in FT_GLYPH_H (freetype/ftglyph.h).
329 </td></tr></table><br>
330 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
332 FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> )
333 <b>FT_Glyph_Transform</b>( <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a> glyph,
334 <a href="ft2-basic_types.html#FT_Matrix">FT_Matrix</a>* matrix,
335 <a href="ft2-basic_types.html#FT_Vector">FT_Vector</a>* delta );
338 <table align=center width="87%"><tr><td>
339 <p>Transform a glyph image if its format is scalable.</p>
340 </td></tr></table><br>
341 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>inout</b></em></td></tr><tr><td>
343 <table cellpadding=3 border=0>
344 <tr valign=top><td><b>glyph</b></td><td>
345 <p>A handle to the target glyph object.</p>
349 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
351 <table cellpadding=3 border=0>
352 <tr valign=top><td><b>matrix</b></td><td>
353 <p>A pointer to a 2x2 matrix to apply.</p>
355 <tr valign=top><td><b>delta</b></td><td>
356 <p>A pointer to a 2d vector to apply. Coordinates are expressed in 1/64th of a pixel.</p>
360 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
361 <p>FreeType error code (if not 0, the glyph format is not scalable).</p>
363 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td>
364 <p>The 2x2 transformation matrix is also applied to the glyph's advance vector.</p>
368 <table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
369 <td width="100%"></td>
370 <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
372 <table align=center width="75%"><tr><td>
373 <h4><a name="FT_Glyph_BBox_Mode">FT_Glyph_BBox_Mode</a></h4>
374 <table align=center width="87%"><tr><td>
375 Defined in FT_GLYPH_H (freetype/ftglyph.h).
376 </td></tr></table><br>
377 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
379 <span class="keyword">typedef</span> <span class="keyword">enum</span> FT_Glyph_BBox_Mode_
381 <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_UNSCALED</a> = 0,
382 <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_SUBPIXELS</a> = 0,
383 <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_GRIDFIT</a> = 1,
384 <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_TRUNCATE</a> = 2,
385 <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_PIXELS</a> = 3
387 } <b>FT_Glyph_BBox_Mode</b>;
390 <table align=center width="87%"><tr><td>
391 <p>The mode how the values of <a href="ft2-glyph_management.html#FT_Glyph_Get_CBox">FT_Glyph_Get_CBox</a> are returned.</p>
392 </td></tr></table><br>
393 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>values</b></em></td></tr><tr><td>
395 <table cellpadding=3 border=0>
396 <tr valign=top><td><b>FT_GLYPH_BBOX_UNSCALED</b></td><td>
397 <p>Return unscaled font units.</p>
399 <tr valign=top><td colspan=0><b>FT_GLYPH_BBOX_SUBPIXELS</b></td></tr>
400 <tr valign=top><td></td><td>
401 <p>Return unfitted 26.6 coordinates.</p>
403 <tr valign=top><td><b>FT_GLYPH_BBOX_GRIDFIT</b></td><td>
404 <p>Return grid-fitted 26.6 coordinates.</p>
406 <tr valign=top><td><b>FT_GLYPH_BBOX_TRUNCATE</b></td><td>
407 <p>Return coordinates in integer pixels.</p>
409 <tr valign=top><td><b>FT_GLYPH_BBOX_PIXELS</b></td><td>
410 <p>Return grid-fitted pixel coordinates.</p>
416 <table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
417 <td width="100%"></td>
418 <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
420 <table align=center width="75%"><tr><td>
421 <h4><a name="ft_glyph_bbox_xxx">ft_glyph_bbox_xxx</a></h4>
422 <table align=center width="87%"><tr><td>
423 Defined in FT_GLYPH_H (freetype/ftglyph.h).
424 </td></tr></table><br>
425 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
427 #define <a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_unscaled</a> <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_UNSCALED</a>
428 #define <a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_subpixels</a> <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_SUBPIXELS</a>
429 #define <a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_gridfit</a> <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_GRIDFIT</a>
430 #define <a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_truncate</a> <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_TRUNCATE</a>
431 #define <a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_pixels</a> <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_PIXELS</a>
434 <table align=center width="87%"><tr><td>
435 <p>These constants are deprecated. Use the corresponding <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_Glyph_BBox_Mode</a> values instead.</p>
436 </td></tr></table><br>
437 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>values</b></em></td></tr><tr><td>
439 <table cellpadding=3 border=0>
440 <tr valign=top><td><b>ft_glyph_bbox_unscaled</b></td><td>
441 <p>See <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_UNSCALED</a>.</p>
443 <tr valign=top><td colspan=0><b>ft_glyph_bbox_subpixels</b></td></tr>
444 <tr valign=top><td></td><td>
445 <p>See <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_SUBPIXELS</a>.</p>
447 <tr valign=top><td><b>ft_glyph_bbox_gridfit</b></td><td>
448 <p>See <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_GRIDFIT</a>.</p>
450 <tr valign=top><td><b>ft_glyph_bbox_truncate</b></td><td>
451 <p>See <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_TRUNCATE</a>.</p>
453 <tr valign=top><td><b>ft_glyph_bbox_pixels</b></td><td>
454 <p>See <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_PIXELS</a>.</p>
460 <table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
461 <td width="100%"></td>
462 <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
464 <table align=center width="75%"><tr><td>
465 <h4><a name="FT_Glyph_Get_CBox">FT_Glyph_Get_CBox</a></h4>
466 <table align=center width="87%"><tr><td>
467 Defined in FT_GLYPH_H (freetype/ftglyph.h).
468 </td></tr></table><br>
469 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
471 FT_EXPORT( <span class="keyword">void</span> )
472 <b>FT_Glyph_Get_CBox</b>( <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a> glyph,
473 <a href="ft2-basic_types.html#FT_UInt">FT_UInt</a> bbox_mode,
474 <a href="ft2-basic_types.html#FT_BBox">FT_BBox</a> *acbox );
477 <table align=center width="87%"><tr><td>
478 <p>Return a glyph's ‘control box’. The control box encloses all the outline's points, including Bézier control points. Though it coincides with the exact bounding box for most glyphs, it can be slightly larger in some situations (like when rotating an outline which contains Bézier outside arcs).</p>
479 <p>Computing the control box is very fast, while getting the bounding box can take much more time as it needs to walk over all segments and arcs in the outline. To get the latter, you can use the ‘ftbbox’ component which is dedicated to this single task.</p>
480 </td></tr></table><br>
481 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
483 <table cellpadding=3 border=0>
484 <tr valign=top><td><b>glyph</b></td><td>
485 <p>A handle to the source glyph object.</p>
487 <tr valign=top><td><b>mode</b></td><td>
488 <p>The mode which indicates how to interpret the returned bounding box values.</p>
492 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>output</b></em></td></tr><tr><td>
494 <table cellpadding=3 border=0>
495 <tr valign=top><td><b>acbox</b></td><td>
496 <p>The glyph coordinate bounding box. Coordinates are expressed in 1/64th of pixels if it is grid-fitted.</p>
500 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td>
501 <p>Coordinates are relative to the glyph origin, using the y upwards convention.</p>
502 <p>If the glyph has been loaded with <a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_NO_SCALE</a>, ‘bbox_mode’ must be set to <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_UNSCALED</a> to get unscaled font units in 26.6 pixel format. The value <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_SUBPIXELS</a> is another name for this constant.</p>
503 <p>If the font is tricky and the glyph has been loaded with <a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_NO_SCALE</a>, the resulting CBox is meaningless. To get reasonable values for the CBox it is necessary to load the glyph at a large ppem value (so that the hinting instructions can properly shift and scale the subglyphs), then extracting the CBox which can be eventually converted back to font units.</p>
504 <p>Note that the maximum coordinates are exclusive, which means that one can compute the width and height of the glyph image (be it in integer or 26.6 pixels) as:</p>
505 <pre class="colored">
506 width = bbox.xMax - bbox.xMin;
507 height = bbox.yMax - bbox.yMin;
509 <p>Note also that for 26.6 coordinates, if ‘bbox_mode’ is set to <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_GRIDFIT</a>, the coordinates will also be grid-fitted, which corresponds to:</p>
510 <pre class="colored">
511 bbox.xMin = FLOOR(bbox.xMin);
512 bbox.yMin = FLOOR(bbox.yMin);
513 bbox.xMax = CEILING(bbox.xMax);
514 bbox.yMax = CEILING(bbox.yMax);
516 <p>To get the bbox in pixel coordinates, set ‘bbox_mode’ to <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_TRUNCATE</a>.</p>
517 <p>To get the bbox in grid-fitted pixel coordinates, set ‘bbox_mode’ to <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_PIXELS</a>.</p>
521 <table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
522 <td width="100%"></td>
523 <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
525 <table align=center width="75%"><tr><td>
526 <h4><a name="FT_Glyph_To_Bitmap">FT_Glyph_To_Bitmap</a></h4>
527 <table align=center width="87%"><tr><td>
528 Defined in FT_GLYPH_H (freetype/ftglyph.h).
529 </td></tr></table><br>
530 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
532 FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> )
533 <b>FT_Glyph_To_Bitmap</b>( <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a>* the_glyph,
534 <a href="ft2-base_interface.html#FT_Render_Mode">FT_Render_Mode</a> render_mode,
535 <a href="ft2-basic_types.html#FT_Vector">FT_Vector</a>* origin,
536 <a href="ft2-basic_types.html#FT_Bool">FT_Bool</a> destroy );
539 <table align=center width="87%"><tr><td>
540 <p>Convert a given glyph object to a bitmap glyph object.</p>
541 </td></tr></table><br>
542 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>inout</b></em></td></tr><tr><td>
544 <table cellpadding=3 border=0>
545 <tr valign=top><td><b>the_glyph</b></td><td>
546 <p>A pointer to a handle to the target glyph.</p>
550 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
552 <table cellpadding=3 border=0>
553 <tr valign=top><td><b>render_mode</b></td><td>
554 <p>An enumeration that describes how the data is rendered.</p>
556 <tr valign=top><td><b>origin</b></td><td>
557 <p>A pointer to a vector used to translate the glyph image before rendering. Can be 0 (if no translation). The origin is expressed in 26.6 pixels.</p>
559 <tr valign=top><td><b>destroy</b></td><td>
560 <p>A boolean that indicates that the original glyph image should be destroyed by this function. It is never destroyed in case of error.</p>
564 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
565 <p>FreeType error code. 0 means success.</p>
567 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td>
568 <p>This function does nothing if the glyph format isn't scalable.</p>
569 <p>The glyph image is translated with the ‘origin’ vector before rendering.</p>
570 <p>The first parameter is a pointer to an <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a> handle, that will be <i>replaced</i> by this function (with newly allocated data). Typically, you would use (omitting error handling):</p>
572 <pre class="colored">
574 FT_BitmapGlyph glyph_bitmap;
578 error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAUT );
580 // extract glyph image
581 error = FT_Get_Glyph( face->glyph, &glyph );
583 // convert to a bitmap (default render mode + destroying old)
584 if ( glyph->format != FT_GLYPH_FORMAT_BITMAP )
586 error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL,
588 if ( error ) // `glyph' unchanged
592 // access bitmap content by typecasting
593 glyph_bitmap = (FT_BitmapGlyph)glyph;
595 // do funny stuff with it, like blitting/drawing
598 // discard glyph image (bitmap or not)
599 FT_Done_Glyph( glyph );
602 <p>Here another example, again without error handling:</p>
604 <pre class="colored">
605 FT_Glyph glyphs[MAX_GLYPHS]
610 for ( idx = 0; i < MAX_GLYPHS; i++ )
611 error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) ||
612 FT_Get_Glyph ( face->glyph, &glyph[idx] );
616 for ( idx = 0; i < MAX_GLYPHS; i++ )
618 FT_Glyph bitmap = glyphs[idx];
623 // after this call, `bitmap' no longer points into
624 // the `glyphs' array (and the old value isn't destroyed)
625 FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 );
629 FT_Done_Glyph( bitmap );
634 for ( idx = 0; i < MAX_GLYPHS; i++ )
635 FT_Done_Glyph( glyphs[idx] );
640 <table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
641 <td width="100%"></td>
642 <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
644 <table align=center width="75%"><tr><td>
645 <h4><a name="FT_Done_Glyph">FT_Done_Glyph</a></h4>
646 <table align=center width="87%"><tr><td>
647 Defined in FT_GLYPH_H (freetype/ftglyph.h).
648 </td></tr></table><br>
649 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
651 FT_EXPORT( <span class="keyword">void</span> )
652 <b>FT_Done_Glyph</b>( <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a> glyph );
655 <table align=center width="87%"><tr><td>
656 <p>Destroy a given glyph.</p>
657 </td></tr></table><br>
658 <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
660 <table cellpadding=3 border=0>
661 <tr valign=top><td><b>glyph</b></td><td>
662 <p>A handle to the target glyph object.</p>
668 <table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
669 <td width="100%"></td>
670 <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>