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.5.3 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.5.3 API Reference</h1></center>
44
<table align=center cellspacing=5 cellpadding=0 border=0>
45
<tr><td></td><td><a href="#FT_Memory">FT_Memory</a></td><td></td><td><a href="#FT_MemoryRec">FT_MemoryRec</a></td><td></td><td><a href="#FT_Stream_CloseFunc">FT_Stream_CloseFunc</a></td></tr>
46
<tr><td></td><td><a href="#FT_Alloc_Func">FT_Alloc_Func</a></td><td></td><td><a href="#FT_Stream">FT_Stream</a></td><td></td><td><a href="#FT_StreamRec">FT_StreamRec</a></td></tr>
47
<tr><td></td><td><a href="#FT_Free_Func">FT_Free_Func</a></td><td></td><td><a href="#FT_StreamDesc">FT_StreamDesc</a></td><td></td><td></td></tr>
48
<tr><td></td><td><a href="#FT_Realloc_Func">FT_Realloc_Func</a></td><td></td><td><a href="#FT_Stream_IoFunc">FT_Stream_IoFunc</a></td><td></td><td></td></tr>
51
<table align=center width="87%"><tr><td>
52
<p>This section contains various definitions related to memory management and i/o access. You need to understand this information if you want to use a custom memory manager or you own i/o streams.</p>
53
</td></tr></table><br>
54
<table align=center width="75%"><tr><td>
55
<h4><a name="FT_Memory">FT_Memory</a></h4>
56
<table align=center width="87%"><tr><td>
57
Defined in FT_SYSTEM_H (ftsystem.h).
58
</td></tr></table><br>
59
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
61
<span class="keyword">typedef</span> <span class="keyword">struct</span> FT_MemoryRec_* <b>FT_Memory</b>;
64
<table align=center width="87%"><tr><td>
65
<p>A handle to a given memory manager object, defined with an <a href="ft2-system_interface.html#FT_MemoryRec">FT_MemoryRec</a> structure.</p>
66
</td></tr></table><br>
69
<table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
70
<td width="100%"></td>
71
<td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
73
<table align=center width="75%"><tr><td>
74
<h4><a name="FT_Alloc_Func">FT_Alloc_Func</a></h4>
75
<table align=center width="87%"><tr><td>
76
Defined in FT_SYSTEM_H (ftsystem.h).
77
</td></tr></table><br>
78
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
80
<span class="keyword">typedef</span> <span class="keyword">void</span>*
81
(*<b>FT_Alloc_Func</b>)( <a href="ft2-system_interface.html#FT_Memory">FT_Memory</a> memory,
82
<span class="keyword">long</span> size );
85
<table align=center width="87%"><tr><td>
86
<p>A function used to allocate ‘size’ bytes from ‘memory’.</p>
87
</td></tr></table><br>
88
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
90
<table cellpadding=3 border=0>
91
<tr valign=top><td><b>memory</b></td><td>
92
<p>A handle to the source memory manager.</p>
94
<tr valign=top><td><b>size</b></td><td>
95
<p>The size in bytes to allocate.</p>
99
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
100
<p>Address of new memory block. 0 in case of failure.</p>
104
<table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
105
<td width="100%"></td>
106
<td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
108
<table align=center width="75%"><tr><td>
109
<h4><a name="FT_Free_Func">FT_Free_Func</a></h4>
110
<table align=center width="87%"><tr><td>
111
Defined in FT_SYSTEM_H (ftsystem.h).
112
</td></tr></table><br>
113
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
115
<span class="keyword">typedef</span> <span class="keyword">void</span>
116
(*<b>FT_Free_Func</b>)( <a href="ft2-system_interface.html#FT_Memory">FT_Memory</a> memory,
117
<span class="keyword">void</span>* block );
120
<table align=center width="87%"><tr><td>
121
<p>A function used to release a given block of memory.</p>
122
</td></tr></table><br>
123
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
125
<table cellpadding=3 border=0>
126
<tr valign=top><td><b>memory</b></td><td>
127
<p>A handle to the source memory manager.</p>
129
<tr valign=top><td><b>block</b></td><td>
130
<p>The address of the target memory block.</p>
136
<table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
137
<td width="100%"></td>
138
<td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
140
<table align=center width="75%"><tr><td>
141
<h4><a name="FT_Realloc_Func">FT_Realloc_Func</a></h4>
142
<table align=center width="87%"><tr><td>
143
Defined in FT_SYSTEM_H (ftsystem.h).
144
</td></tr></table><br>
145
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
147
<span class="keyword">typedef</span> <span class="keyword">void</span>*
148
(*<b>FT_Realloc_Func</b>)( <a href="ft2-system_interface.html#FT_Memory">FT_Memory</a> memory,
149
<span class="keyword">long</span> cur_size,
150
<span class="keyword">long</span> new_size,
151
<span class="keyword">void</span>* block );
154
<table align=center width="87%"><tr><td>
155
<p>A function used to re-allocate a given block of memory.</p>
156
</td></tr></table><br>
157
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
159
<table cellpadding=3 border=0>
160
<tr valign=top><td><b>memory</b></td><td>
161
<p>A handle to the source memory manager.</p>
163
<tr valign=top><td><b>cur_size</b></td><td>
164
<p>The block's current size in bytes.</p>
166
<tr valign=top><td><b>new_size</b></td><td>
167
<p>The block's requested new size.</p>
169
<tr valign=top><td><b>block</b></td><td>
170
<p>The block's current address.</p>
174
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
175
<p>New block address. 0 in case of memory shortage.</p>
177
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td>
178
<p>In case of error, the old block must still be available.</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_MemoryRec">FT_MemoryRec</a></h4>
188
<table align=center width="87%"><tr><td>
189
Defined in FT_SYSTEM_H (ftsystem.h).
190
</td></tr></table><br>
191
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
193
<span class="keyword">struct</span> FT_MemoryRec_
195
<span class="keyword">void</span>* user;
196
<a href="ft2-system_interface.html#FT_Alloc_Func">FT_Alloc_Func</a> alloc;
197
<a href="ft2-system_interface.html#FT_Free_Func">FT_Free_Func</a> free;
198
<a href="ft2-system_interface.html#FT_Realloc_Func">FT_Realloc_Func</a> realloc;
202
<table align=center width="87%"><tr><td>
203
<p>A structure used to describe a given memory manager to FreeType 2.</p>
204
</td></tr></table><br>
205
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>fields</b></em></td></tr><tr><td>
207
<table cellpadding=3 border=0>
208
<tr valign=top><td><b>user</b></td><td>
209
<p>A generic typeless pointer for user data.</p>
211
<tr valign=top><td><b>alloc</b></td><td>
212
<p>A pointer type to an allocation function.</p>
214
<tr valign=top><td><b>free</b></td><td>
215
<p>A pointer type to an memory freeing function.</p>
217
<tr valign=top><td><b>realloc</b></td><td>
218
<p>A pointer type to a reallocation function.</p>
224
<table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
225
<td width="100%"></td>
226
<td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
228
<table align=center width="75%"><tr><td>
229
<h4><a name="FT_Stream">FT_Stream</a></h4>
230
<table align=center width="87%"><tr><td>
231
Defined in FT_SYSTEM_H (ftsystem.h).
232
</td></tr></table><br>
233
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
235
<span class="keyword">typedef</span> <span class="keyword">struct</span> FT_StreamRec_* <b>FT_Stream</b>;
238
<table align=center width="87%"><tr><td>
239
<p>A handle to an input stream.</p>
240
</td></tr></table><br>
243
<table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
244
<td width="100%"></td>
245
<td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
247
<table align=center width="75%"><tr><td>
248
<h4><a name="FT_StreamDesc">FT_StreamDesc</a></h4>
249
<table align=center width="87%"><tr><td>
250
Defined in FT_SYSTEM_H (ftsystem.h).
251
</td></tr></table><br>
252
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
254
<span class="keyword">typedef</span> <span class="keyword">union</span> FT_StreamDesc_
256
<span class="keyword">long</span> value;
257
<span class="keyword">void</span>* pointer;
259
} <b>FT_StreamDesc</b>;
262
<table align=center width="87%"><tr><td>
263
<p>A union type used to store either a long or a pointer. This is used to store a file descriptor or a ‘FILE*’ in an input stream.</p>
264
</td></tr></table><br>
267
<table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
268
<td width="100%"></td>
269
<td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
271
<table align=center width="75%"><tr><td>
272
<h4><a name="FT_Stream_IoFunc">FT_Stream_IoFunc</a></h4>
273
<table align=center width="87%"><tr><td>
274
Defined in FT_SYSTEM_H (ftsystem.h).
275
</td></tr></table><br>
276
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
278
<span class="keyword">typedef</span> <span class="keyword">unsigned</span> <span class="keyword">long</span>
279
(*<b>FT_Stream_IoFunc</b>)( <a href="ft2-system_interface.html#FT_Stream">FT_Stream</a> stream,
280
<span class="keyword">unsigned</span> <span class="keyword">long</span> offset,
281
<span class="keyword">unsigned</span> <span class="keyword">char</span>* buffer,
282
<span class="keyword">unsigned</span> <span class="keyword">long</span> count );
285
<table align=center width="87%"><tr><td>
286
<p>A function used to seek and read data from a given input stream.</p>
287
</td></tr></table><br>
288
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
290
<table cellpadding=3 border=0>
291
<tr valign=top><td><b>stream</b></td><td>
292
<p>A handle to the source stream.</p>
294
<tr valign=top><td><b>offset</b></td><td>
295
<p>The offset of read in stream (always from start).</p>
297
<tr valign=top><td><b>buffer</b></td><td>
298
<p>The address of the read buffer.</p>
300
<tr valign=top><td><b>count</b></td><td>
301
<p>The number of bytes to read from the stream.</p>
305
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
306
<p>The number of bytes effectively read by the stream.</p>
308
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td>
309
<p>This function might be called to perform a seek or skip operation with a ‘count’ of 0. A non-zero return value then indicates an error.</p>
313
<table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
314
<td width="100%"></td>
315
<td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
317
<table align=center width="75%"><tr><td>
318
<h4><a name="FT_Stream_CloseFunc">FT_Stream_CloseFunc</a></h4>
319
<table align=center width="87%"><tr><td>
320
Defined in FT_SYSTEM_H (ftsystem.h).
321
</td></tr></table><br>
322
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
324
<span class="keyword">typedef</span> <span class="keyword">void</span>
325
(*<b>FT_Stream_CloseFunc</b>)( <a href="ft2-system_interface.html#FT_Stream">FT_Stream</a> stream );
328
<table align=center width="87%"><tr><td>
329
<p>A function used to close a given input stream.</p>
330
</td></tr></table><br>
331
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
333
<table cellpadding=3 border=0>
334
<tr valign=top><td><b>stream</b></td><td>
335
<p>A handle to the target stream.</p>
341
<table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
342
<td width="100%"></td>
343
<td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
345
<table align=center width="75%"><tr><td>
346
<h4><a name="FT_StreamRec">FT_StreamRec</a></h4>
347
<table align=center width="87%"><tr><td>
348
Defined in FT_SYSTEM_H (ftsystem.h).
349
</td></tr></table><br>
350
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
352
<span class="keyword">typedef</span> <span class="keyword">struct</span> FT_StreamRec_
354
<span class="keyword">unsigned</span> <span class="keyword">char</span>* base;
355
<span class="keyword">unsigned</span> <span class="keyword">long</span> size;
356
<span class="keyword">unsigned</span> <span class="keyword">long</span> pos;
358
<a href="ft2-system_interface.html#FT_StreamDesc">FT_StreamDesc</a> descriptor;
359
<a href="ft2-system_interface.html#FT_StreamDesc">FT_StreamDesc</a> pathname;
360
<a href="ft2-system_interface.html#FT_Stream_IoFunc">FT_Stream_IoFunc</a> read;
361
<a href="ft2-system_interface.html#FT_Stream_CloseFunc">FT_Stream_CloseFunc</a> close;
363
<a href="ft2-system_interface.html#FT_Memory">FT_Memory</a> memory;
364
<span class="keyword">unsigned</span> <span class="keyword">char</span>* cursor;
365
<span class="keyword">unsigned</span> <span class="keyword">char</span>* limit;
367
} <b>FT_StreamRec</b>;
370
<table align=center width="87%"><tr><td>
371
<p>A structure used to describe an input stream.</p>
372
</td></tr></table><br>
373
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
375
<table cellpadding=3 border=0>
376
<tr valign=top><td><b>base</b></td><td>
377
<p>For memory-based streams, this is the address of the first stream byte in memory. This field should always be set to NULL for disk-based streams.</p>
379
<tr valign=top><td><b>size</b></td><td>
380
<p>The stream size in bytes.</p>
382
<tr valign=top><td><b>pos</b></td><td>
383
<p>The current position within the stream.</p>
385
<tr valign=top><td><b>descriptor</b></td><td>
386
<p>This field is a union that can hold an integer or a pointer. It is used by stream implementations to store file descriptors or ‘FILE*’ pointers.</p>
388
<tr valign=top><td><b>pathname</b></td><td>
389
<p>This field is completely ignored by FreeType. However, it is often useful during debugging to use it to store the stream's filename (where available).</p>
391
<tr valign=top><td><b>read</b></td><td>
392
<p>The stream's input function.</p>
394
<tr valign=top><td><b>close</b></td><td>
395
<p>The stream's close function.</p>
397
<tr valign=top><td><b>memory</b></td><td>
398
<p>The memory manager to use to preload frames. This is set internally by FreeType and shouldn't be touched by stream implementations.</p>
400
<tr valign=top><td><b>cursor</b></td><td>
401
<p>This field is set and used internally by FreeType when parsing frames.</p>
403
<tr valign=top><td><b>limit</b></td><td>
404
<p>This field is set and used internally by FreeType when parsing frames.</p>
410
<table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td>
411
<td width="100%"></td>
412
<td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>