4cc074af7b20250648e0cf041748d50e5d3b9115
[platform/upstream/freetype2.git] / docs / reference / ft2-cache_subsystem.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "https://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.9 API Reference</title>
7 <style type="text/css">
8   a:link { color: #0000EF; }
9   a:visited { color: #51188E; }
10   a:hover { color: #FF0000; }
11
12   body { font-family: Verdana, Geneva, Arial, Helvetica, serif;
13          color: #000000;
14          background: #FFFFFF;
15          width: 87%;
16          margin: auto; }
17
18   div.section { width: 75%;
19                 margin: auto; }
20   div.section hr { margin: 4ex 0 1ex 0; }
21   div.section h4 { background-color: #EEEEFF;
22                    font-size: medium;
23                    font-style: oblique;
24                    font-weight: bold;
25                    margin: 3ex 0 1.5ex 9%;
26                    padding: 0.3ex 0 0.3ex 1%; }
27   div.section p { margin: 1.5ex 0 1.5ex 10%; }
28   div.section pre { margin: 3ex 0 3ex 9%;
29                     background-color: #D6E8FF;
30                     padding: 2ex 0 2ex 1%; }
31   div.section table.fields { width: 90%;
32                              margin: 1.5ex 0 1.5ex 10%; }
33   div.section table.toc { width: 95%;
34                           margin: 1.5ex 0 1.5ex 5%; }
35   div.timestamp { text-align: center;
36                   font-size: 69%;
37                   margin: 1.5ex 0 1.5ex 0; }
38
39   h1 { text-align: center; }
40   h3 { font-size: medium;
41        margin: 4ex 0 1.5ex 0; }
42
43   p { text-align: justify; }
44
45   pre.colored { color: blue; }
46
47   span.keyword { font-family: monospace;
48                  text-align: left;
49                  white-space: pre;
50                  color: darkblue; }
51
52   table.fields td.val { font-weight: bold;
53                         text-align: right;
54                         width: 30%;
55                         vertical-align: baseline;
56                         padding: 1ex 1em 1ex 0; }
57   table.fields td.desc { vertical-align: baseline;
58                          padding: 1ex 0 1ex 1em; }
59   table.fields td.desc p:first-child { margin: 0; }
60   table.fields td.desc p { margin: 1.5ex 0 0 0; }
61   table.index { margin: 6ex auto 6ex auto;
62                 border: 0;
63                 border-collapse: separate;
64                 border-spacing: 1em 0.3ex; }
65   table.index tr { padding: 0; }
66   table.index td { padding: 0; }
67   table.index-toc-link { width: 100%;
68                          border: 0;
69                          border-spacing: 0;
70                          margin: 1ex 0 1ex 0; }
71   table.index-toc-link td.left { padding: 0 0.5em 0 0.5em;
72                                  font-size: 83%;
73                                  text-align: left; }
74   table.index-toc-link td.middle { padding: 0 0.5em 0 0.5em;
75                                    font-size: 83%;
76                                    text-align: center; }
77   table.index-toc-link td.right { padding: 0 0.5em 0 0.5em;
78                                   font-size: 83%;
79                                   text-align: right; }
80   table.synopsis { margin: 6ex auto 6ex auto;
81                    border: 0;
82                    border-collapse: separate;
83                    border-spacing: 2em 0.6ex; }
84   table.synopsis tr { padding: 0; }
85   table.synopsis td { padding: 0; }
86   table.toc td.link { width: 30%;
87                       text-align: right;
88                       vertical-align: baseline;
89                       padding: 1ex 1em 1ex 0; }
90   table.toc td.desc { vertical-align: baseline;
91                       padding: 1ex 0 1ex 1em;
92                       text-align: left; }
93   table.toc td.desc p:first-child { margin: 0;
94                                     text-align: left; }
95   table.toc td.desc p { margin: 1.5ex 0 0 0;
96                         text-align: left; }
97
98 </style>
99 </head>
100 <body>
101
102 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table>
103 <h1>FreeType-2.9 API Reference</h1>
104
105 <h1 id="cache_subsystem">Cache Sub-System</h1>
106 <h2>Synopsis</h2>
107 <table class="synopsis">
108 <tr><td><a href="#FTC_Manager">FTC_Manager</a></td><td>&nbsp;</td></tr>
109 <tr><td><a href="#FTC_FaceID">FTC_FaceID</a></td><td><a href="#FTC_SBit">FTC_SBit</a></td></tr>
110 <tr><td><a href="#FTC_Face_Requester">FTC_Face_Requester</a></td><td><a href="#FTC_SBitCache">FTC_SBitCache</a></td></tr>
111 <tr><td>&nbsp;</td><td><a href="#FTC_SBitCache_New">FTC_SBitCache_New</a></td></tr>
112 <tr><td><a href="#FTC_Manager_New">FTC_Manager_New</a></td><td><a href="#FTC_SBitCache_Lookup">FTC_SBitCache_Lookup</a></td></tr>
113 <tr><td><a href="#FTC_Manager_Reset">FTC_Manager_Reset</a></td><td>&nbsp;</td></tr>
114 <tr><td><a href="#FTC_Manager_Done">FTC_Manager_Done</a></td><td><a href="#FTC_CMapCache">FTC_CMapCache</a></td></tr>
115 <tr><td><a href="#FTC_Manager_LookupFace">FTC_Manager_LookupFace</a></td><td><a href="#FTC_CMapCache_New">FTC_CMapCache_New</a></td></tr>
116 <tr><td><a href="#FTC_Manager_LookupSize">FTC_Manager_LookupSize</a></td><td><a href="#FTC_CMapCache_Lookup">FTC_CMapCache_Lookup</a></td></tr>
117 <tr><td><a href="#FTC_Manager_RemoveFaceID">FTC_Manager_RemoveFaceID</a></td><td>&nbsp;</td></tr>
118 <tr><td>&nbsp;</td><td><a href="#FTC_ScalerRec">FTC_ScalerRec</a></td></tr>
119 <tr><td><a href="#FTC_Node">FTC_Node</a></td><td><a href="#FTC_Scaler">FTC_Scaler</a></td></tr>
120 <tr><td><a href="#FTC_Node_Unref">FTC_Node_Unref</a></td><td><a href="#FTC_ImageTypeRec">FTC_ImageTypeRec</a></td></tr>
121 <tr><td>&nbsp;</td><td><a href="#FTC_ImageType">FTC_ImageType</a></td></tr>
122 <tr><td><a href="#FTC_ImageCache">FTC_ImageCache</a></td><td><a href="#FTC_ImageCache_LookupScaler">FTC_ImageCache_LookupScaler</a></td></tr>
123 <tr><td><a href="#FTC_ImageCache_New">FTC_ImageCache_New</a></td><td><a href="#FTC_SBitRec">FTC_SBitRec</a></td></tr>
124 <tr><td><a href="#FTC_ImageCache_Lookup">FTC_ImageCache_Lookup</a></td><td><a href="#FTC_SBitCache_LookupScaler">FTC_SBitCache_LookupScaler</a></td></tr>
125 </table>
126
127
128 <p>This section describes the FreeType&nbsp;2 cache sub-system, which is used to limit the number of concurrently opened <a href="ft2-base_interface.html#FT_Face">FT_Face</a> and <a href="ft2-base_interface.html#FT_Size">FT_Size</a> objects, as well as caching information like character maps and glyph images while limiting their maximum memory usage.</p>
129 <p>Note that all types and functions begin with the &lsquo;FTC_&rsquo; prefix.</p>
130 <p>The cache is highly portable and thus doesn't know anything about the fonts installed on your system, or how to access them. This implies the following scheme:</p>
131 <p>First, available or installed font faces are uniquely identified by <a href="ft2-cache_subsystem.html#FTC_FaceID">FTC_FaceID</a> values, provided to the cache by the client. Note that the cache only stores and compares these values, and doesn't try to interpret them in any way.</p>
132 <p>Second, the cache calls, only when needed, a client-provided function to convert an <a href="ft2-cache_subsystem.html#FTC_FaceID">FTC_FaceID</a> into a new <a href="ft2-base_interface.html#FT_Face">FT_Face</a> object. The latter is then completely managed by the cache, including its termination through <a href="ft2-base_interface.html#FT_Done_Face">FT_Done_Face</a>. To monitor termination of face objects, the finalizer callback in the &lsquo;generic&rsquo; field of the <a href="ft2-base_interface.html#FT_Face">FT_Face</a> object can be used, which might also be used to store the <a href="ft2-cache_subsystem.html#FTC_FaceID">FTC_FaceID</a> of the face.</p>
133 <p>Clients are free to map face IDs to anything else. The most simple usage is to associate them to a (pathname,face_index) pair that is used to call <a href="ft2-base_interface.html#FT_New_Face">FT_New_Face</a>. However, more complex schemes are also possible.</p>
134 <p>Note that for the cache to work correctly, the face ID values must be <b>persistent</b>, which means that the contents they point to should not change at runtime, or that their value should not become invalid.</p>
135 <p>If this is unavoidable (e.g., when a font is uninstalled at runtime), you should call <a href="ft2-cache_subsystem.html#FTC_Manager_RemoveFaceID">FTC_Manager_RemoveFaceID</a> as soon as possible, to let the cache get rid of any references to the old <a href="ft2-cache_subsystem.html#FTC_FaceID">FTC_FaceID</a> it may keep internally. Failure to do so will lead to incorrect behaviour or even crashes.</p>
136 <p>To use the cache, start with calling <a href="ft2-cache_subsystem.html#FTC_Manager_New">FTC_Manager_New</a> to create a new <a href="ft2-cache_subsystem.html#FTC_Manager">FTC_Manager</a> object, which models a single cache instance. You can then look up <a href="ft2-base_interface.html#FT_Face">FT_Face</a> and <a href="ft2-base_interface.html#FT_Size">FT_Size</a> objects with <a href="ft2-cache_subsystem.html#FTC_Manager_LookupFace">FTC_Manager_LookupFace</a> and <a href="ft2-cache_subsystem.html#FTC_Manager_LookupSize">FTC_Manager_LookupSize</a>, respectively.</p>
137 <p>If you want to use the charmap caching, call <a href="ft2-cache_subsystem.html#FTC_CMapCache_New">FTC_CMapCache_New</a>, then later use <a href="ft2-cache_subsystem.html#FTC_CMapCache_Lookup">FTC_CMapCache_Lookup</a> to perform the equivalent of <a href="ft2-base_interface.html#FT_Get_Char_Index">FT_Get_Char_Index</a>, only much faster.</p>
138 <p>If you want to use the <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a> caching, call <a href="ft2-cache_subsystem.html#FTC_ImageCache">FTC_ImageCache</a>, then later use <a href="ft2-cache_subsystem.html#FTC_ImageCache_Lookup">FTC_ImageCache_Lookup</a> to retrieve the corresponding <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a> objects from the cache.</p>
139 <p>If you need lots of small bitmaps, it is much more memory efficient to call <a href="ft2-cache_subsystem.html#FTC_SBitCache_New">FTC_SBitCache_New</a> followed by <a href="ft2-cache_subsystem.html#FTC_SBitCache_Lookup">FTC_SBitCache_Lookup</a>. This returns <a href="ft2-cache_subsystem.html#FTC_SBitRec">FTC_SBitRec</a> structures, which are used to store small bitmaps directly. (A small bitmap is one whose metrics and dimensions all fit into 8-bit integers).</p>
140 <p>We hope to also provide a kerning cache in the near future.</p>
141
142 <div class="section">
143 <h3 id="FTC_Manager">FTC_Manager</h3>
144 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
145 <pre>
146   <span class="keyword">typedef</span> <span class="keyword">struct</span> FTC_ManagerRec_*  <b>FTC_Manager</b>;
147 </pre>
148
149 <p>This object corresponds to one instance of the cache-subsystem. It is used to cache one or more <a href="ft2-base_interface.html#FT_Face">FT_Face</a> objects, along with corresponding <a href="ft2-base_interface.html#FT_Size">FT_Size</a> objects.</p>
150 <p>The manager intentionally limits the total number of opened <a href="ft2-base_interface.html#FT_Face">FT_Face</a> and <a href="ft2-base_interface.html#FT_Size">FT_Size</a> objects to control memory usage. See the &lsquo;max_faces&rsquo; and &lsquo;max_sizes&rsquo; parameters of <a href="ft2-cache_subsystem.html#FTC_Manager_New">FTC_Manager_New</a>.</p>
151 <p>The manager is also used to cache &lsquo;nodes&rsquo; of various types while limiting their total memory usage.</p>
152 <p>All limitations are enforced by keeping lists of managed objects in most-recently-used order, and flushing old nodes to make room for new ones.</p>
153
154 <hr>
155 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
156
157 <div class="section">
158 <h3 id="FTC_FaceID">FTC_FaceID</h3>
159 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
160 <pre>
161   <span class="keyword">typedef</span> <a href="ft2-basic_types.html#FT_Pointer">FT_Pointer</a>  <b>FTC_FaceID</b>;
162 </pre>
163
164 <p>An opaque pointer type that is used to identity face objects. The contents of such objects is application-dependent.</p>
165 <p>These pointers are typically used to point to a user-defined structure containing a font file path, and face index.</p>
166
167 <h4>note</h4>
168 <p>Never use NULL as a valid <a href="ft2-cache_subsystem.html#FTC_FaceID">FTC_FaceID</a>.</p>
169 <p>Face IDs are passed by the client to the cache manager that calls, when needed, the <a href="ft2-cache_subsystem.html#FTC_Face_Requester">FTC_Face_Requester</a> to translate them into new <a href="ft2-base_interface.html#FT_Face">FT_Face</a> objects.</p>
170 <p>If the content of a given face ID changes at runtime, or if the value becomes invalid (e.g., when uninstalling a font), you should immediately call <a href="ft2-cache_subsystem.html#FTC_Manager_RemoveFaceID">FTC_Manager_RemoveFaceID</a> before any other cache function.</p>
171 <p>Failure to do so will result in incorrect behaviour or even memory leaks and crashes.</p>
172
173 <hr>
174 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
175
176 <div class="section">
177 <h3 id="FTC_Face_Requester">FTC_Face_Requester</h3>
178 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
179 <pre>
180   <span class="keyword">typedef</span> <a href="ft2-basic_types.html#FT_Error">FT_Error</a>
181   (*<b>FTC_Face_Requester</b>)( <a href="ft2-cache_subsystem.html#FTC_FaceID">FTC_FaceID</a>  face_id,
182                          <a href="ft2-base_interface.html#FT_Library">FT_Library</a>  library,
183                          <a href="ft2-basic_types.html#FT_Pointer">FT_Pointer</a>  req_data,
184                          <a href="ft2-base_interface.html#FT_Face">FT_Face</a>*    aface );
185 </pre>
186
187 <p>A callback function provided by client applications. It is used by the cache manager to translate a given <a href="ft2-cache_subsystem.html#FTC_FaceID">FTC_FaceID</a> into a new valid <a href="ft2-base_interface.html#FT_Face">FT_Face</a> object, on demand.</p>
188
189 <h4>input</h4>
190 <table class="fields">
191 <tr><td class="val" id="face_id">face_id</td><td class="desc">
192 <p>The face ID to resolve.</p>
193 </td></tr>
194 <tr><td class="val" id="library">library</td><td class="desc">
195 <p>A handle to a FreeType library object.</p>
196 </td></tr>
197 <tr><td class="val" id="req_data">req_data</td><td class="desc">
198 <p>Application-provided request data (see note below).</p>
199 </td></tr>
200 </table>
201
202 <h4>output</h4>
203 <table class="fields">
204 <tr><td class="val" id="aface">aface</td><td class="desc">
205 <p>A new <a href="ft2-base_interface.html#FT_Face">FT_Face</a> handle.</p>
206 </td></tr>
207 </table>
208
209 <h4>return</h4>
210 <p>FreeType error code. 0&nbsp;means success.</p>
211
212 <h4>note</h4>
213 <p>The third parameter &lsquo;req_data&rsquo; is the same as the one passed by the client when <a href="ft2-cache_subsystem.html#FTC_Manager_New">FTC_Manager_New</a> is called.</p>
214 <p>The face requester should not perform funny things on the returned face object, like creating a new <a href="ft2-base_interface.html#FT_Size">FT_Size</a> for it, or setting a transformation through <a href="ft2-base_interface.html#FT_Set_Transform">FT_Set_Transform</a>!</p>
215
216 <hr>
217 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
218
219 <div class="section">
220 <h3 id="FTC_Manager_New">FTC_Manager_New</h3>
221 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
222 <pre>
223   FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> )
224   <b>FTC_Manager_New</b>( <a href="ft2-base_interface.html#FT_Library">FT_Library</a>          library,
225                    <a href="ft2-basic_types.html#FT_UInt">FT_UInt</a>             max_faces,
226                    <a href="ft2-basic_types.html#FT_UInt">FT_UInt</a>             max_sizes,
227                    <a href="ft2-basic_types.html#FT_ULong">FT_ULong</a>            max_bytes,
228                    <a href="ft2-cache_subsystem.html#FTC_Face_Requester">FTC_Face_Requester</a>  requester,
229                    <a href="ft2-basic_types.html#FT_Pointer">FT_Pointer</a>          req_data,
230                    <a href="ft2-cache_subsystem.html#FTC_Manager">FTC_Manager</a>        *amanager );
231 </pre>
232
233 <p>Create a new cache manager.</p>
234
235 <h4>input</h4>
236 <table class="fields">
237 <tr><td class="val" id="library">library</td><td class="desc">
238 <p>The parent FreeType library handle to use.</p>
239 </td></tr>
240 <tr><td class="val" id="max_faces">max_faces</td><td class="desc">
241 <p>Maximum number of opened <a href="ft2-base_interface.html#FT_Face">FT_Face</a> objects managed by this cache instance. Use&nbsp;0 for defaults.</p>
242 </td></tr>
243 <tr><td class="val" id="max_sizes">max_sizes</td><td class="desc">
244 <p>Maximum number of opened <a href="ft2-base_interface.html#FT_Size">FT_Size</a> objects managed by this cache instance. Use&nbsp;0 for defaults.</p>
245 </td></tr>
246 <tr><td class="val" id="max_bytes">max_bytes</td><td class="desc">
247 <p>Maximum number of bytes to use for cached data nodes. Use&nbsp;0 for defaults. Note that this value does not account for managed <a href="ft2-base_interface.html#FT_Face">FT_Face</a> and <a href="ft2-base_interface.html#FT_Size">FT_Size</a> objects.</p>
248 </td></tr>
249 <tr><td class="val" id="requester">requester</td><td class="desc">
250 <p>An application-provided callback used to translate face IDs into real <a href="ft2-base_interface.html#FT_Face">FT_Face</a> objects.</p>
251 </td></tr>
252 <tr><td class="val" id="req_data">req_data</td><td class="desc">
253 <p>A generic pointer that is passed to the requester each time it is called (see <a href="ft2-cache_subsystem.html#FTC_Face_Requester">FTC_Face_Requester</a>).</p>
254 </td></tr>
255 </table>
256
257 <h4>output</h4>
258 <table class="fields">
259 <tr><td class="val" id="amanager">amanager</td><td class="desc">
260 <p>A handle to a new manager object. 0&nbsp;in case of failure.</p>
261 </td></tr>
262 </table>
263
264 <h4>return</h4>
265 <p>FreeType error code. 0&nbsp;means success.</p>
266
267 <hr>
268 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
269
270 <div class="section">
271 <h3 id="FTC_Manager_Reset">FTC_Manager_Reset</h3>
272 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
273 <pre>
274   FT_EXPORT( <span class="keyword">void</span> )
275   <b>FTC_Manager_Reset</b>( <a href="ft2-cache_subsystem.html#FTC_Manager">FTC_Manager</a>  manager );
276 </pre>
277
278 <p>Empty a given cache manager. This simply gets rid of all the currently cached <a href="ft2-base_interface.html#FT_Face">FT_Face</a> and <a href="ft2-base_interface.html#FT_Size">FT_Size</a> objects within the manager.</p>
279
280 <h4>inout</h4>
281 <table class="fields">
282 <tr><td class="val" id="manager">manager</td><td class="desc">
283 <p>A handle to the manager.</p>
284 </td></tr>
285 </table>
286
287 <hr>
288 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
289
290 <div class="section">
291 <h3 id="FTC_Manager_Done">FTC_Manager_Done</h3>
292 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
293 <pre>
294   FT_EXPORT( <span class="keyword">void</span> )
295   <b>FTC_Manager_Done</b>( <a href="ft2-cache_subsystem.html#FTC_Manager">FTC_Manager</a>  manager );
296 </pre>
297
298 <p>Destroy a given manager after emptying it.</p>
299
300 <h4>input</h4>
301 <table class="fields">
302 <tr><td class="val" id="manager">manager</td><td class="desc">
303 <p>A handle to the target cache manager object.</p>
304 </td></tr>
305 </table>
306
307 <hr>
308 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
309
310 <div class="section">
311 <h3 id="FTC_Manager_LookupFace">FTC_Manager_LookupFace</h3>
312 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
313 <pre>
314   FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> )
315   <b>FTC_Manager_LookupFace</b>( <a href="ft2-cache_subsystem.html#FTC_Manager">FTC_Manager</a>  manager,
316                           <a href="ft2-cache_subsystem.html#FTC_FaceID">FTC_FaceID</a>   face_id,
317                           <a href="ft2-base_interface.html#FT_Face">FT_Face</a>     *aface );
318 </pre>
319
320 <p>Retrieve the <a href="ft2-base_interface.html#FT_Face">FT_Face</a> object that corresponds to a given face ID through a cache manager.</p>
321
322 <h4>input</h4>
323 <table class="fields">
324 <tr><td class="val" id="manager">manager</td><td class="desc">
325 <p>A handle to the cache manager.</p>
326 </td></tr>
327 <tr><td class="val" id="face_id">face_id</td><td class="desc">
328 <p>The ID of the face object.</p>
329 </td></tr>
330 </table>
331
332 <h4>output</h4>
333 <table class="fields">
334 <tr><td class="val" id="aface">aface</td><td class="desc">
335 <p>A handle to the face object.</p>
336 </td></tr>
337 </table>
338
339 <h4>return</h4>
340 <p>FreeType error code. 0&nbsp;means success.</p>
341
342 <h4>note</h4>
343 <p>The returned <a href="ft2-base_interface.html#FT_Face">FT_Face</a> object is always owned by the manager. You should never try to discard it yourself.</p>
344 <p>The <a href="ft2-base_interface.html#FT_Face">FT_Face</a> object doesn't necessarily have a current size object (i.e., face-&gt;size can be&nbsp;0). If you need a specific &lsquo;font size&rsquo;, use <a href="ft2-cache_subsystem.html#FTC_Manager_LookupSize">FTC_Manager_LookupSize</a> instead.</p>
345 <p>Never change the face's transformation matrix (i.e., never call the <a href="ft2-base_interface.html#FT_Set_Transform">FT_Set_Transform</a> function) on a returned face! If you need to transform glyphs, do it yourself after glyph loading.</p>
346 <p>When you perform a lookup, out-of-memory errors are detected <i>within</i> the lookup and force incremental flushes of the cache until enough memory is released for the lookup to succeed.</p>
347 <p>If a lookup fails with &lsquo;FT_Err_Out_Of_Memory&rsquo; the cache has already been completely flushed, and still no memory was available for the operation.</p>
348
349 <hr>
350 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
351
352 <div class="section">
353 <h3 id="FTC_Manager_LookupSize">FTC_Manager_LookupSize</h3>
354 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
355 <pre>
356   FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> )
357   <b>FTC_Manager_LookupSize</b>( <a href="ft2-cache_subsystem.html#FTC_Manager">FTC_Manager</a>  manager,
358                           <a href="ft2-cache_subsystem.html#FTC_Scaler">FTC_Scaler</a>   scaler,
359                           <a href="ft2-base_interface.html#FT_Size">FT_Size</a>     *asize );
360 </pre>
361
362 <p>Retrieve the <a href="ft2-base_interface.html#FT_Size">FT_Size</a> object that corresponds to a given <a href="ft2-cache_subsystem.html#FTC_ScalerRec">FTC_ScalerRec</a> pointer through a cache manager.</p>
363
364 <h4>input</h4>
365 <table class="fields">
366 <tr><td class="val" id="manager">manager</td><td class="desc">
367 <p>A handle to the cache manager.</p>
368 </td></tr>
369 <tr><td class="val" id="scaler">scaler</td><td class="desc">
370 <p>A scaler handle.</p>
371 </td></tr>
372 </table>
373
374 <h4>output</h4>
375 <table class="fields">
376 <tr><td class="val" id="asize">asize</td><td class="desc">
377 <p>A handle to the size object.</p>
378 </td></tr>
379 </table>
380
381 <h4>return</h4>
382 <p>FreeType error code. 0&nbsp;means success.</p>
383
384 <h4>note</h4>
385 <p>The returned <a href="ft2-base_interface.html#FT_Size">FT_Size</a> object is always owned by the manager. You should never try to discard it by yourself.</p>
386 <p>You can access the parent <a href="ft2-base_interface.html#FT_Face">FT_Face</a> object simply as &lsquo;size-&gt;face&rsquo; if you need it. Note that this object is also owned by the manager.</p>
387
388 <h4>note</h4>
389 <p>When you perform a lookup, out-of-memory errors are detected <i>within</i> the lookup and force incremental flushes of the cache until enough memory is released for the lookup to succeed.</p>
390 <p>If a lookup fails with &lsquo;FT_Err_Out_Of_Memory&rsquo; the cache has already been completely flushed, and still no memory is available for the operation.</p>
391
392 <hr>
393 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
394
395 <div class="section">
396 <h3 id="FTC_Manager_RemoveFaceID">FTC_Manager_RemoveFaceID</h3>
397 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
398 <pre>
399   FT_EXPORT( <span class="keyword">void</span> )
400   <b>FTC_Manager_RemoveFaceID</b>( <a href="ft2-cache_subsystem.html#FTC_Manager">FTC_Manager</a>  manager,
401                             <a href="ft2-cache_subsystem.html#FTC_FaceID">FTC_FaceID</a>   face_id );
402 </pre>
403
404 <p>A special function used to indicate to the cache manager that a given <a href="ft2-cache_subsystem.html#FTC_FaceID">FTC_FaceID</a> is no longer valid, either because its content changed, or because it was deallocated or uninstalled.</p>
405
406 <h4>input</h4>
407 <table class="fields">
408 <tr><td class="val" id="manager">manager</td><td class="desc">
409 <p>The cache manager handle.</p>
410 </td></tr>
411 <tr><td class="val" id="face_id">face_id</td><td class="desc">
412 <p>The <a href="ft2-cache_subsystem.html#FTC_FaceID">FTC_FaceID</a> to be removed.</p>
413 </td></tr>
414 </table>
415
416 <h4>note</h4>
417 <p>This function flushes all nodes from the cache corresponding to this &lsquo;face_id&rsquo;, with the exception of nodes with a non-null reference count.</p>
418 <p>Such nodes are however modified internally so as to never appear in later lookups with the same &lsquo;face_id&rsquo; value, and to be immediately destroyed when released by all their users.</p>
419
420 <hr>
421 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
422
423 <div class="section">
424 <h3 id="FTC_Node">FTC_Node</h3>
425 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
426 <pre>
427   <span class="keyword">typedef</span> <span class="keyword">struct</span> FTC_NodeRec_*  <b>FTC_Node</b>;
428 </pre>
429
430 <p>An opaque handle to a cache node object. Each cache node is reference-counted. A node with a count of&nbsp;0 might be flushed out of a full cache whenever a lookup request is performed.</p>
431 <p>If you look up nodes, you have the ability to &lsquo;acquire&rsquo; them, i.e., to increment their reference count. This will prevent the node from being flushed out of the cache until you explicitly &lsquo;release&rsquo; it (see <a href="ft2-cache_subsystem.html#FTC_Node_Unref">FTC_Node_Unref</a>).</p>
432 <p>See also <a href="ft2-cache_subsystem.html#FTC_SBitCache_Lookup">FTC_SBitCache_Lookup</a> and <a href="ft2-cache_subsystem.html#FTC_ImageCache_Lookup">FTC_ImageCache_Lookup</a>.</p>
433
434 <hr>
435 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
436
437 <div class="section">
438 <h3 id="FTC_Node_Unref">FTC_Node_Unref</h3>
439 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
440 <pre>
441   FT_EXPORT( <span class="keyword">void</span> )
442   <b>FTC_Node_Unref</b>( <a href="ft2-cache_subsystem.html#FTC_Node">FTC_Node</a>     node,
443                   <a href="ft2-cache_subsystem.html#FTC_Manager">FTC_Manager</a>  manager );
444 </pre>
445
446 <p>Decrement a cache node's internal reference count. When the count reaches 0, it is not destroyed but becomes eligible for subsequent cache flushes.</p>
447
448 <h4>input</h4>
449 <table class="fields">
450 <tr><td class="val" id="node">node</td><td class="desc">
451 <p>The cache node handle.</p>
452 </td></tr>
453 <tr><td class="val" id="manager">manager</td><td class="desc">
454 <p>The cache manager handle.</p>
455 </td></tr>
456 </table>
457
458 <hr>
459 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
460
461 <div class="section">
462 <h3 id="FTC_ImageCache">FTC_ImageCache</h3>
463 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
464 <pre>
465   <span class="keyword">typedef</span> <span class="keyword">struct</span> FTC_ImageCacheRec_*  <b>FTC_ImageCache</b>;
466 </pre>
467
468 <p>A handle to a glyph image cache object. They are designed to hold many distinct glyph images while not exceeding a certain memory threshold.</p>
469
470 <hr>
471 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
472
473 <div class="section">
474 <h3 id="FTC_ImageCache_New">FTC_ImageCache_New</h3>
475 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
476 <pre>
477   FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> )
478   <b>FTC_ImageCache_New</b>( <a href="ft2-cache_subsystem.html#FTC_Manager">FTC_Manager</a>      manager,
479                       <a href="ft2-cache_subsystem.html#FTC_ImageCache">FTC_ImageCache</a>  *acache );
480 </pre>
481
482 <p>Create a new glyph image cache.</p>
483
484 <h4>input</h4>
485 <table class="fields">
486 <tr><td class="val" id="manager">manager</td><td class="desc">
487 <p>The parent manager for the image cache.</p>
488 </td></tr>
489 </table>
490
491 <h4>output</h4>
492 <table class="fields">
493 <tr><td class="val" id="acache">acache</td><td class="desc">
494 <p>A handle to the new glyph image cache object.</p>
495 </td></tr>
496 </table>
497
498 <h4>return</h4>
499 <p>FreeType error code. 0&nbsp;means success.</p>
500
501 <hr>
502 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
503
504 <div class="section">
505 <h3 id="FTC_ImageCache_Lookup">FTC_ImageCache_Lookup</h3>
506 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
507 <pre>
508   FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> )
509   <b>FTC_ImageCache_Lookup</b>( <a href="ft2-cache_subsystem.html#FTC_ImageCache">FTC_ImageCache</a>  cache,
510                          <a href="ft2-cache_subsystem.html#FTC_ImageType">FTC_ImageType</a>   type,
511                          <a href="ft2-basic_types.html#FT_UInt">FT_UInt</a>         gindex,
512                          <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a>       *aglyph,
513                          <a href="ft2-cache_subsystem.html#FTC_Node">FTC_Node</a>       *anode );
514 </pre>
515
516 <p>Retrieve a given glyph image from a glyph image cache.</p>
517
518 <h4>input</h4>
519 <table class="fields">
520 <tr><td class="val" id="cache">cache</td><td class="desc">
521 <p>A handle to the source glyph image cache.</p>
522 </td></tr>
523 <tr><td class="val" id="type">type</td><td class="desc">
524 <p>A pointer to a glyph image type descriptor.</p>
525 </td></tr>
526 <tr><td class="val" id="gindex">gindex</td><td class="desc">
527 <p>The glyph index to retrieve.</p>
528 </td></tr>
529 </table>
530
531 <h4>output</h4>
532 <table class="fields">
533 <tr><td class="val" id="aglyph">aglyph</td><td class="desc">
534 <p>The corresponding <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a> object. 0&nbsp;in case of failure.</p>
535 </td></tr>
536 <tr><td class="val" id="anode">anode</td><td class="desc">
537 <p>Used to return the address of the corresponding cache node after incrementing its reference count (see note below).</p>
538 </td></tr>
539 </table>
540
541 <h4>return</h4>
542 <p>FreeType error code. 0&nbsp;means success.</p>
543
544 <h4>note</h4>
545 <p>The returned glyph is owned and managed by the glyph image cache. Never try to transform or discard it manually! You can however create a copy with <a href="ft2-glyph_management.html#FT_Glyph_Copy">FT_Glyph_Copy</a> and modify the new one.</p>
546 <p>If &lsquo;anode&rsquo; is <i>not</i> NULL, it receives the address of the cache node containing the glyph image, after increasing its reference count. This ensures that the node (as well as the <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a>) will always be kept in the cache until you call <a href="ft2-cache_subsystem.html#FTC_Node_Unref">FTC_Node_Unref</a> to &lsquo;release&rsquo; it.</p>
547 <p>If &lsquo;anode&rsquo; is NULL, the cache node is left unchanged, which means that the <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a> could be flushed out of the cache on the next call to one of the caching sub-system APIs. Don't assume that it is persistent!</p>
548
549 <hr>
550 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
551
552 <div class="section">
553 <h3 id="FTC_SBit">FTC_SBit</h3>
554 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
555 <pre>
556   <span class="keyword">typedef</span> <span class="keyword">struct</span> FTC_SBitRec_*  <b>FTC_SBit</b>;
557 </pre>
558
559 <p>A handle to a small bitmap descriptor. See the <a href="ft2-cache_subsystem.html#FTC_SBitRec">FTC_SBitRec</a> structure for details.</p>
560
561 <hr>
562 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
563
564 <div class="section">
565 <h3 id="FTC_SBitCache">FTC_SBitCache</h3>
566 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
567 <pre>
568   <span class="keyword">typedef</span> <span class="keyword">struct</span> FTC_SBitCacheRec_*  <b>FTC_SBitCache</b>;
569 </pre>
570
571 <p>A handle to a small bitmap cache. These are special cache objects used to store small glyph bitmaps (and anti-aliased pixmaps) in a much more efficient way than the traditional glyph image cache implemented by <a href="ft2-cache_subsystem.html#FTC_ImageCache">FTC_ImageCache</a>.</p>
572
573 <hr>
574 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
575
576 <div class="section">
577 <h3 id="FTC_SBitCache_New">FTC_SBitCache_New</h3>
578 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
579 <pre>
580   FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> )
581   <b>FTC_SBitCache_New</b>( <a href="ft2-cache_subsystem.html#FTC_Manager">FTC_Manager</a>     manager,
582                      <a href="ft2-cache_subsystem.html#FTC_SBitCache">FTC_SBitCache</a>  *acache );
583 </pre>
584
585 <p>Create a new cache to store small glyph bitmaps.</p>
586
587 <h4>input</h4>
588 <table class="fields">
589 <tr><td class="val" id="manager">manager</td><td class="desc">
590 <p>A handle to the source cache manager.</p>
591 </td></tr>
592 </table>
593
594 <h4>output</h4>
595 <table class="fields">
596 <tr><td class="val" id="acache">acache</td><td class="desc">
597 <p>A handle to the new sbit cache. NULL in case of error.</p>
598 </td></tr>
599 </table>
600
601 <h4>return</h4>
602 <p>FreeType error code. 0&nbsp;means success.</p>
603
604 <hr>
605 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
606
607 <div class="section">
608 <h3 id="FTC_SBitCache_Lookup">FTC_SBitCache_Lookup</h3>
609 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
610 <pre>
611   FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> )
612   <b>FTC_SBitCache_Lookup</b>( <a href="ft2-cache_subsystem.html#FTC_SBitCache">FTC_SBitCache</a>    cache,
613                         <a href="ft2-cache_subsystem.html#FTC_ImageType">FTC_ImageType</a>    type,
614                         <a href="ft2-basic_types.html#FT_UInt">FT_UInt</a>          gindex,
615                         <a href="ft2-cache_subsystem.html#FTC_SBit">FTC_SBit</a>        *sbit,
616                         <a href="ft2-cache_subsystem.html#FTC_Node">FTC_Node</a>        *anode );
617 </pre>
618
619 <p>Look up a given small glyph bitmap in a given sbit cache and &lsquo;lock&rsquo; it to prevent its flushing from the cache until needed.</p>
620
621 <h4>input</h4>
622 <table class="fields">
623 <tr><td class="val" id="cache">cache</td><td class="desc">
624 <p>A handle to the source sbit cache.</p>
625 </td></tr>
626 <tr><td class="val" id="type">type</td><td class="desc">
627 <p>A pointer to the glyph image type descriptor.</p>
628 </td></tr>
629 <tr><td class="val" id="gindex">gindex</td><td class="desc">
630 <p>The glyph index.</p>
631 </td></tr>
632 </table>
633
634 <h4>output</h4>
635 <table class="fields">
636 <tr><td class="val" id="sbit">sbit</td><td class="desc">
637 <p>A handle to a small bitmap descriptor.</p>
638 </td></tr>
639 <tr><td class="val" id="anode">anode</td><td class="desc">
640 <p>Used to return the address of the corresponding cache node after incrementing its reference count (see note below).</p>
641 </td></tr>
642 </table>
643
644 <h4>return</h4>
645 <p>FreeType error code. 0&nbsp;means success.</p>
646
647 <h4>note</h4>
648 <p>The small bitmap descriptor and its bit buffer are owned by the cache and should never be freed by the application. They might as well disappear from memory on the next cache lookup, so don't treat them as persistent data.</p>
649 <p>The descriptor's &lsquo;buffer&rsquo; field is set to&nbsp;0 to indicate a missing glyph bitmap.</p>
650 <p>If &lsquo;anode&rsquo; is <i>not</i> NULL, it receives the address of the cache node containing the bitmap, after increasing its reference count. This ensures that the node (as well as the image) will always be kept in the cache until you call <a href="ft2-cache_subsystem.html#FTC_Node_Unref">FTC_Node_Unref</a> to &lsquo;release&rsquo; it.</p>
651 <p>If &lsquo;anode&rsquo; is NULL, the cache node is left unchanged, which means that the bitmap could be flushed out of the cache on the next call to one of the caching sub-system APIs. Don't assume that it is persistent!</p>
652
653 <hr>
654 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
655
656 <div class="section">
657 <h3 id="FTC_CMapCache">FTC_CMapCache</h3>
658 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
659 <pre>
660   <span class="keyword">typedef</span> <span class="keyword">struct</span> FTC_CMapCacheRec_*  <b>FTC_CMapCache</b>;
661 </pre>
662
663 <p>An opaque handle used to model a charmap cache. This cache is to hold character codes -&gt; glyph indices mappings.</p>
664
665 <hr>
666 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
667
668 <div class="section">
669 <h3 id="FTC_CMapCache_New">FTC_CMapCache_New</h3>
670 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
671 <pre>
672   FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> )
673   <b>FTC_CMapCache_New</b>( <a href="ft2-cache_subsystem.html#FTC_Manager">FTC_Manager</a>     manager,
674                      <a href="ft2-cache_subsystem.html#FTC_CMapCache">FTC_CMapCache</a>  *acache );
675 </pre>
676
677 <p>Create a new charmap cache.</p>
678
679 <h4>input</h4>
680 <table class="fields">
681 <tr><td class="val" id="manager">manager</td><td class="desc">
682 <p>A handle to the cache manager.</p>
683 </td></tr>
684 </table>
685
686 <h4>output</h4>
687 <table class="fields">
688 <tr><td class="val" id="acache">acache</td><td class="desc">
689 <p>A new cache handle. NULL in case of error.</p>
690 </td></tr>
691 </table>
692
693 <h4>return</h4>
694 <p>FreeType error code. 0&nbsp;means success.</p>
695
696 <h4>note</h4>
697 <p>Like all other caches, this one will be destroyed with the cache manager.</p>
698
699 <hr>
700 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
701
702 <div class="section">
703 <h3 id="FTC_CMapCache_Lookup">FTC_CMapCache_Lookup</h3>
704 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
705 <pre>
706   FT_EXPORT( <a href="ft2-basic_types.html#FT_UInt">FT_UInt</a> )
707   <b>FTC_CMapCache_Lookup</b>( <a href="ft2-cache_subsystem.html#FTC_CMapCache">FTC_CMapCache</a>  cache,
708                         <a href="ft2-cache_subsystem.html#FTC_FaceID">FTC_FaceID</a>     face_id,
709                         <a href="ft2-basic_types.html#FT_Int">FT_Int</a>         cmap_index,
710                         <a href="ft2-basic_types.html#FT_UInt32">FT_UInt32</a>      char_code );
711 </pre>
712
713 <p>Translate a character code into a glyph index, using the charmap cache.</p>
714
715 <h4>input</h4>
716 <table class="fields">
717 <tr><td class="val" id="cache">cache</td><td class="desc">
718 <p>A charmap cache handle.</p>
719 </td></tr>
720 <tr><td class="val" id="face_id">face_id</td><td class="desc">
721 <p>The source face ID.</p>
722 </td></tr>
723 <tr><td class="val" id="cmap_index">cmap_index</td><td class="desc">
724 <p>The index of the charmap in the source face. Any negative value means to use the cache <a href="ft2-base_interface.html#FT_Face">FT_Face</a>'s default charmap.</p>
725 </td></tr>
726 <tr><td class="val" id="char_code">char_code</td><td class="desc">
727 <p>The character code (in the corresponding charmap).</p>
728 </td></tr>
729 </table>
730
731 <h4>return</h4>
732 <p>Glyph index. 0&nbsp;means &lsquo;no glyph&rsquo;.</p>
733
734 <hr>
735 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
736
737 <div class="section">
738 <h3 id="FTC_ScalerRec">FTC_ScalerRec</h3>
739 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
740 <pre>
741   <span class="keyword">typedef</span> <span class="keyword">struct</span>  FTC_ScalerRec_
742   {
743     <a href="ft2-cache_subsystem.html#FTC_FaceID">FTC_FaceID</a>  face_id;
744     <a href="ft2-basic_types.html#FT_UInt">FT_UInt</a>     width;
745     <a href="ft2-basic_types.html#FT_UInt">FT_UInt</a>     height;
746     <a href="ft2-basic_types.html#FT_Int">FT_Int</a>      pixel;
747     <a href="ft2-basic_types.html#FT_UInt">FT_UInt</a>     x_res;
748     <a href="ft2-basic_types.html#FT_UInt">FT_UInt</a>     y_res;
749
750   } <b>FTC_ScalerRec</b>;
751 </pre>
752
753 <p>A structure used to describe a given character size in either pixels or points to the cache manager. See <a href="ft2-cache_subsystem.html#FTC_Manager_LookupSize">FTC_Manager_LookupSize</a>.</p>
754
755 <h4>fields</h4>
756 <table class="fields">
757 <tr><td class="val" id="face_id">face_id</td><td class="desc">
758 <p>The source face ID.</p>
759 </td></tr>
760 <tr><td class="val" id="width">width</td><td class="desc">
761 <p>The character width.</p>
762 </td></tr>
763 <tr><td class="val" id="height">height</td><td class="desc">
764 <p>The character height.</p>
765 </td></tr>
766 <tr><td class="val" id="pixel">pixel</td><td class="desc">
767 <p>A Boolean. If 1, the &lsquo;width&rsquo; and &lsquo;height&rsquo; fields are interpreted as integer pixel character sizes. Otherwise, they are expressed as 1/64th of points.</p>
768 </td></tr>
769 <tr><td class="val" id="x_res">x_res</td><td class="desc">
770 <p>Only used when &lsquo;pixel&rsquo; is value&nbsp;0 to indicate the horizontal resolution in dpi.</p>
771 </td></tr>
772 <tr><td class="val" id="y_res">y_res</td><td class="desc">
773 <p>Only used when &lsquo;pixel&rsquo; is value&nbsp;0 to indicate the vertical resolution in dpi.</p>
774 </td></tr>
775 </table>
776
777 <h4>note</h4>
778 <p>This type is mainly used to retrieve <a href="ft2-base_interface.html#FT_Size">FT_Size</a> objects through the cache manager.</p>
779
780 <hr>
781 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
782
783 <div class="section">
784 <h3 id="FTC_Scaler">FTC_Scaler</h3>
785 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
786 <pre>
787   <span class="keyword">typedef</span> <span class="keyword">struct</span> FTC_ScalerRec_*  <b>FTC_Scaler</b>;
788 </pre>
789
790 <p>A handle to an <a href="ft2-cache_subsystem.html#FTC_ScalerRec">FTC_ScalerRec</a> structure.</p>
791
792 <hr>
793 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
794
795 <div class="section">
796 <h3 id="FTC_ImageTypeRec">FTC_ImageTypeRec</h3>
797 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
798 <pre>
799   <span class="keyword">typedef</span> <span class="keyword">struct</span>  FTC_ImageTypeRec_
800   {
801     <a href="ft2-cache_subsystem.html#FTC_FaceID">FTC_FaceID</a>  face_id;
802     <a href="ft2-basic_types.html#FT_UInt">FT_UInt</a>     width;
803     <a href="ft2-basic_types.html#FT_UInt">FT_UInt</a>     height;
804     <a href="ft2-basic_types.html#FT_Int32">FT_Int32</a>    flags;
805
806   } <b>FTC_ImageTypeRec</b>;
807 </pre>
808
809 <p>A structure used to model the type of images in a glyph cache.</p>
810
811 <h4>fields</h4>
812 <table class="fields">
813 <tr><td class="val" id="face_id">face_id</td><td class="desc">
814 <p>The face ID.</p>
815 </td></tr>
816 <tr><td class="val" id="width">width</td><td class="desc">
817 <p>The width in pixels.</p>
818 </td></tr>
819 <tr><td class="val" id="height">height</td><td class="desc">
820 <p>The height in pixels.</p>
821 </td></tr>
822 <tr><td class="val" id="flags">flags</td><td class="desc">
823 <p>The load flags, as in <a href="ft2-base_interface.html#FT_Load_Glyph">FT_Load_Glyph</a>.</p>
824 </td></tr>
825 </table>
826
827 <hr>
828 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
829
830 <div class="section">
831 <h3 id="FTC_ImageType">FTC_ImageType</h3>
832 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
833 <pre>
834   <span class="keyword">typedef</span> <span class="keyword">struct</span> FTC_ImageTypeRec_*  <b>FTC_ImageType</b>;
835 </pre>
836
837 <p>A handle to an <a href="ft2-cache_subsystem.html#FTC_ImageTypeRec">FTC_ImageTypeRec</a> structure.</p>
838
839 <hr>
840 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
841
842 <div class="section">
843 <h3 id="FTC_ImageCache_LookupScaler">FTC_ImageCache_LookupScaler</h3>
844 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
845 <pre>
846   FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> )
847   <b>FTC_ImageCache_LookupScaler</b>( <a href="ft2-cache_subsystem.html#FTC_ImageCache">FTC_ImageCache</a>  cache,
848                                <a href="ft2-cache_subsystem.html#FTC_Scaler">FTC_Scaler</a>      scaler,
849                                <a href="ft2-basic_types.html#FT_ULong">FT_ULong</a>        load_flags,
850                                <a href="ft2-basic_types.html#FT_UInt">FT_UInt</a>         gindex,
851                                <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a>       *aglyph,
852                                <a href="ft2-cache_subsystem.html#FTC_Node">FTC_Node</a>       *anode );
853 </pre>
854
855 <p>A variant of <a href="ft2-cache_subsystem.html#FTC_ImageCache_Lookup">FTC_ImageCache_Lookup</a> that uses an <a href="ft2-cache_subsystem.html#FTC_ScalerRec">FTC_ScalerRec</a> to specify the face ID and its size.</p>
856
857 <h4>input</h4>
858 <table class="fields">
859 <tr><td class="val" id="cache">cache</td><td class="desc">
860 <p>A handle to the source glyph image cache.</p>
861 </td></tr>
862 <tr><td class="val" id="scaler">scaler</td><td class="desc">
863 <p>A pointer to a scaler descriptor.</p>
864 </td></tr>
865 <tr><td class="val" id="load_flags">load_flags</td><td class="desc">
866 <p>The corresponding load flags.</p>
867 </td></tr>
868 <tr><td class="val" id="gindex">gindex</td><td class="desc">
869 <p>The glyph index to retrieve.</p>
870 </td></tr>
871 </table>
872
873 <h4>output</h4>
874 <table class="fields">
875 <tr><td class="val" id="aglyph">aglyph</td><td class="desc">
876 <p>The corresponding <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a> object. 0&nbsp;in case of failure.</p>
877 </td></tr>
878 <tr><td class="val" id="anode">anode</td><td class="desc">
879 <p>Used to return the address of the corresponding cache node after incrementing its reference count (see note below).</p>
880 </td></tr>
881 </table>
882
883 <h4>return</h4>
884 <p>FreeType error code. 0&nbsp;means success.</p>
885
886 <h4>note</h4>
887 <p>The returned glyph is owned and managed by the glyph image cache. Never try to transform or discard it manually! You can however create a copy with <a href="ft2-glyph_management.html#FT_Glyph_Copy">FT_Glyph_Copy</a> and modify the new one.</p>
888 <p>If &lsquo;anode&rsquo; is <i>not</i> NULL, it receives the address of the cache node containing the glyph image, after increasing its reference count. This ensures that the node (as well as the <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a>) will always be kept in the cache until you call <a href="ft2-cache_subsystem.html#FTC_Node_Unref">FTC_Node_Unref</a> to &lsquo;release&rsquo; it.</p>
889 <p>If &lsquo;anode&rsquo; is NULL, the cache node is left unchanged, which means that the <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a> could be flushed out of the cache on the next call to one of the caching sub-system APIs. Don't assume that it is persistent!</p>
890 <p>Calls to <a href="ft2-base_interface.html#FT_Set_Char_Size">FT_Set_Char_Size</a> and friends have no effect on cached glyphs; you should always use the FreeType cache API instead.</p>
891
892 <hr>
893 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
894
895 <div class="section">
896 <h3 id="FTC_SBitRec">FTC_SBitRec</h3>
897 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
898 <pre>
899   <span class="keyword">typedef</span> <span class="keyword">struct</span>  FTC_SBitRec_
900   {
901     <a href="ft2-basic_types.html#FT_Byte">FT_Byte</a>   width;
902     <a href="ft2-basic_types.html#FT_Byte">FT_Byte</a>   height;
903     <a href="ft2-basic_types.html#FT_Char">FT_Char</a>   left;
904     <a href="ft2-basic_types.html#FT_Char">FT_Char</a>   top;
905
906     <a href="ft2-basic_types.html#FT_Byte">FT_Byte</a>   format;
907     <a href="ft2-basic_types.html#FT_Byte">FT_Byte</a>   max_grays;
908     <a href="ft2-basic_types.html#FT_Short">FT_Short</a>  pitch;
909     <a href="ft2-basic_types.html#FT_Char">FT_Char</a>   xadvance;
910     <a href="ft2-basic_types.html#FT_Char">FT_Char</a>   yadvance;
911
912     <a href="ft2-basic_types.html#FT_Byte">FT_Byte</a>*  buffer;
913
914   } <b>FTC_SBitRec</b>;
915 </pre>
916
917 <p>A very compact structure used to describe a small glyph bitmap.</p>
918
919 <h4>fields</h4>
920 <table class="fields">
921 <tr><td class="val" id="width">width</td><td class="desc">
922 <p>The bitmap width in pixels.</p>
923 </td></tr>
924 <tr><td class="val" id="height">height</td><td class="desc">
925 <p>The bitmap height in pixels.</p>
926 </td></tr>
927 <tr><td class="val" id="left">left</td><td class="desc">
928 <p>The horizontal distance from the pen position to the left bitmap border (a.k.a. &lsquo;left side bearing&rsquo;, or &lsquo;lsb&rsquo;).</p>
929 </td></tr>
930 <tr><td class="val" id="top">top</td><td class="desc">
931 <p>The vertical distance from the pen position (on the baseline) to the upper bitmap border (a.k.a. &lsquo;top side bearing&rsquo;). The distance is positive for upwards y&nbsp;coordinates.</p>
932 </td></tr>
933 <tr><td class="val" id="format">format</td><td class="desc">
934 <p>The format of the glyph bitmap (monochrome or gray).</p>
935 </td></tr>
936 <tr><td class="val" id="max_grays">max_grays</td><td class="desc">
937 <p>Maximum gray level value (in the range 1 to&nbsp;255).</p>
938 </td></tr>
939 <tr><td class="val" id="pitch">pitch</td><td class="desc">
940 <p>The number of bytes per bitmap line. May be positive or negative.</p>
941 </td></tr>
942 <tr><td class="val" id="xadvance">xadvance</td><td class="desc">
943 <p>The horizontal advance width in pixels.</p>
944 </td></tr>
945 <tr><td class="val" id="yadvance">yadvance</td><td class="desc">
946 <p>The vertical advance height in pixels.</p>
947 </td></tr>
948 <tr><td class="val" id="buffer">buffer</td><td class="desc">
949 <p>A pointer to the bitmap pixels.</p>
950 </td></tr>
951 </table>
952
953 <hr>
954 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
955
956 <div class="section">
957 <h3 id="FTC_SBitCache_LookupScaler">FTC_SBitCache_LookupScaler</h3>
958 <p>Defined in FT_CACHE_H (freetype/ftcache.h).</p>
959 <pre>
960   FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> )
961   <b>FTC_SBitCache_LookupScaler</b>( <a href="ft2-cache_subsystem.html#FTC_SBitCache">FTC_SBitCache</a>  cache,
962                               <a href="ft2-cache_subsystem.html#FTC_Scaler">FTC_Scaler</a>     scaler,
963                               <a href="ft2-basic_types.html#FT_ULong">FT_ULong</a>       load_flags,
964                               <a href="ft2-basic_types.html#FT_UInt">FT_UInt</a>        gindex,
965                               <a href="ft2-cache_subsystem.html#FTC_SBit">FTC_SBit</a>      *sbit,
966                               <a href="ft2-cache_subsystem.html#FTC_Node">FTC_Node</a>      *anode );
967 </pre>
968
969 <p>A variant of <a href="ft2-cache_subsystem.html#FTC_SBitCache_Lookup">FTC_SBitCache_Lookup</a> that uses an <a href="ft2-cache_subsystem.html#FTC_ScalerRec">FTC_ScalerRec</a> to specify the face ID and its size.</p>
970
971 <h4>input</h4>
972 <table class="fields">
973 <tr><td class="val" id="cache">cache</td><td class="desc">
974 <p>A handle to the source sbit cache.</p>
975 </td></tr>
976 <tr><td class="val" id="scaler">scaler</td><td class="desc">
977 <p>A pointer to the scaler descriptor.</p>
978 </td></tr>
979 <tr><td class="val" id="load_flags">load_flags</td><td class="desc">
980 <p>The corresponding load flags.</p>
981 </td></tr>
982 <tr><td class="val" id="gindex">gindex</td><td class="desc">
983 <p>The glyph index.</p>
984 </td></tr>
985 </table>
986
987 <h4>output</h4>
988 <table class="fields">
989 <tr><td class="val" id="sbit">sbit</td><td class="desc">
990 <p>A handle to a small bitmap descriptor.</p>
991 </td></tr>
992 <tr><td class="val" id="anode">anode</td><td class="desc">
993 <p>Used to return the address of the corresponding cache node after incrementing its reference count (see note below).</p>
994 </td></tr>
995 </table>
996
997 <h4>return</h4>
998 <p>FreeType error code. 0&nbsp;means success.</p>
999
1000 <h4>note</h4>
1001 <p>The small bitmap descriptor and its bit buffer are owned by the cache and should never be freed by the application. They might as well disappear from memory on the next cache lookup, so don't treat them as persistent data.</p>
1002 <p>The descriptor's &lsquo;buffer&rsquo; field is set to&nbsp;0 to indicate a missing glyph bitmap.</p>
1003 <p>If &lsquo;anode&rsquo; is <i>not</i> NULL, it receives the address of the cache node containing the bitmap, after increasing its reference count. This ensures that the node (as well as the image) will always be kept in the cache until you call <a href="ft2-cache_subsystem.html#FTC_Node_Unref">FTC_Node_Unref</a> to &lsquo;release&rsquo; it.</p>
1004 <p>If &lsquo;anode&rsquo; is NULL, the cache node is left unchanged, which means that the bitmap could be flushed out of the cache on the next call to one of the caching sub-system APIs. Don't assume that it is persistent!</p>
1005
1006 <hr>
1007 <table class="index-toc-link"><tr><td class="left">[<a href="ft2-index.html">Index</a>]</td><td class="middle">[<a href="#">Top</a>]</td><td class="right">[<a href="ft2-toc.html">TOC</a>]</td></tr></table></div>
1008
1009 </body>
1010 </html>