a7256cb7193415334ce70cf2e31e32edb0e04be5
[framework/graphics/freetype.git] / docs / reference / ft2-system_interface.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
3 <html>
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6 <title>FreeType-2.4.3 API Reference</title>
7 <style type="text/css">
8   body { font-family: Verdana, Geneva, Arial, Helvetica, serif;
9          color: #000000;
10          background: #FFFFFF; }
11
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;
17             text-align: left; }
18
19   a:link { color: #0000EF; }
20   a:visited { color: #51188E; }
21   a:hover { color: #FF0000; }
22
23   span.keyword { font-family: monospace;
24                  text-align: left;
25                  white-space: pre;
26                  color: darkblue; }
27
28   pre.colored { color: blue; }
29
30   ul.empty { list-style-type: none; }
31 </style>
32 </head>
33 <body>
34
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.3 API Reference</h1></center>
39
40 <center><h1>
41 System Interface
42 </h1></center>
43 <h2>Synopsis</h2>
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>
49 </table><br><br>
50
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 (freetype/ftsystem.h).
58 </td></tr></table><br>
59 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
60
61   <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_MemoryRec_*  <b>FT_Memory</b>;
62
63 </pre></table><br>
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>
67 </td></tr></table>
68 <hr width="75%">
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>
72
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 (freetype/ftsystem.h).
77 </td></tr></table><br>
78 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
79
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 );
83
84 </pre></table><br>
85 <table align=center width="87%"><tr><td>
86 <p>A function used to allocate &lsquo;size&rsquo; bytes from &lsquo;memory&rsquo;.</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>
89 <p></p>
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>
93 </td></tr>
94 <tr valign=top><td><b>size</b></td><td>
95 <p>The size in bytes to allocate.</p>
96 </td></tr>
97 </table>
98 </td></tr></table>
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&nbsp;in case of failure.</p>
101 </td></tr></table>
102 </td></tr></table>
103 <hr width="75%">
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>
107
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 (freetype/ftsystem.h).
112 </td></tr></table><br>
113 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
114
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 );
118
119 </pre></table><br>
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>
124 <p></p>
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>
128 </td></tr>
129 <tr valign=top><td><b>block</b></td><td>
130 <p>The address of the target memory block.</p>
131 </td></tr>
132 </table>
133 </td></tr></table>
134 </td></tr></table>
135 <hr width="75%">
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>
139
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 (freetype/ftsystem.h).
144 </td></tr></table><br>
145 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
146
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 );
152
153 </pre></table><br>
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>
158 <p></p>
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>
162 </td></tr>
163 <tr valign=top><td><b>cur_size</b></td><td>
164 <p>The block's current size in bytes.</p>
165 </td></tr>
166 <tr valign=top><td><b>new_size</b></td><td>
167 <p>The block's requested new size.</p>
168 </td></tr>
169 <tr valign=top><td><b>block</b></td><td>
170 <p>The block's current address.</p>
171 </td></tr>
172 </table>
173 </td></tr></table>
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&nbsp;in case of memory shortage.</p>
176 </td></tr></table>
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>
179 </td></tr></table>
180 </td></tr></table>
181 <hr width="75%">
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>
185
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 (freetype/ftsystem.h).
190 </td></tr></table><br>
191 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
192
193   <span class="keyword">struct</span>  FT_MemoryRec_
194   {
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;
199   };
200
201 </pre></table><br>
202 <table align=center width="87%"><tr><td>
203 <p>A structure used to describe a given memory manager to FreeType&nbsp;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>
206 <p></p>
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>
210 </td></tr>
211 <tr valign=top><td><b>alloc</b></td><td>
212 <p>A pointer type to an allocation function.</p>
213 </td></tr>
214 <tr valign=top><td><b>free</b></td><td>
215 <p>A pointer type to an memory freeing function.</p>
216 </td></tr>
217 <tr valign=top><td><b>realloc</b></td><td>
218 <p>A pointer type to a reallocation function.</p>
219 </td></tr>
220 </table>
221 </td></tr></table>
222 </td></tr></table>
223 <hr width="75%">
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>
227
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 (freetype/ftsystem.h).
232 </td></tr></table><br>
233 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
234
235   <span class="keyword">typedef</span> <span class="keyword">struct</span> FT_StreamRec_*  <b>FT_Stream</b>;
236
237 </pre></table><br>
238 <table align=center width="87%"><tr><td>
239 <p>A handle to an input stream.</p>
240 </td></tr></table><br>
241 </td></tr></table>
242 <hr width="75%">
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>
246
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 (freetype/ftsystem.h).
251 </td></tr></table><br>
252 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
253
254   <span class="keyword">typedef</span> <span class="keyword">union</span>  FT_StreamDesc_
255   {
256     <span class="keyword">long</span>   value;
257     <span class="keyword">void</span>*  pointer;
258
259   } <b>FT_StreamDesc</b>;
260
261 </pre></table><br>
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 &lsquo;FILE*&rsquo; in an input stream.</p>
264 </td></tr></table><br>
265 </td></tr></table>
266 <hr width="75%">
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>
270
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 (freetype/ftsystem.h).
275 </td></tr></table><br>
276 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
277
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 );
283
284 </pre></table><br>
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>
289 <p></p>
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>
293 </td></tr>
294 <tr valign=top><td><b>offset</b></td><td>
295 <p>The offset of read in stream (always from start).</p>
296 </td></tr>
297 <tr valign=top><td><b>buffer</b></td><td>
298 <p>The address of the read buffer.</p>
299 </td></tr>
300 <tr valign=top><td><b>count</b></td><td>
301 <p>The number of bytes to read from the stream.</p>
302 </td></tr>
303 </table>
304 </td></tr></table>
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>
307 </td></tr></table>
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 &lsquo;count&rsquo; of&nbsp;0. A non-zero return value then indicates an error.</p>
310 </td></tr></table>
311 </td></tr></table>
312 <hr width="75%">
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>
316
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 (freetype/ftsystem.h).
321 </td></tr></table><br>
322 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
323
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 );
326
327 </pre></table><br>
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>
332 <p></p>
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>
336 </td></tr>
337 </table>
338 </td></tr></table>
339 </td></tr></table>
340 <hr width="75%">
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>
344
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 (freetype/ftsystem.h).
349 </td></tr></table><br>
350 <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>
351
352   <span class="keyword">typedef</span> <span class="keyword">struct</span>  FT_StreamRec_
353   {
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;
357
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;
362
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;
366
367   } <b>FT_StreamRec</b>;
368
369 </pre></table><br>
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>
374 <p></p>
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>
378 </td></tr>
379 <tr valign=top><td><b>size</b></td><td>
380 <p>The stream size in bytes.</p>
381 </td></tr>
382 <tr valign=top><td><b>pos</b></td><td>
383 <p>The current position within the stream.</p>
384 </td></tr>
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 &lsquo;FILE*&rsquo; pointers.</p>
387 </td></tr>
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>
390 </td></tr>
391 <tr valign=top><td><b>read</b></td><td>
392 <p>The stream's input function.</p>
393 </td></tr>
394 <tr valign=top><td><b>close</b></td><td>
395 <p>The stream's close function.</p>
396 </td></tr>
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>
399 </td></tr>
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>
402 </td></tr>
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>
405 </td></tr>
406 </table>
407 </td></tr></table>
408 </td></tr></table>
409 <hr width="75%">
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>
413
414 </body>
415 </html>