1 | /***************************************************************************/
|
---|
2 | /* */
|
---|
3 | /* freetype.h */
|
---|
4 | /* */
|
---|
5 | /* FreeType high-level API and common types (specification only). */
|
---|
6 | /* */
|
---|
7 | /* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */
|
---|
8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
---|
9 | /* */
|
---|
10 | /* This file is part of the FreeType project, and may only be used, */
|
---|
11 | /* modified, and distributed under the terms of the FreeType project */
|
---|
12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
---|
13 | /* this file you indicate that you have read the license and */
|
---|
14 | /* understand and accept it fully. */
|
---|
15 | /* */
|
---|
16 | /***************************************************************************/
|
---|
17 |
|
---|
18 |
|
---|
19 | #ifndef FT_FREETYPE_H
|
---|
20 | #error "`ft2build.h' hasn't been included yet!"
|
---|
21 | #error "Please always use macros to include FreeType header files."
|
---|
22 | #error "Example:"
|
---|
23 | #error " #include <ft2build.h>"
|
---|
24 | #error " #include FT_FREETYPE_H"
|
---|
25 | #endif
|
---|
26 |
|
---|
27 |
|
---|
28 | #ifndef __FREETYPE_H__
|
---|
29 | #define __FREETYPE_H__
|
---|
30 |
|
---|
31 |
|
---|
32 | /*************************************************************************/
|
---|
33 | /* */
|
---|
34 | /* The `raster' component duplicates some of the declarations in */
|
---|
35 | /* freetype.h for stand-alone use if _FREETYPE_ isn't defined. */
|
---|
36 | /* */
|
---|
37 |
|
---|
38 |
|
---|
39 | /*************************************************************************/
|
---|
40 | /* */
|
---|
41 | /* The FREETYPE_MAJOR and FREETYPE_MINOR macros are used to version the */
|
---|
42 | /* new FreeType design, which is able to host several kinds of font */
|
---|
43 | /* drivers. It starts at 2.0. */
|
---|
44 | /* */
|
---|
45 | #define FREETYPE_MAJOR 2
|
---|
46 | #define FREETYPE_MINOR 2
|
---|
47 | #define FREETYPE_PATCH 0
|
---|
48 |
|
---|
49 |
|
---|
50 | #include <ft2build.h>
|
---|
51 | #include FT_CONFIG_CONFIG_H
|
---|
52 | #include FT_ERRORS_H
|
---|
53 | #include FT_TYPES_H
|
---|
54 |
|
---|
55 |
|
---|
56 | FT_BEGIN_HEADER
|
---|
57 |
|
---|
58 |
|
---|
59 | /*************************************************************************/
|
---|
60 | /* */
|
---|
61 | /* <Section> */
|
---|
62 | /* user_allocation */
|
---|
63 | /* */
|
---|
64 | /* <Title> */
|
---|
65 | /* User allocation */
|
---|
66 | /* */
|
---|
67 | /* <Abstract> */
|
---|
68 | /* How client applications should allocate FreeType data structures. */
|
---|
69 | /* */
|
---|
70 | /* <Description> */
|
---|
71 | /* FreeType assumes that structures allocated by the user and passed */
|
---|
72 | /* as arguments are zeroed out except for the actual data. With */
|
---|
73 | /* other words, it is recommended to use `calloc' (or variants of it) */
|
---|
74 | /* instead of `malloc' for allocation. */
|
---|
75 | /* */
|
---|
76 | /*************************************************************************/
|
---|
77 |
|
---|
78 |
|
---|
79 | /*************************************************************************/
|
---|
80 | /*************************************************************************/
|
---|
81 | /* */
|
---|
82 | /* B A S I C T Y P E S */
|
---|
83 | /* */
|
---|
84 | /*************************************************************************/
|
---|
85 | /*************************************************************************/
|
---|
86 |
|
---|
87 |
|
---|
88 | /*************************************************************************/
|
---|
89 | /* */
|
---|
90 | /* <Section> */
|
---|
91 | /* base_interface */
|
---|
92 | /* */
|
---|
93 | /* <Title> */
|
---|
94 | /* Base Interface */
|
---|
95 | /* */
|
---|
96 | /* <Abstract> */
|
---|
97 | /* The FreeType 2 base font interface. */
|
---|
98 | /* */
|
---|
99 | /* <Description> */
|
---|
100 | /* This section describes the public high-level API of FreeType 2. */
|
---|
101 | /* */
|
---|
102 | /* <Order> */
|
---|
103 | /* FT_Library */
|
---|
104 | /* FT_Face */
|
---|
105 | /* FT_Size */
|
---|
106 | /* FT_GlyphSlot */
|
---|
107 | /* FT_CharMap */
|
---|
108 | /* FT_Encoding */
|
---|
109 | /* */
|
---|
110 | /* FT_FaceRec */
|
---|
111 | /* */
|
---|
112 | /* FT_FACE_FLAG_SCALABLE */
|
---|
113 | /* FT_FACE_FLAG_FIXED_SIZES */
|
---|
114 | /* FT_FACE_FLAG_FIXED_WIDTH */
|
---|
115 | /* FT_FACE_FLAG_HORIZONTAL */
|
---|
116 | /* FT_FACE_FLAG_VERTICAL */
|
---|
117 | /* FT_FACE_FLAG_SFNT */
|
---|
118 | /* FT_FACE_FLAG_KERNING */
|
---|
119 | /* FT_FACE_FLAG_MULTIPLE_MASTERS */
|
---|
120 | /* FT_FACE_FLAG_GLYPH_NAMES */
|
---|
121 | /* FT_FACE_FLAG_EXTERNAL_STREAM */
|
---|
122 | /* FT_FACE_FLAG_FAST_GLYPHS */
|
---|
123 | /* FT_FACE_FLAG_HINTER */
|
---|
124 | /* */
|
---|
125 | /* FT_STYLE_FLAG_BOLD */
|
---|
126 | /* FT_STYLE_FLAG_ITALIC */
|
---|
127 | /* */
|
---|
128 | /* FT_SizeRec */
|
---|
129 | /* FT_Size_Metrics */
|
---|
130 | /* */
|
---|
131 | /* FT_GlyphSlotRec */
|
---|
132 | /* FT_Glyph_Metrics */
|
---|
133 | /* FT_SubGlyph */
|
---|
134 | /* */
|
---|
135 | /* FT_Bitmap_Size */
|
---|
136 | /* */
|
---|
137 | /* FT_Init_FreeType */
|
---|
138 | /* FT_Done_FreeType */
|
---|
139 | /* FT_Library_Version */
|
---|
140 | /* */
|
---|
141 | /* FT_New_Face */
|
---|
142 | /* FT_Done_Face */
|
---|
143 | /* FT_New_Memory_Face */
|
---|
144 | /* FT_Open_Face */
|
---|
145 | /* FT_Open_Args */
|
---|
146 | /* FT_Parameter */
|
---|
147 | /* FT_Attach_File */
|
---|
148 | /* FT_Attach_Stream */
|
---|
149 | /* */
|
---|
150 | /* FT_Set_Char_Size */
|
---|
151 | /* FT_Set_Pixel_Sizes */
|
---|
152 | /* FT_Set_Transform */
|
---|
153 | /* FT_Load_Glyph */
|
---|
154 | /* FT_Get_Char_Index */
|
---|
155 | /* FT_Get_Name_Index */
|
---|
156 | /* FT_Load_Char */
|
---|
157 | /* */
|
---|
158 | /* FT_OPEN_MEMORY */
|
---|
159 | /* FT_OPEN_STREAM */
|
---|
160 | /* FT_OPEN_PATHNAME */
|
---|
161 | /* FT_OPEN_DRIVER */
|
---|
162 | /* FT_OPEN_PARAMS */
|
---|
163 | /* */
|
---|
164 | /* FT_LOAD_DEFAULT */
|
---|
165 | /* FT_LOAD_RENDER */
|
---|
166 | /* FT_LOAD_MONOCHROME */
|
---|
167 | /* FT_LOAD_LINEAR_DESIGN */
|
---|
168 | /* FT_LOAD_NO_SCALE */
|
---|
169 | /* FT_LOAD_NO_HINTING */
|
---|
170 | /* FT_LOAD_NO_BITMAP */
|
---|
171 | /* FT_LOAD_CROP_BITMAP */
|
---|
172 | /* */
|
---|
173 | /* FT_LOAD_VERTICAL_LAYOUT */
|
---|
174 | /* FT_LOAD_IGNORE_TRANSFORM */
|
---|
175 | /* FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */
|
---|
176 | /* FT_LOAD_FORCE_AUTOHINT */
|
---|
177 | /* FT_LOAD_NO_RECURSE */
|
---|
178 | /* FT_LOAD_PEDANTIC */
|
---|
179 | /* */
|
---|
180 | /* FT_LOAD_TARGET_NORMAL */
|
---|
181 | /* FT_LOAD_TARGET_LIGHT */
|
---|
182 | /* FT_LOAD_TARGET_MONO */
|
---|
183 | /* FT_LOAD_TARGET_LCD */
|
---|
184 | /* FT_LOAD_TARGET_LCD_V */
|
---|
185 | /* */
|
---|
186 | /* FT_Render_Glyph */
|
---|
187 | /* FT_Render_Mode */
|
---|
188 | /* FT_Get_Kerning */
|
---|
189 | /* FT_Kerning_Mode */
|
---|
190 | /* FT_Get_Glyph_Name */
|
---|
191 | /* FT_Get_Postscript_Name */
|
---|
192 | /* */
|
---|
193 | /* FT_CharMapRec */
|
---|
194 | /* FT_Select_Charmap */
|
---|
195 | /* FT_Set_Charmap */
|
---|
196 | /* FT_Get_Charmap_Index */
|
---|
197 | /* */
|
---|
198 | /*************************************************************************/
|
---|
199 |
|
---|
200 |
|
---|
201 | /*************************************************************************/
|
---|
202 | /* */
|
---|
203 | /* <Struct> */
|
---|
204 | /* FT_Glyph_Metrics */
|
---|
205 | /* */
|
---|
206 | /* <Description> */
|
---|
207 | /* A structure used to model the metrics of a single glyph. The */
|
---|
208 | /* values are expressed in 26.6 fractional pixel format; if the flag */
|
---|
209 | /* FT_LOAD_NO_SCALE is used, values are returned in font units */
|
---|
210 | /* instead. */
|
---|
211 | /* */
|
---|
212 | /* <Fields> */
|
---|
213 | /* width :: */
|
---|
214 | /* The glyph's width. */
|
---|
215 | /* */
|
---|
216 | /* height :: */
|
---|
217 | /* The glyph's height. */
|
---|
218 | /* */
|
---|
219 | /* horiBearingX :: */
|
---|
220 | /* Left side bearing for horizontal layout. */
|
---|
221 | /* */
|
---|
222 | /* horiBearingY :: */
|
---|
223 | /* Top side bearing for horizontal layout. */
|
---|
224 | /* */
|
---|
225 | /* horiAdvance :: */
|
---|
226 | /* Advance width for horizontal layout. */
|
---|
227 | /* */
|
---|
228 | /* vertBearingX :: */
|
---|
229 | /* Left side bearing for vertical layout. */
|
---|
230 | /* */
|
---|
231 | /* vertBearingY :: */
|
---|
232 | /* Top side bearing for vertical layout. */
|
---|
233 | /* */
|
---|
234 | /* vertAdvance :: */
|
---|
235 | /* Advance height for vertical layout. */
|
---|
236 | /* */
|
---|
237 | typedef struct FT_Glyph_Metrics_
|
---|
238 | {
|
---|
239 | FT_Pos width;
|
---|
240 | FT_Pos height;
|
---|
241 |
|
---|
242 | FT_Pos horiBearingX;
|
---|
243 | FT_Pos horiBearingY;
|
---|
244 | FT_Pos horiAdvance;
|
---|
245 |
|
---|
246 | FT_Pos vertBearingX;
|
---|
247 | FT_Pos vertBearingY;
|
---|
248 | FT_Pos vertAdvance;
|
---|
249 |
|
---|
250 | } FT_Glyph_Metrics;
|
---|
251 |
|
---|
252 |
|
---|
253 | /*************************************************************************/
|
---|
254 | /* */
|
---|
255 | /* <Struct> */
|
---|
256 | /* FT_Bitmap_Size */
|
---|
257 | /* */
|
---|
258 | /* <Description> */
|
---|
259 | /* This structure models the size of a bitmap strike (i.e., a bitmap */
|
---|
260 | /* instance of the font for a given resolution) in a fixed-size font */
|
---|
261 | /* face. It is used for the `available_sizes' field of the */
|
---|
262 | /* @FT_FaceRec structure. */
|
---|
263 | /* */
|
---|
264 | /* <Fields> */
|
---|
265 | /* height :: The (vertical) baseline-to-baseline distance in pixels. */
|
---|
266 | /* It makes most sense to define the height of a bitmap */
|
---|
267 | /* font in this way. */
|
---|
268 | /* */
|
---|
269 | /* width :: The average width of the font (in pixels). Since the */
|
---|
270 | /* algorithms to compute this value are different for the */
|
---|
271 | /* various bitmap formats, it can only give an additional */
|
---|
272 | /* hint if the `height' value isn't sufficient to select */
|
---|
273 | /* the proper font. For monospaced fonts the average width */
|
---|
274 | /* is the same as the maximum width. */
|
---|
275 | /* */
|
---|
276 | /* size :: The point size in 26.6 fractional format this font shall */
|
---|
277 | /* represent (for a given vertical resolution). */
|
---|
278 | /* */
|
---|
279 | /* x_ppem :: The horizontal ppem value (in 26.6 fractional format). */
|
---|
280 | /* */
|
---|
281 | /* y_ppem :: The vertical ppem value (in 26.6 fractional format). */
|
---|
282 | /* Usually, this is the `nominal' pixel height of the font. */
|
---|
283 | /* */
|
---|
284 | /* <Note> */
|
---|
285 | /* The values in this structure are taken from the bitmap font. If */
|
---|
286 | /* the font doesn't provide a parameter it is set to zero to indicate */
|
---|
287 | /* that the information is not available. */
|
---|
288 | /* */
|
---|
289 | /* The following formula converts from dpi to ppem: */
|
---|
290 | /* */
|
---|
291 | /* ppem = size * dpi / 72 */
|
---|
292 | /* */
|
---|
293 | /* where `size' is in points. */
|
---|
294 | /* */
|
---|
295 | /* Windows FNT: */
|
---|
296 | /* The `size' parameter is not reliable: There exist fonts (e.g., */
|
---|
297 | /* app850.fon) which have a wrong size for some subfonts; x_ppem */
|
---|
298 | /* and y_ppem are thus set equal to pixel width and height given in */
|
---|
299 | /* in the Windows FNT header. */
|
---|
300 | /* */
|
---|
301 | /* TrueType embedded bitmaps: */
|
---|
302 | /* `size', `width', and `height' values are not contained in the */
|
---|
303 | /* bitmap strike itself. They are computed from the global font */
|
---|
304 | /* parameters. */
|
---|
305 | /* */
|
---|
306 | typedef struct FT_Bitmap_Size_
|
---|
307 | {
|
---|
308 | FT_Short height;
|
---|
309 | FT_Short width;
|
---|
310 |
|
---|
311 | FT_Pos size;
|
---|
312 |
|
---|
313 | FT_Pos x_ppem;
|
---|
314 | FT_Pos y_ppem;
|
---|
315 |
|
---|
316 | } FT_Bitmap_Size;
|
---|
317 |
|
---|
318 |
|
---|
319 | /*************************************************************************/
|
---|
320 | /*************************************************************************/
|
---|
321 | /* */
|
---|
322 | /* O B J E C T C L A S S E S */
|
---|
323 | /* */
|
---|
324 | /*************************************************************************/
|
---|
325 | /*************************************************************************/
|
---|
326 |
|
---|
327 | /*************************************************************************/
|
---|
328 | /* */
|
---|
329 | /* <Type> */
|
---|
330 | /* FT_Library */
|
---|
331 | /* */
|
---|
332 | /* <Description> */
|
---|
333 | /* A handle to a FreeType library instance. Each `library' is */
|
---|
334 | /* completely independent from the others; it is the `root' of a set */
|
---|
335 | /* of objects like fonts, faces, sizes, etc. */
|
---|
336 | /* */
|
---|
337 | /* It also embeds a memory manager (see @FT_Memory), as well as a */
|
---|
338 | /* scan-line converter object (see @FT_Raster). */
|
---|
339 | /* */
|
---|
340 | /* <Note> */
|
---|
341 | /* Library objects are normally created by @FT_Init_FreeType, and */
|
---|
342 | /* destroyed with @FT_Done_FreeType. */
|
---|
343 | /* */
|
---|
344 | typedef struct FT_LibraryRec_ *FT_Library;
|
---|
345 |
|
---|
346 |
|
---|
347 | /*************************************************************************/
|
---|
348 | /* */
|
---|
349 | /* <Type> */
|
---|
350 | /* FT_Module */
|
---|
351 | /* */
|
---|
352 | /* <Description> */
|
---|
353 | /* A handle to a given FreeType module object. Each module can be a */
|
---|
354 | /* font driver, a renderer, or anything else that provides services */
|
---|
355 | /* to the formers. */
|
---|
356 | /* */
|
---|
357 | typedef struct FT_ModuleRec_* FT_Module;
|
---|
358 |
|
---|
359 |
|
---|
360 | /*************************************************************************/
|
---|
361 | /* */
|
---|
362 | /* <Type> */
|
---|
363 | /* FT_Driver */
|
---|
364 | /* */
|
---|
365 | /* <Description> */
|
---|
366 | /* A handle to a given FreeType font driver object. Each font driver */
|
---|
367 | /* is a special module capable of creating faces from font files. */
|
---|
368 | /* */
|
---|
369 | typedef struct FT_DriverRec_* FT_Driver;
|
---|
370 |
|
---|
371 |
|
---|
372 | /*************************************************************************/
|
---|
373 | /* */
|
---|
374 | /* <Type> */
|
---|
375 | /* FT_Renderer */
|
---|
376 | /* */
|
---|
377 | /* <Description> */
|
---|
378 | /* A handle to a given FreeType renderer. A renderer is a special */
|
---|
379 | /* module in charge of converting a glyph image to a bitmap, when */
|
---|
380 | /* necessary. Each renderer supports a given glyph image format, and */
|
---|
381 | /* one or more target surface depths. */
|
---|
382 | /* */
|
---|
383 | typedef struct FT_RendererRec_* FT_Renderer;
|
---|
384 |
|
---|
385 |
|
---|
386 | /*************************************************************************/
|
---|
387 | /* */
|
---|
388 | /* <Type> */
|
---|
389 | /* FT_Face */
|
---|
390 | /* */
|
---|
391 | /* <Description> */
|
---|
392 | /* A handle to a given typographic face object. A face object models */
|
---|
393 | /* a given typeface, in a given style. */
|
---|
394 | /* */
|
---|
395 | /* <Note> */
|
---|
396 | /* Each face object also owns a single @FT_GlyphSlot object, as well */
|
---|
397 | /* as one or more @FT_Size objects. */
|
---|
398 | /* */
|
---|
399 | /* Use @FT_New_Face or @FT_Open_Face to create a new face object from */
|
---|
400 | /* a given filepathname or a custom input stream. */
|
---|
401 | /* */
|
---|
402 | /* Use @FT_Done_Face to destroy it (along with its slot and sizes). */
|
---|
403 | /* */
|
---|
404 | /* <Also> */
|
---|
405 | /* The @FT_FaceRec details the publicly accessible fields of a given */
|
---|
406 | /* face object. */
|
---|
407 | /* */
|
---|
408 | typedef struct FT_FaceRec_* FT_Face;
|
---|
409 |
|
---|
410 |
|
---|
411 | /*************************************************************************/
|
---|
412 | /* */
|
---|
413 | /* <Type> */
|
---|
414 | /* FT_Size */
|
---|
415 | /* */
|
---|
416 | /* <Description> */
|
---|
417 | /* A handle to a given size object. Such an object models the data */
|
---|
418 | /* that depends on the current _resolution_ and _character size_ in a */
|
---|
419 | /* given @FT_Face. */
|
---|
420 | /* */
|
---|
421 | /* <Note> */
|
---|
422 | /* Each face object owns one or more sizes. There is however a */
|
---|
423 | /* single _active_ size for the face at any time that is used by */
|
---|
424 | /* functions like @FT_Load_Glyph, @FT_Get_Kerning, etc. */
|
---|
425 | /* */
|
---|
426 | /* You can use the @FT_Activate_Size API to change the current */
|
---|
427 | /* active size of any given face. */
|
---|
428 | /* */
|
---|
429 | /* <Also> */
|
---|
430 | /* The @FT_SizeRec structure details the publicly accessible fields */
|
---|
431 | /* of a given face object. */
|
---|
432 | /* */
|
---|
433 | typedef struct FT_SizeRec_* FT_Size;
|
---|
434 |
|
---|
435 |
|
---|
436 | /*************************************************************************/
|
---|
437 | /* */
|
---|
438 | /* <Type> */
|
---|
439 | /* FT_GlyphSlot */
|
---|
440 | /* */
|
---|
441 | /* <Description> */
|
---|
442 | /* A handle to a given `glyph slot'. A slot is a container where it */
|
---|
443 | /* is possible to load any one of the glyphs contained in its parent */
|
---|
444 | /* face. */
|
---|
445 | /* */
|
---|
446 | /* In other words, each time you call @FT_Load_Glyph or */
|
---|
447 | /* @FT_Load_Char, the slot's content is erased by the new glyph data, */
|
---|
448 | /* i.e. the glyph's metrics, its image (bitmap or outline), and */
|
---|
449 | /* other control information. */
|
---|
450 | /* */
|
---|
451 | /* <Also> */
|
---|
452 | /* @FT_GlyphSlotRec details the publicly accessible glyph fields. */
|
---|
453 | /* */
|
---|
454 | typedef struct FT_GlyphSlotRec_* FT_GlyphSlot;
|
---|
455 |
|
---|
456 |
|
---|
457 | /*************************************************************************/
|
---|
458 | /* */
|
---|
459 | /* <Type> */
|
---|
460 | /* FT_CharMap */
|
---|
461 | /* */
|
---|
462 | /* <Description> */
|
---|
463 | /* A handle to a given character map. A charmap is used to translate */
|
---|
464 | /* character codes in a given encoding into glyph indexes for its */
|
---|
465 | /* parent's face. Some font formats may provide several charmaps per */
|
---|
466 | /* font. */
|
---|
467 | /* */
|
---|
468 | /* Each face object owns zero or more charmaps, but only one of them */
|
---|
469 | /* can be "active" and used by @FT_Get_Char_Index or @FT_Load_Char. */
|
---|
470 | /* */
|
---|
471 | /* The list of available charmaps in a face is available through the */
|
---|
472 | /* "face->num_charmaps" and "face->charmaps" fields of @FT_FaceRec. */
|
---|
473 | /* */
|
---|
474 | /* The currently active charmap is available as "face->charmap". */
|
---|
475 | /* You should call @FT_Set_Charmap to change it. */
|
---|
476 | /* */
|
---|
477 | /* <Note> */
|
---|
478 | /* When a new face is created (either through @FT_New_Face or */
|
---|
479 | /* @FT_Open_Face), the library looks for a Unicode charmap within */
|
---|
480 | /* the list and automatically activates it. */
|
---|
481 | /* */
|
---|
482 | /* <Also> */
|
---|
483 | /* The @FT_CharMapRec details the publicly accessible fields of a */
|
---|
484 | /* given character map. */
|
---|
485 | /* */
|
---|
486 | typedef struct FT_CharMapRec_* FT_CharMap;
|
---|
487 |
|
---|
488 |
|
---|
489 | /*************************************************************************/
|
---|
490 | /* */
|
---|
491 | /* <Macro> */
|
---|
492 | /* FT_ENC_TAG */
|
---|
493 | /* */
|
---|
494 | /* <Description> */
|
---|
495 | /* This macro converts four letter tags into an unsigned long. It is */
|
---|
496 | /* used to define "encoding" identifiers (see @FT_Encoding). */
|
---|
497 | /* */
|
---|
498 | /* <Note> */
|
---|
499 | /* Since many 16bit compilers don't like 32bit enumerations, you */
|
---|
500 | /* should redefine this macro in case of problems to something like */
|
---|
501 | /* this: */
|
---|
502 | /* */
|
---|
503 | /* #define FT_ENC_TAG( value, a, b, c, d ) value */
|
---|
504 | /* */
|
---|
505 | /* to get a simple enumeration without assigning special numbers. */
|
---|
506 | /* */
|
---|
507 |
|
---|
508 | #ifndef FT_ENC_TAG
|
---|
509 | #define FT_ENC_TAG( value, a, b, c, d ) \
|
---|
510 | value = ( ( (FT_UInt32)(a) << 24 ) | \
|
---|
511 | ( (FT_UInt32)(b) << 16 ) | \
|
---|
512 | ( (FT_UInt32)(c) << 8 ) | \
|
---|
513 | (FT_UInt32)(d) )
|
---|
514 |
|
---|
515 | #endif /* FT_ENC_TAG */
|
---|
516 |
|
---|
517 |
|
---|
518 | /*************************************************************************/
|
---|
519 | /* */
|
---|
520 | /* <Enum> */
|
---|
521 | /* FT_Encoding */
|
---|
522 | /* */
|
---|
523 | /* <Description> */
|
---|
524 | /* An enumeration used to specify encodings supported by charmaps. */
|
---|
525 | /* Used in the @FT_Select_Charmap API function. */
|
---|
526 | /* */
|
---|
527 | /* <Note> */
|
---|
528 | /* Because of 32-bit charcodes defined in Unicode (i.e., surrogates), */
|
---|
529 | /* all character codes must be expressed as FT_Longs. */
|
---|
530 | /* */
|
---|
531 | /* The values of this type correspond to specific character */
|
---|
532 | /* repertories (i.e. charsets), and not to text encoding methods */
|
---|
533 | /* (like UTF-8, UTF-16, GB2312_EUC, etc.). */
|
---|
534 | /* */
|
---|
535 | /* Other encodings might be defined in the future. */
|
---|
536 | /* */
|
---|
537 | /* <Values> */
|
---|
538 | /* FT_ENCODING_NONE :: */
|
---|
539 | /* The encoding value 0 is reserved. */
|
---|
540 | /* */
|
---|
541 | /* FT_ENCODING_UNICODE :: */
|
---|
542 | /* Corresponds to the Unicode character set. This value covers */
|
---|
543 | /* all versions of the Unicode repertoire, including ASCII and */
|
---|
544 | /* Latin-1. Most fonts include a Unicode charmap, but not all */
|
---|
545 | /* of them. */
|
---|
546 | /* */
|
---|
547 | /* FT_ENCODING_MS_SYMBOL :: */
|
---|
548 | /* Corresponds to the Microsoft Symbol encoding, used to encode */
|
---|
549 | /* mathematical symbols in the 32..255 character code range. For */
|
---|
550 | /* more information, see `http://www.ceviz.net/symbol.htm'. */
|
---|
551 | /* */
|
---|
552 | /* FT_ENCODING_SJIS :: */
|
---|
553 | /* Corresponds to Japanese SJIS encoding. More info at */
|
---|
554 | /* at `http://langsupport.japanreference.com/encoding.shtml'. */
|
---|
555 | /* See note on multi-byte encodings below. */
|
---|
556 | /* */
|
---|
557 | /* FT_ENCODING_GB2312 :: */
|
---|
558 | /* Corresponds to an encoding system for Simplified Chinese as used */
|
---|
559 | /* used in mainland China. */
|
---|
560 | /* */
|
---|
561 | /* FT_ENCODING_BIG5 :: */
|
---|
562 | /* Corresponds to an encoding system for Traditional Chinese as used */
|
---|
563 | /* in Taiwan and Hong Kong. */
|
---|
564 | /* */
|
---|
565 | /* FT_ENCODING_WANSUNG :: */
|
---|
566 | /* Corresponds to the Korean encoding system known as Wansung. */
|
---|
567 | /* For more information see */
|
---|
568 | /* `http://www.microsoft.com/typography/unicode/949.txt'. */
|
---|
569 | /* */
|
---|
570 | /* FT_ENCODING_JOHAB :: */
|
---|
571 | /* The Korean standard character set (KS C-5601-1992), which */
|
---|
572 | /* corresponds to MS Windows code page 1361. This character set */
|
---|
573 | /* includes all possible Hangeul character combinations. */
|
---|
574 | /* */
|
---|
575 | /* FT_ENCODING_ADOBE_LATIN_1 :: */
|
---|
576 | /* Corresponds to a Latin-1 encoding as defined in a Type 1 */
|
---|
577 | /* Postscript font. It is limited to 256 character codes. */
|
---|
578 | /* */
|
---|
579 | /* FT_ENCODING_ADOBE_STANDARD :: */
|
---|
580 | /* Corresponds to the Adobe Standard encoding, as found in Type 1, */
|
---|
581 | /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
|
---|
582 | /* codes. */
|
---|
583 | /* */
|
---|
584 | /* FT_ENCODING_ADOBE_EXPERT :: */
|
---|
585 | /* Corresponds to the Adobe Expert encoding, as found in Type 1, */
|
---|
586 | /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
|
---|
587 | /* codes. */
|
---|
588 | /* */
|
---|
589 | /* FT_ENCODING_ADOBE_CUSTOM :: */
|
---|
590 | /* Corresponds to a custom encoding, as found in Type 1, CFF, and */
|
---|
591 | /* OpenType/CFF fonts. It is limited to 256 character codes. */
|
---|
592 | /* */
|
---|
593 | /* FT_ENCODING_APPLE_ROMAN :: */
|
---|
594 | /* Corresponds to the 8-bit Apple roman encoding. Many TrueType and */
|
---|
595 | /* OpenType fonts contain a charmap for this encoding, since older */
|
---|
596 | /* versions of Mac OS are able to use it. */
|
---|
597 | /* */
|
---|
598 | /* FT_ENCODING_OLD_LATIN_2 :: */
|
---|
599 | /* This value is deprecated and was never used nor reported by */
|
---|
600 | /* FreeType. Don't use or test for it. */
|
---|
601 | /* */
|
---|
602 | /* FT_ENCODING_MS_SJIS :: */
|
---|
603 | /* Same as FT_ENCODING_SJIS. Deprecated. */
|
---|
604 | /* */
|
---|
605 | /* FT_ENCODING_MS_GB2312 :: */
|
---|
606 | /* Same as FT_ENCODING_GB2312. Deprecated. */
|
---|
607 | /* */
|
---|
608 | /* FT_ENCODING_MS_BIG5 :: */
|
---|
609 | /* Same as FT_ENCODING_BIG5. Deprecated. */
|
---|
610 | /* */
|
---|
611 | /* FT_ENCODING_MS_WANSUNG :: */
|
---|
612 | /* Same as FT_ENCODING_WANSUNG. Deprecated. */
|
---|
613 | /* */
|
---|
614 | /* FT_ENCODING_MS_JOHAB :: */
|
---|
615 | /* Same as FT_ENCODING_JOHAB. Deprecated. */
|
---|
616 | /* */
|
---|
617 | /* <Note> */
|
---|
618 | /* By default, FreeType automatically synthetizes a Unicode charmap */
|
---|
619 | /* for Postscript fonts, using their glyph names dictionaries. */
|
---|
620 | /* However, it also reports the encodings defined explicitly in the */
|
---|
621 | /* font file, for the cases when they are needed, with the Adobe */
|
---|
622 | /* values as well. */
|
---|
623 | /* */
|
---|
624 | /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */
|
---|
625 | /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */
|
---|
626 | /* FT_ENCODING_UNICODE). Use `FT_Get_BDF_Charset_ID' to find out */
|
---|
627 | /* which encoding is really present. If, for example, the */
|
---|
628 | /* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */
|
---|
629 | /* the font is encoded in KOI8-R. */
|
---|
630 | /* */
|
---|
631 | /* FT_ENCODING_NONE is always set (with a single exception) by the */
|
---|
632 | /* winfonts driver. Use `FT_Get_WinFNT_Header' and examine the */
|
---|
633 | /* `charset' field of the `FT_WinFNT_HeaderRec' structure to find out */
|
---|
634 | /* which encoding is really present. For example, FT_WinFNT_ID_CP1251 */
|
---|
635 | /* (204) means Windows code page 1251 (for Russian). */
|
---|
636 | /* */
|
---|
637 | /* FT_ENCODING_NONE is set if `platform_id' is `TT_PLATFORM_MACINTOSH' */
|
---|
638 | /* and `encoding_id' is not `TT_MAC_ID_ROMAN' (otherwise it is set to */
|
---|
639 | /* FT_ENCODING_APPLE_ROMAN). */
|
---|
640 | /* */
|
---|
641 | /* If `platform_id' is `TT_PLATFORM_MACINTOSH', use the function */
|
---|
642 | /* `FT_Get_CMap_Language_ID' to query the Mac language ID which may be */
|
---|
643 | /* needed to be able to distinguish Apple encoding variants. See */
|
---|
644 | /* */
|
---|
645 | /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT */
|
---|
646 | /* */
|
---|
647 | /* to get an idea how to do that. Basically, if the language ID is 0, */
|
---|
648 | /* dont use it, otherwise subtract 1 from the language ID. Then */
|
---|
649 | /* examine `encoding_id'. If, for example, `encoding_id' is */
|
---|
650 | /* `TT_MAC_ID_ROMAN' and the language ID (minus 1) is */
|
---|
651 | /* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */
|
---|
652 | /* `TT_MAC_ID_ARABIC' with `TT_MAC_LANGID_FARSI' means the Farsi */
|
---|
653 | /* variant the Arabic encoding. */
|
---|
654 | /* */
|
---|
655 | typedef enum FT_Encoding_
|
---|
656 | {
|
---|
657 | FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),
|
---|
658 |
|
---|
659 | FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),
|
---|
660 | FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ),
|
---|
661 |
|
---|
662 | FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ),
|
---|
663 | FT_ENC_TAG( FT_ENCODING_GB2312, 'g', 'b', ' ', ' ' ),
|
---|
664 | FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ),
|
---|
665 | FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),
|
---|
666 | FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ),
|
---|
667 |
|
---|
668 | /* for backwards compatibility */
|
---|
669 | FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS,
|
---|
670 | FT_ENCODING_MS_GB2312 = FT_ENCODING_GB2312,
|
---|
671 | FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5,
|
---|
672 | FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
|
---|
673 | FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB,
|
---|
674 |
|
---|
675 | FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),
|
---|
676 | FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ),
|
---|
677 | FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ),
|
---|
678 | FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ),
|
---|
679 |
|
---|
680 | FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),
|
---|
681 |
|
---|
682 | FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )
|
---|
683 |
|
---|
684 | } FT_Encoding;
|
---|
685 |
|
---|
686 |
|
---|
687 | /*************************************************************************/
|
---|
688 | /* */
|
---|
689 | /* <Enum> */
|
---|
690 | /* ft_encoding_xxx */
|
---|
691 | /* */
|
---|
692 | /* <Description> */
|
---|
693 | /* These constants are deprecated; use the corresponding @FT_Encoding */
|
---|
694 | /* values instead. */
|
---|
695 | /* */
|
---|
696 | /* <Values> */
|
---|
697 | /* ft_encoding_none :: see @FT_ENCODING_NONE */
|
---|
698 | /* ft_encoding_unicode :: see @FT_ENCODING_UNICODE */
|
---|
699 | /* ft_encoding_latin_2 :: see @FT_ENCODING_OLD_LATIN_2 */
|
---|
700 | /* ft_encoding_symbol :: see @FT_ENCODING_MS_SYMBOL */
|
---|
701 | /* ft_encoding_sjis :: see @FT_ENCODING_SJIS */
|
---|
702 | /* ft_encoding_gb2312 :: see @FT_ENCODING_GB2312 */
|
---|
703 | /* ft_encoding_big5 :: see @FT_ENCODING_BIG5 */
|
---|
704 | /* ft_encoding_wansung :: see @FT_ENCODING_WANSUNG */
|
---|
705 | /* ft_encoding_johab :: see @FT_ENCODING_JOHAB */
|
---|
706 | /* */
|
---|
707 | /* ft_encoding_adobe_standard :: see @FT_ENCODING_ADOBE_STANDARD */
|
---|
708 | /* ft_encoding_adobe_expert :: see @FT_ENCODING_ADOBE_EXPERT */
|
---|
709 | /* ft_encoding_adobe_custom :: see @FT_ENCODING_ADOBE_CUSTOM */
|
---|
710 | /* ft_encoding_latin_1 :: see @FT_ENCODING_ADOBE_LATIN_1 */
|
---|
711 | /* */
|
---|
712 | /* ft_encoding_apple_roman :: see @FT_ENCODING_APPLE_ROMAN */
|
---|
713 | /* */
|
---|
714 | #define ft_encoding_none FT_ENCODING_NONE
|
---|
715 | #define ft_encoding_unicode FT_ENCODING_UNICODE
|
---|
716 | #define ft_encoding_symbol FT_ENCODING_MS_SYMBOL
|
---|
717 | #define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1
|
---|
718 | #define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2
|
---|
719 | #define ft_encoding_sjis FT_ENCODING_SJIS
|
---|
720 | #define ft_encoding_gb2312 FT_ENCODING_GB2312
|
---|
721 | #define ft_encoding_big5 FT_ENCODING_BIG5
|
---|
722 | #define ft_encoding_wansung FT_ENCODING_WANSUNG
|
---|
723 | #define ft_encoding_johab FT_ENCODING_JOHAB
|
---|
724 |
|
---|
725 | #define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD
|
---|
726 | #define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT
|
---|
727 | #define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM
|
---|
728 | #define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN
|
---|
729 |
|
---|
730 |
|
---|
731 | /*************************************************************************/
|
---|
732 | /* */
|
---|
733 | /* <Struct> */
|
---|
734 | /* FT_CharMapRec */
|
---|
735 | /* */
|
---|
736 | /* <Description> */
|
---|
737 | /* The base charmap structure. */
|
---|
738 | /* */
|
---|
739 | /* <Fields> */
|
---|
740 | /* face :: A handle to the parent face object. */
|
---|
741 | /* */
|
---|
742 | /* encoding :: An @FT_Encoding tag identifying the charmap. Use */
|
---|
743 | /* this with @FT_Select_Charmap. */
|
---|
744 | /* */
|
---|
745 | /* platform_id :: An ID number describing the platform for the */
|
---|
746 | /* following encoding ID. This comes directly from */
|
---|
747 | /* the TrueType specification and should be emulated */
|
---|
748 | /* for other formats. */
|
---|
749 | /* */
|
---|
750 | /* encoding_id :: A platform specific encoding number. This also */
|
---|
751 | /* comes from the TrueType specification and should be */
|
---|
752 | /* emulated similarly. */
|
---|
753 | /* */
|
---|
754 | typedef struct FT_CharMapRec_
|
---|
755 | {
|
---|
756 | FT_Face face;
|
---|
757 | FT_Encoding encoding;
|
---|
758 | FT_UShort platform_id;
|
---|
759 | FT_UShort encoding_id;
|
---|
760 |
|
---|
761 | } FT_CharMapRec;
|
---|
762 |
|
---|
763 |
|
---|
764 | /*************************************************************************/
|
---|
765 | /*************************************************************************/
|
---|
766 | /* */
|
---|
767 | /* B A S E O B J E C T C L A S S E S */
|
---|
768 | /* */
|
---|
769 | /*************************************************************************/
|
---|
770 | /*************************************************************************/
|
---|
771 |
|
---|
772 |
|
---|
773 | /*************************************************************************/
|
---|
774 | /* */
|
---|
775 | /* <Type> */
|
---|
776 | /* FT_Face_Internal */
|
---|
777 | /* */
|
---|
778 | /* <Description> */
|
---|
779 | /* An opaque handle to an FT_Face_InternalRec structure, used to */
|
---|
780 | /* model private data of a given @FT_Face object. */
|
---|
781 | /* */
|
---|
782 | /* This structure might change between releases of FreeType 2 and is */
|
---|
783 | /* not generally available to client applications. */
|
---|
784 | /* */
|
---|
785 | typedef struct FT_Face_InternalRec_* FT_Face_Internal;
|
---|
786 |
|
---|
787 |
|
---|
788 | /*************************************************************************/
|
---|
789 | /* */
|
---|
790 | /* <Struct> */
|
---|
791 | /* FT_FaceRec */
|
---|
792 | /* */
|
---|
793 | /* <Description> */
|
---|
794 | /* FreeType root face class structure. A face object models the */
|
---|
795 | /* resolution and point-size independent data found in a font file. */
|
---|
796 | /* */
|
---|
797 | /* <Fields> */
|
---|
798 | /* num_faces :: In the case where the face is located in a */
|
---|
799 | /* collection (i.e., a file which embeds */
|
---|
800 | /* several faces), this is the total number of */
|
---|
801 | /* faces found in the resource. 1 by default. */
|
---|
802 | /* Accessing non-existent face indices causes */
|
---|
803 | /* an error. */
|
---|
804 | /* */
|
---|
805 | /* face_index :: The index of the face in its font file. */
|
---|
806 | /* Usually, this is 0 for all normal font */
|
---|
807 | /* formats. It can be > 0 in the case of */
|
---|
808 | /* collections (which embed several fonts in a */
|
---|
809 | /* single resource/file). */
|
---|
810 | /* */
|
---|
811 | /* face_flags :: A set of bit flags that give important */
|
---|
812 | /* information about the face; see the */
|
---|
813 | /* @FT_FACE_FLAG_XXX constants for details. */
|
---|
814 | /* */
|
---|
815 | /* style_flags :: A set of bit flags indicating the style of */
|
---|
816 | /* the face (i.e., italic, bold, underline, */
|
---|
817 | /* etc). See the @FT_STYLE_FLAG_XXX */
|
---|
818 | /* constants. */
|
---|
819 | /* */
|
---|
820 | /* num_glyphs :: The total number of glyphs in the face. */
|
---|
821 | /* */
|
---|
822 | /* family_name :: The face's family name. This is an ASCII */
|
---|
823 | /* string, usually in English, which describes */
|
---|
824 | /* the typeface's family (like `Times New */
|
---|
825 | /* Roman', `Bodoni', `Garamond', etc). This */
|
---|
826 | /* is a least common denominator used to list */
|
---|
827 | /* fonts. Some formats (TrueType & OpenType) */
|
---|
828 | /* provide localized and Unicode versions of */
|
---|
829 | /* this string. Applications should use the */
|
---|
830 | /* format specific interface to access them. */
|
---|
831 | /* */
|
---|
832 | /* style_name :: The face's style name. This is an ASCII */
|
---|
833 | /* string, usually in English, which describes */
|
---|
834 | /* the typeface's style (like `Italic', */
|
---|
835 | /* `Bold', `Condensed', etc). Not all font */
|
---|
836 | /* formats provide a style name, so this field */
|
---|
837 | /* is optional, and can be set to NULL. As */
|
---|
838 | /* for `family_name', some formats provide */
|
---|
839 | /* localized/Unicode versions of this string. */
|
---|
840 | /* Applications should use the format specific */
|
---|
841 | /* interface to access them. */
|
---|
842 | /* */
|
---|
843 | /* num_fixed_sizes :: The number of fixed sizes available in this */
|
---|
844 | /* face. This should be set to 0 for scalable */
|
---|
845 | /* fonts, unless its face includes a set of */
|
---|
846 | /* glyphs (called a `strike') for the */
|
---|
847 | /* specified sizes. */
|
---|
848 | /* */
|
---|
849 | /* available_sizes :: An array of sizes specifying the available */
|
---|
850 | /* bitmap/graymap sizes that are contained in */
|
---|
851 | /* in the font face. Should be set to NULL if */
|
---|
852 | /* the field `num_fixed_sizes' is set to 0. */
|
---|
853 | /* */
|
---|
854 | /* num_charmaps :: The total number of character maps in the */
|
---|
855 | /* face. */
|
---|
856 | /* */
|
---|
857 | /* charmaps :: A table of pointers to the face's charmaps. */
|
---|
858 | /* Used to scan the list of available charmaps */
|
---|
859 | /* -- this table might change after a call to */
|
---|
860 | /* @FT_Attach_File or @FT_Attach_Stream (e.g. */
|
---|
861 | /* if used to hook an additional encoding or */
|
---|
862 | /* CMap to the face object). */
|
---|
863 | /* */
|
---|
864 | /* generic :: A field reserved for client uses. See the */
|
---|
865 | /* @FT_Generic type description. */
|
---|
866 | /* */
|
---|
867 | /* bbox :: The font bounding box. Coordinates are */
|
---|
868 | /* expressed in font units (see units_per_EM). */
|
---|
869 | /* The box is large enough to contain any */
|
---|
870 | /* glyph from the font. Thus, bbox.yMax can */
|
---|
871 | /* be seen as the `maximal ascender', */
|
---|
872 | /* bbox.yMin as the `minimal descender', and */
|
---|
873 | /* the maximal glyph width is given by */
|
---|
874 | /* `bbox.xMax-bbox.xMin' (not to be confused */
|
---|
875 | /* with the maximal _advance_width_). Only */
|
---|
876 | /* relevant for scalable formats. */
|
---|
877 | /* */
|
---|
878 | /* units_per_EM :: The number of font units per EM square for */
|
---|
879 | /* this face. This is typically 2048 for */
|
---|
880 | /* TrueType fonts, 1000 for Type1 fonts, and */
|
---|
881 | /* should be set to the (unrealistic) value 1 */
|
---|
882 | /* for fixed-sizes fonts. Only relevant for */
|
---|
883 | /* scalable formats. */
|
---|
884 | /* */
|
---|
885 | /* ascender :: The face's ascender is the vertical */
|
---|
886 | /* distance from the baseline to the topmost */
|
---|
887 | /* point of any glyph in the face. This */
|
---|
888 | /* field's value is positive, expressed in */
|
---|
889 | /* font units. Some font designs use a value */
|
---|
890 | /* different from `bbox.yMax'. Only relevant */
|
---|
891 | /* for scalable formats. */
|
---|
892 | /* */
|
---|
893 | /* descender :: The face's descender is the vertical */
|
---|
894 | /* distance from the baseline to the */
|
---|
895 | /* bottommost point of any glyph in the face. */
|
---|
896 | /* This field's value is *negative* for values */
|
---|
897 | /* below the baseline. It is expressed in */
|
---|
898 | /* font units. Some font designs use a value */
|
---|
899 | /* different from `bbox.yMin'. Only relevant */
|
---|
900 | /* for scalable formats. */
|
---|
901 | /* */
|
---|
902 | /* height :: The face's height is the vertical distance */
|
---|
903 | /* from one baseline to the next when writing */
|
---|
904 | /* several lines of text. Its value is always */
|
---|
905 | /* positive, expressed in font units. The */
|
---|
906 | /* value can be computed as */
|
---|
907 | /* `ascender+descender+line_gap' where the */
|
---|
908 | /* value of `line_gap' is also called */
|
---|
909 | /* `external leading'. Only relevant for */
|
---|
910 | /* scalable formats. */
|
---|
911 | /* */
|
---|
912 | /* max_advance_width :: The maximal advance width, in font units, */
|
---|
913 | /* for all glyphs in this face. This can be */
|
---|
914 | /* used to make word wrapping computations */
|
---|
915 | /* faster. Only relevant for scalable */
|
---|
916 | /* formats. */
|
---|
917 | /* */
|
---|
918 | /* max_advance_height :: The maximal advance height, in font units, */
|
---|
919 | /* for all glyphs in this face. This is only */
|
---|
920 | /* relevant for vertical layouts, and should */
|
---|
921 | /* be set to the `height' for fonts that do */
|
---|
922 | /* not provide vertical metrics. Only */
|
---|
923 | /* relevant for scalable formats. */
|
---|
924 | /* */
|
---|
925 | /* underline_position :: The position, in font units, of the */
|
---|
926 | /* underline line for this face. It's the */
|
---|
927 | /* center of the underlining stem. Only */
|
---|
928 | /* relevant for scalable formats. */
|
---|
929 | /* */
|
---|
930 | /* underline_thickness :: The thickness, in font units, of the */
|
---|
931 | /* underline for this face. Only relevant for */
|
---|
932 | /* scalable formats. */
|
---|
933 | /* */
|
---|
934 | /* glyph :: The face's associated glyph slot(s). This */
|
---|
935 | /* object is created automatically with a new */
|
---|
936 | /* face object. However, certain kinds of */
|
---|
937 | /* applications (mainly tools like converters) */
|
---|
938 | /* can need more than one slot to ease their */
|
---|
939 | /* task. */
|
---|
940 | /* */
|
---|
941 | /* size :: The current active size for this face. */
|
---|
942 | /* */
|
---|
943 | /* charmap :: The current active charmap for this face. */
|
---|
944 | /* */
|
---|
945 | typedef struct FT_FaceRec_
|
---|
946 | {
|
---|
947 | FT_Long num_faces;
|
---|
948 | FT_Long face_index;
|
---|
949 |
|
---|
950 | FT_Long face_flags;
|
---|
951 | FT_Long style_flags;
|
---|
952 |
|
---|
953 | FT_Long num_glyphs;
|
---|
954 |
|
---|
955 | FT_String* family_name;
|
---|
956 | FT_String* style_name;
|
---|
957 |
|
---|
958 | FT_Int num_fixed_sizes;
|
---|
959 | FT_Bitmap_Size* available_sizes;
|
---|
960 |
|
---|
961 | FT_Int num_charmaps;
|
---|
962 | FT_CharMap* charmaps;
|
---|
963 |
|
---|
964 | FT_Generic generic;
|
---|
965 |
|
---|
966 | /*# the following are only relevant to scalable outlines */
|
---|
967 | FT_BBox bbox;
|
---|
968 |
|
---|
969 | FT_UShort units_per_EM;
|
---|
970 | FT_Short ascender;
|
---|
971 | FT_Short descender;
|
---|
972 | FT_Short height;
|
---|
973 |
|
---|
974 | FT_Short max_advance_width;
|
---|
975 | FT_Short max_advance_height;
|
---|
976 |
|
---|
977 | FT_Short underline_position;
|
---|
978 | FT_Short underline_thickness;
|
---|
979 |
|
---|
980 | FT_GlyphSlot glyph;
|
---|
981 | FT_Size size;
|
---|
982 | FT_CharMap charmap;
|
---|
983 |
|
---|
984 | /*@private begin */
|
---|
985 |
|
---|
986 | FT_Driver driver;
|
---|
987 | FT_Memory memory;
|
---|
988 | FT_Stream stream;
|
---|
989 |
|
---|
990 | FT_ListRec sizes_list;
|
---|
991 |
|
---|
992 | FT_Generic autohint;
|
---|
993 | void* extensions;
|
---|
994 |
|
---|
995 | FT_Face_Internal internal;
|
---|
996 |
|
---|
997 | /*@private end */
|
---|
998 |
|
---|
999 | } FT_FaceRec;
|
---|
1000 |
|
---|
1001 |
|
---|
1002 | /*************************************************************************/
|
---|
1003 | /* */
|
---|
1004 | /* <Enum> */
|
---|
1005 | /* FT_FACE_FLAG_XXX */
|
---|
1006 | /* */
|
---|
1007 | /* <Description> */
|
---|
1008 | /* A list of bit flags used in the `face_flags' field of the */
|
---|
1009 | /* @FT_FaceRec structure. They inform client applications of */
|
---|
1010 | /* properties of the corresponding face. */
|
---|
1011 | /* */
|
---|
1012 | /* <Values> */
|
---|
1013 | /* FT_FACE_FLAG_SCALABLE :: */
|
---|
1014 | /* Indicates that the face provides vectorial outlines. This */
|
---|
1015 | /* doesn't prevent embedded bitmaps, i.e., a face can have both */
|
---|
1016 | /* this bit and @FT_FACE_FLAG_FIXED_SIZES set. */
|
---|
1017 | /* */
|
---|
1018 | /* FT_FACE_FLAG_FIXED_SIZES :: */
|
---|
1019 | /* Indicates that the face contains `fixed sizes', i.e., bitmap */
|
---|
1020 | /* strikes for some given pixel sizes. See the `num_fixed_sizes' */
|
---|
1021 | /* and `available_sizes' fields of @FT_FaceRec. */
|
---|
1022 | /* */
|
---|
1023 | /* FT_FACE_FLAG_FIXED_WIDTH :: */
|
---|
1024 | /* Indicates that the face contains fixed-width characters (like */
|
---|
1025 | /* Courier, Lucido, MonoType, etc.). */
|
---|
1026 | /* */
|
---|
1027 | /* FT_FACE_FLAG_SFNT :: */
|
---|
1028 | /* Indicates that the face uses the `sfnt' storage scheme. For */
|
---|
1029 | /* now, this means TrueType and OpenType. */
|
---|
1030 | /* */
|
---|
1031 | /* FT_FACE_FLAG_HORIZONTAL :: */
|
---|
1032 | /* Indicates that the face contains horizontal glyph metrics. This */
|
---|
1033 | /* should be set for all common formats. */
|
---|
1034 | /* */
|
---|
1035 | /* FT_FACE_FLAG_VERTICAL :: */
|
---|
1036 | /* Indicates that the face contains vertical glyph metrics. This */
|
---|
1037 | /* is only available in some formats, not all of them. */
|
---|
1038 | /* */
|
---|
1039 | /* FT_FACE_FLAG_KERNING :: */
|
---|
1040 | /* Indicates that the face contains kerning information. If set, */
|
---|
1041 | /* the kerning distance can be retrieved through the function */
|
---|
1042 | /* @FT_Get_Kerning. Otherwise the function always return the */
|
---|
1043 | /* vector (0,0). Note that FreeType doesn't handle kerning data */
|
---|
1044 | /* from the `GPOS' table (as present in some OpenType fonts). */
|
---|
1045 | /* */
|
---|
1046 | /* FT_FACE_FLAG_FAST_GLYPHS :: */
|
---|
1047 | /* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */
|
---|
1048 | /* */
|
---|
1049 | /* FT_FACE_FLAG_MULTIPLE_MASTERS :: */
|
---|
1050 | /* Indicates that the font contains multiple masters and is capable */
|
---|
1051 | /* of interpolating between them. See the multiple-masters */
|
---|
1052 | /* specific API for details. */
|
---|
1053 | /* */
|
---|
1054 | /* FT_FACE_FLAG_GLYPH_NAMES :: */
|
---|
1055 | /* Indicates that the font contains glyph names that can be */
|
---|
1056 | /* retrieved through @FT_Get_Glyph_Name. Note that some TrueType */
|
---|
1057 | /* fonts contain broken glyph name tables. Use the function */
|
---|
1058 | /* @FT_Has_PS_Glyph_Names when needed. */
|
---|
1059 | /* */
|
---|
1060 | /* FT_FACE_FLAG_EXTERNAL_STREAM :: */
|
---|
1061 | /* Used internally by FreeType to indicate that a face's stream was */
|
---|
1062 | /* provided by the client application and should not be destroyed */
|
---|
1063 | /* when @FT_Done_Face is called. Don't read or test this flag. */
|
---|
1064 | /* */
|
---|
1065 | /* FT_FACE_FLAG_HINTER :: */
|
---|
1066 | /* Set if the font driver has a hinting machine of its own. For */
|
---|
1067 | /* example, with TrueType fonts, it makes sense to use data from */
|
---|
1068 | /* the SFNT `gasp' table only if the native TrueType hinting engine */
|
---|
1069 | /* (with the bytecode interpreter) is available and active. */
|
---|
1070 | /* */
|
---|
1071 | #define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
|
---|
1072 | #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
|
---|
1073 | #define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )
|
---|
1074 | #define FT_FACE_FLAG_SFNT ( 1L << 3 )
|
---|
1075 | #define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 )
|
---|
1076 | #define FT_FACE_FLAG_VERTICAL ( 1L << 5 )
|
---|
1077 | #define FT_FACE_FLAG_KERNING ( 1L << 6 )
|
---|
1078 | #define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 )
|
---|
1079 | #define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 )
|
---|
1080 | #define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 )
|
---|
1081 | #define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )
|
---|
1082 | #define FT_FACE_FLAG_HINTER ( 1L << 11 )
|
---|
1083 |
|
---|
1084 | /* */
|
---|
1085 |
|
---|
1086 |
|
---|
1087 | /*************************************************************************/
|
---|
1088 | /* */
|
---|
1089 | /* @macro: */
|
---|
1090 | /* FT_HAS_HORIZONTAL( face ) */
|
---|
1091 | /* */
|
---|
1092 | /* @description: */
|
---|
1093 | /* A macro that returns true whenever a face object contains */
|
---|
1094 | /* horizontal metrics (this is true for all font formats though). */
|
---|
1095 | /* */
|
---|
1096 | /* @also: */
|
---|
1097 | /* @FT_HAS_VERTICAL can be used to check for vertical metrics. */
|
---|
1098 | /* */
|
---|
1099 | #define FT_HAS_HORIZONTAL( face ) \
|
---|
1100 | ( face->face_flags & FT_FACE_FLAG_HORIZONTAL )
|
---|
1101 |
|
---|
1102 |
|
---|
1103 | /*************************************************************************/
|
---|
1104 | /* */
|
---|
1105 | /* @macro: */
|
---|
1106 | /* FT_HAS_VERTICAL( face ) */
|
---|
1107 | /* */
|
---|
1108 | /* @description: */
|
---|
1109 | /* A macro that returns true whenever a face object contains vertical */
|
---|
1110 | /* metrics. */
|
---|
1111 | /* */
|
---|
1112 | #define FT_HAS_VERTICAL( face ) \
|
---|
1113 | ( face->face_flags & FT_FACE_FLAG_VERTICAL )
|
---|
1114 |
|
---|
1115 |
|
---|
1116 | /*************************************************************************/
|
---|
1117 | /* */
|
---|
1118 | /* @macro: */
|
---|
1119 | /* FT_HAS_KERNING( face ) */
|
---|
1120 | /* */
|
---|
1121 | /* @description: */
|
---|
1122 | /* A macro that returns true whenever a face object contains kerning */
|
---|
1123 | /* data that can be accessed with @FT_Get_Kerning. */
|
---|
1124 | /* */
|
---|
1125 | #define FT_HAS_KERNING( face ) \
|
---|
1126 | ( face->face_flags & FT_FACE_FLAG_KERNING )
|
---|
1127 |
|
---|
1128 |
|
---|
1129 | /*************************************************************************/
|
---|
1130 | /* */
|
---|
1131 | /* @macro: */
|
---|
1132 | /* FT_IS_SCALABLE( face ) */
|
---|
1133 | /* */
|
---|
1134 | /* @description: */
|
---|
1135 | /* A macro that returns true whenever a face object contains a */
|
---|
1136 | /* scalable font face (true for TrueType, Type 1, CID, and */
|
---|
1137 | /* OpenType/CFF font formats. */
|
---|
1138 | /* */
|
---|
1139 | #define FT_IS_SCALABLE( face ) \
|
---|
1140 | ( face->face_flags & FT_FACE_FLAG_SCALABLE )
|
---|
1141 |
|
---|
1142 |
|
---|
1143 | /*************************************************************************/
|
---|
1144 | /* */
|
---|
1145 | /* @macro: */
|
---|
1146 | /* FT_IS_SFNT( face ) */
|
---|
1147 | /* */
|
---|
1148 | /* @description: */
|
---|
1149 | /* A macro that returns true whenever a face object contains a font */
|
---|
1150 | /* whose format is based on the SFNT storage scheme. This usually */
|
---|
1151 | /* means: TrueType fonts, OpenType fonts, as well as SFNT-based */
|
---|
1152 | /* embedded bitmap fonts. */
|
---|
1153 | /* */
|
---|
1154 | /* If this macro is true, all functions defined in @FT_SFNT_NAMES_H */
|
---|
1155 | /* and @FT_TRUETYPE_TABLES_H are available. */
|
---|
1156 | /* */
|
---|
1157 | #define FT_IS_SFNT( face ) \
|
---|
1158 | ( face->face_flags & FT_FACE_FLAG_SFNT )
|
---|
1159 |
|
---|
1160 |
|
---|
1161 | /*************************************************************************/
|
---|
1162 | /* */
|
---|
1163 | /* @macro: */
|
---|
1164 | /* FT_IS_FIXED_WIDTH( face ) */
|
---|
1165 | /* */
|
---|
1166 | /* @description: */
|
---|
1167 | /* A macro that returns true whenever a face object contains a font */
|
---|
1168 | /* face that contains fixed-width (or "monospace", "fixed-pitch", */
|
---|
1169 | /* etc.) glyphs. */
|
---|
1170 | /* */
|
---|
1171 | #define FT_IS_FIXED_WIDTH( face ) \
|
---|
1172 | ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
|
---|
1173 |
|
---|
1174 |
|
---|
1175 | /*************************************************************************/
|
---|
1176 | /* */
|
---|
1177 | /* @macro: */
|
---|
1178 | /* FT_HAS_FIXED_SIZES( face ) */
|
---|
1179 | /* */
|
---|
1180 | /* @description: */
|
---|
1181 | /* A macro that returns true whenever a face object contains some */
|
---|
1182 | /* embedded bitmaps. See the `available_sizes' field of the */
|
---|
1183 | /* @FT_FaceRec structure. */
|
---|
1184 | /* */
|
---|
1185 | #define FT_HAS_FIXED_SIZES( face ) \
|
---|
1186 | ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
|
---|
1187 |
|
---|
1188 |
|
---|
1189 | /* */
|
---|
1190 |
|
---|
1191 |
|
---|
1192 | /*************************************************************************/
|
---|
1193 | /* */
|
---|
1194 | /* @macro: */
|
---|
1195 | /* FT_HAS_FAST_GLYPHS( face ) */
|
---|
1196 | /* */
|
---|
1197 | /* @description: */
|
---|
1198 | /* Deprecated; indicates that the face contains so-called "fast" */
|
---|
1199 | /* glyph bitmaps. */
|
---|
1200 | /* */
|
---|
1201 | #define FT_HAS_FAST_GLYPHS( face ) \
|
---|
1202 | ( face->face_flags & FT_FACE_FLAG_FAST_GLYPHS )
|
---|
1203 |
|
---|
1204 |
|
---|
1205 | /*************************************************************************/
|
---|
1206 | /* */
|
---|
1207 | /* @macro: */
|
---|
1208 | /* FT_HAS_GLYPH_NAMES( face ) */
|
---|
1209 | /* */
|
---|
1210 | /* @description: */
|
---|
1211 | /* A macro that returns true whenever a face object contains some */
|
---|
1212 | /* glyph names that can be accessed through @FT_Get_Glyph_Name. */
|
---|
1213 | /* */
|
---|
1214 | #define FT_HAS_GLYPH_NAMES( face ) \
|
---|
1215 | ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
|
---|
1216 |
|
---|
1217 |
|
---|
1218 | /*************************************************************************/
|
---|
1219 | /* */
|
---|
1220 | /* @macro: */
|
---|
1221 | /* FT_HAS_MULTIPLE_MASTERS( face ) */
|
---|
1222 | /* */
|
---|
1223 | /* @description: */
|
---|
1224 | /* A macro that returns true whenever a face object contains some */
|
---|
1225 | /* multiple masters. The functions provided by */
|
---|
1226 | /* @FT_MULTIPLE_MASTERS_H are then available to choose the exact */
|
---|
1227 | /* design you want. */
|
---|
1228 | /* */
|
---|
1229 | #define FT_HAS_MULTIPLE_MASTERS( face ) \
|
---|
1230 | ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
|
---|
1231 |
|
---|
1232 |
|
---|
1233 | /*************************************************************************/
|
---|
1234 | /* */
|
---|
1235 | /* <Constant> */
|
---|
1236 | /* FT_STYLE_FLAG_XXX */
|
---|
1237 | /* */
|
---|
1238 | /* <Description> */
|
---|
1239 | /* A list of bit-flags used to indicate the style of a given face. */
|
---|
1240 | /* These are used in the `style_flags' field of @FT_FaceRec. */
|
---|
1241 | /* */
|
---|
1242 | /* <Values> */
|
---|
1243 | /* FT_STYLE_FLAG_ITALIC :: */
|
---|
1244 | /* Indicates that a given face is italicized. */
|
---|
1245 | /* */
|
---|
1246 | /* FT_STYLE_FLAG_BOLD :: */
|
---|
1247 | /* Indicates that a given face is bold. */
|
---|
1248 | /* */
|
---|
1249 | #define FT_STYLE_FLAG_ITALIC ( 1 << 0 )
|
---|
1250 | #define FT_STYLE_FLAG_BOLD ( 1 << 1 )
|
---|
1251 |
|
---|
1252 |
|
---|
1253 | /*************************************************************************/
|
---|
1254 | /* */
|
---|
1255 | /* <Type> */
|
---|
1256 | /* FT_Size_Internal */
|
---|
1257 | /* */
|
---|
1258 | /* <Description> */
|
---|
1259 | /* An opaque handle to an FT_Size_InternalRec structure, used to */
|
---|
1260 | /* model private data of a given FT_Size object. */
|
---|
1261 | /* */
|
---|
1262 | typedef struct FT_Size_InternalRec_* FT_Size_Internal;
|
---|
1263 |
|
---|
1264 |
|
---|
1265 | /*************************************************************************/
|
---|
1266 | /* */
|
---|
1267 | /* <Struct> */
|
---|
1268 | /* FT_Size_Metrics */
|
---|
1269 | /* */
|
---|
1270 | /* <Description> */
|
---|
1271 | /* The size metrics structure returned scaled important distances for */
|
---|
1272 | /* a given size object. */
|
---|
1273 | /* */
|
---|
1274 | /* <Fields> */
|
---|
1275 | /* x_ppem :: The character width, expressed in integer pixels. */
|
---|
1276 | /* This is the width of the EM square expressed in */
|
---|
1277 | /* pixels, hence the term `ppem' (pixels per EM). */
|
---|
1278 | /* */
|
---|
1279 | /* y_ppem :: The character height, expressed in integer pixels. */
|
---|
1280 | /* This is the height of the EM square expressed in */
|
---|
1281 | /* pixels, hence the term `ppem' (pixels per EM). */
|
---|
1282 | /* */
|
---|
1283 | /* x_scale :: A simple 16.16 fixed point format coefficient used */
|
---|
1284 | /* to scale horizontal distances expressed in font */
|
---|
1285 | /* units to fractional (26.6) pixel coordinates. */
|
---|
1286 | /* */
|
---|
1287 | /* y_scale :: A simple 16.16 fixed point format coefficient used */
|
---|
1288 | /* to scale vertical distances expressed in font */
|
---|
1289 | /* units to fractional (26.6) pixel coordinates. */
|
---|
1290 | /* */
|
---|
1291 | /* ascender :: The ascender, expressed in 26.6 fixed point */
|
---|
1292 | /* pixels. Positive for ascenders above the */
|
---|
1293 | /* baseline. */
|
---|
1294 | /* */
|
---|
1295 | /* descender :: The descender, expressed in 26.6 fixed point */
|
---|
1296 | /* pixels. Negative for descenders below the */
|
---|
1297 | /* baseline. */
|
---|
1298 | /* */
|
---|
1299 | /* height :: The text height, expressed in 26.6 fixed point */
|
---|
1300 | /* pixels. Always positive. */
|
---|
1301 | /* */
|
---|
1302 | /* max_advance :: Maximum horizontal advance, expressed in 26.6 */
|
---|
1303 | /* fixed point pixels. Always positive. */
|
---|
1304 | /* */
|
---|
1305 | /* <Note> */
|
---|
1306 | /* For scalable fonts, the values of `ascender', `descender', and */
|
---|
1307 | /* `height' are scaled versions of `face->ascender', */
|
---|
1308 | /* `face->descender', and `face->height', respectively. */
|
---|
1309 | /* */
|
---|
1310 | /* Unfortunately, due to glyph hinting, these values might not be */
|
---|
1311 | /* exact for certain fonts. They thus must be treated as unreliable */
|
---|
1312 | /* with an error margin of at least one pixel! */
|
---|
1313 | /* */
|
---|
1314 | /* Indeed, the only way to get the exact pixel ascender and descender */
|
---|
1315 | /* is to render _all_ glyphs. As this would be a definite */
|
---|
1316 | /* performance hit, it is up to client applications to perform such */
|
---|
1317 | /* computations. */
|
---|
1318 | /* */
|
---|
1319 | typedef struct FT_Size_Metrics_
|
---|
1320 | {
|
---|
1321 | FT_UShort x_ppem; /* horizontal pixels per EM */
|
---|
1322 | FT_UShort y_ppem; /* vertical pixels per EM */
|
---|
1323 |
|
---|
1324 | FT_Fixed x_scale; /* two scales used to convert font units */
|
---|
1325 | FT_Fixed y_scale; /* to 26.6 frac. pixel coordinates */
|
---|
1326 |
|
---|
1327 | FT_Pos ascender; /* ascender in 26.6 frac. pixels */
|
---|
1328 | FT_Pos descender; /* descender in 26.6 frac. pixels */
|
---|
1329 | FT_Pos height; /* text height in 26.6 frac. pixels */
|
---|
1330 | FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */
|
---|
1331 |
|
---|
1332 | } FT_Size_Metrics;
|
---|
1333 |
|
---|
1334 |
|
---|
1335 | /*************************************************************************/
|
---|
1336 | /* */
|
---|
1337 | /* <Struct> */
|
---|
1338 | /* FT_SizeRec */
|
---|
1339 | /* */
|
---|
1340 | /* <Description> */
|
---|
1341 | /* FreeType root size class structure. A size object models the */
|
---|
1342 | /* resolution and pointsize dependent data of a given face. */
|
---|
1343 | /* */
|
---|
1344 | /* <Fields> */
|
---|
1345 | /* face :: Handle to the parent face object. */
|
---|
1346 | /* */
|
---|
1347 | /* generic :: A typeless pointer, which is unused by the FreeType */
|
---|
1348 | /* library or any of its drivers. It can be used by */
|
---|
1349 | /* client applications to link their own data to each size */
|
---|
1350 | /* object. */
|
---|
1351 | /* */
|
---|
1352 | /* metrics :: Metrics for this size object. This field is read-only. */
|
---|
1353 | /* */
|
---|
1354 | typedef struct FT_SizeRec_
|
---|
1355 | {
|
---|
1356 | FT_Face face; /* parent face object */
|
---|
1357 | FT_Generic generic; /* generic pointer for client uses */
|
---|
1358 | FT_Size_Metrics metrics; /* size metrics */
|
---|
1359 | FT_Size_Internal internal;
|
---|
1360 |
|
---|
1361 | } FT_SizeRec;
|
---|
1362 |
|
---|
1363 |
|
---|
1364 | /*************************************************************************/
|
---|
1365 | /* */
|
---|
1366 | /* <Struct> */
|
---|
1367 | /* FT_SubGlyph */
|
---|
1368 | /* */
|
---|
1369 | /* <Description> */
|
---|
1370 | /* The subglyph structure is an internal object used to describe */
|
---|
1371 | /* subglyphs (for example, in the case of composites). */
|
---|
1372 | /* */
|
---|
1373 | /* <Note> */
|
---|
1374 | /* The subglyph implementation is not part of the high-level API, */
|
---|
1375 | /* hence the forward structure declaration. */
|
---|
1376 | /* */
|
---|
1377 | typedef struct FT_SubGlyphRec_* FT_SubGlyph;
|
---|
1378 |
|
---|
1379 |
|
---|
1380 | /*************************************************************************/
|
---|
1381 | /* */
|
---|
1382 | /* <Type> */
|
---|
1383 | /* FT_Slot_Internal */
|
---|
1384 | /* */
|
---|
1385 | /* <Description> */
|
---|
1386 | /* An opaque handle to an FT_Slot_InternalRec structure, used to */
|
---|
1387 | /* model private data of a given FT_GlyphSlot object. */
|
---|
1388 | /* */
|
---|
1389 | typedef struct FT_Slot_InternalRec_* FT_Slot_Internal;
|
---|
1390 |
|
---|
1391 |
|
---|
1392 | /*************************************************************************/
|
---|
1393 | /* */
|
---|
1394 | /* <Struct> */
|
---|
1395 | /* FT_GlyphSlotRec */
|
---|
1396 | /* */
|
---|
1397 | /* <Description> */
|
---|
1398 | /* FreeType root glyph slot class structure. A glyph slot is a */
|
---|
1399 | /* container where individual glyphs can be loaded, be they */
|
---|
1400 | /* vectorial or bitmap/graymaps. */
|
---|
1401 | /* */
|
---|
1402 | /* <Fields> */
|
---|
1403 | /* library :: A handle to the FreeType library instance */
|
---|
1404 | /* this slot belongs to. */
|
---|
1405 | /* */
|
---|
1406 | /* face :: A handle to the parent face object. */
|
---|
1407 | /* */
|
---|
1408 | /* next :: In some cases (like some font tools), several */
|
---|
1409 | /* glyph slots per face object can be a good */
|
---|
1410 | /* thing. As this is rare, the glyph slots are */
|
---|
1411 | /* listed through a direct, single-linked list */
|
---|
1412 | /* using its `next' field. */
|
---|
1413 | /* */
|
---|
1414 | /* generic :: A typeless pointer which is unused by the */
|
---|
1415 | /* FreeType library or any of its drivers. It */
|
---|
1416 | /* can be used by client applications to link */
|
---|
1417 | /* their own data to each glyph slot object. */
|
---|
1418 | /* */
|
---|
1419 | /* metrics :: The metrics of the last loaded glyph in the */
|
---|
1420 | /* slot. The returned values depend on the last */
|
---|
1421 | /* load flags (see the @FT_Load_Glyph API */
|
---|
1422 | /* function) and can be expressed either in 26.6 */
|
---|
1423 | /* fractional pixels or font units. */
|
---|
1424 | /* */
|
---|
1425 | /* Note that even when the glyph image is */
|
---|
1426 | /* transformed, the metrics are not. */
|
---|
1427 | /* */
|
---|
1428 | /* linearHoriAdvance :: For scalable formats only, this field holds */
|
---|
1429 | /* the linearly scaled horizontal advance width */
|
---|
1430 | /* for the glyph (i.e. the scaled and unhinted */
|
---|
1431 | /* value of the hori advance). This can be */
|
---|
1432 | /* important to perform correct WYSIWYG layout. */
|
---|
1433 | /* */
|
---|
1434 | /* Note that this value is expressed by default */
|
---|
1435 | /* in 16.16 pixels. However, when the glyph is */
|
---|
1436 | /* loaded with the FT_LOAD_LINEAR_DESIGN flag, */
|
---|
1437 | /* this field contains simply the value of the */
|
---|
1438 | /* advance in original font units. */
|
---|
1439 | /* */
|
---|
1440 | /* linearVertAdvance :: For scalable formats only, this field holds */
|
---|
1441 | /* the linearly scaled vertical advance height */
|
---|
1442 | /* for the glyph. See linearHoriAdvance for */
|
---|
1443 | /* comments. */
|
---|
1444 | /* */
|
---|
1445 | /* advance :: This is the transformed advance width for the */
|
---|
1446 | /* glyph. */
|
---|
1447 | /* */
|
---|
1448 | /* format :: This field indicates the format of the image */
|
---|
1449 | /* contained in the glyph slot. Typically */
|
---|
1450 | /* FT_GLYPH_FORMAT_BITMAP, */
|
---|
1451 | /* FT_GLYPH_FORMAT_OUTLINE, and */
|
---|
1452 | /* FT_GLYPH_FORMAT_COMPOSITE, but others are */
|
---|
1453 | /* possible. */
|
---|
1454 | /* */
|
---|
1455 | /* bitmap :: This field is used as a bitmap descriptor */
|
---|
1456 | /* when the slot format is */
|
---|
1457 | /* FT_GLYPH_FORMAT_BITMAP. Note that the */
|
---|
1458 | /* address and content of the bitmap buffer can */
|
---|
1459 | /* change between calls of @FT_Load_Glyph and a */
|
---|
1460 | /* few other functions. */
|
---|
1461 | /* */
|
---|
1462 | /* bitmap_left :: This is the bitmap's left bearing expressed */
|
---|
1463 | /* in integer pixels. Of course, this is only */
|
---|
1464 | /* valid if the format is */
|
---|
1465 | /* FT_GLYPH_FORMAT_BITMAP. */
|
---|
1466 | /* */
|
---|
1467 | /* bitmap_top :: This is the bitmap's top bearing expressed in */
|
---|
1468 | /* integer pixels. Remember that this is the */
|
---|
1469 | /* distance from the baseline to the top-most */
|
---|
1470 | /* glyph scanline, upwards y-coordinates being */
|
---|
1471 | /* *positive*. */
|
---|
1472 | /* */
|
---|
1473 | /* outline :: The outline descriptor for the current glyph */
|
---|
1474 | /* image if its format is */
|
---|
1475 | /* FT_GLYPH_FORMAT_OUTLINE. */
|
---|
1476 | /* */
|
---|
1477 | /* num_subglyphs :: The number of subglyphs in a composite glyph. */
|
---|
1478 | /* This field is only valid for the composite */
|
---|
1479 | /* glyph format that should normally only be */
|
---|
1480 | /* loaded with the @FT_LOAD_NO_RECURSE flag. */
|
---|
1481 | /* For now this is internal to FreeType. */
|
---|
1482 | /* */
|
---|
1483 | /* subglyphs :: An array of subglyph descriptors for */
|
---|
1484 | /* composite glyphs. There are `num_subglyphs' */
|
---|
1485 | /* elements in there. Currently internal to */
|
---|
1486 | /* FreeType. */
|
---|
1487 | /* */
|
---|
1488 | /* control_data :: Certain font drivers can also return the */
|
---|
1489 | /* control data for a given glyph image (e.g. */
|
---|
1490 | /* TrueType bytecode, Type 1 charstrings, etc.). */
|
---|
1491 | /* This field is a pointer to such data. */
|
---|
1492 | /* */
|
---|
1493 | /* control_len :: This is the length in bytes of the control */
|
---|
1494 | /* data. */
|
---|
1495 | /* */
|
---|
1496 | /* other :: Really wicked formats can use this pointer to */
|
---|
1497 | /* present their own glyph image to client */
|
---|
1498 | /* applications. Note that the application */
|
---|
1499 | /* needs to know about the image format. */
|
---|
1500 | /* */
|
---|
1501 | /* lsb_delta :: The difference between hinted and unhinted */
|
---|
1502 | /* left side bearing while autohinting is */
|
---|
1503 | /* active. Zero otherwise. */
|
---|
1504 | /* */
|
---|
1505 | /* rsb_delta :: The difference between hinted and unhinted */
|
---|
1506 | /* right side bearing while autohinting is */
|
---|
1507 | /* active. Zero otherwise. */
|
---|
1508 | /* */
|
---|
1509 | /* <Note> */
|
---|
1510 | /* If @FT_Load_Glyph is called with default flags (see */
|
---|
1511 | /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */
|
---|
1512 | /* its native format (e.g. a vectorial outline for TrueType and */
|
---|
1513 | /* Type 1 formats). */
|
---|
1514 | /* */
|
---|
1515 | /* This image can later be converted into a bitmap by calling */
|
---|
1516 | /* @FT_Render_Glyph. This function finds the current renderer for */
|
---|
1517 | /* the native image's format then invokes it. */
|
---|
1518 | /* */
|
---|
1519 | /* The renderer is in charge of transforming the native image through */
|
---|
1520 | /* the slot's face transformation fields, then convert it into a */
|
---|
1521 | /* bitmap that is returned in `slot->bitmap'. */
|
---|
1522 | /* */
|
---|
1523 | /* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */
|
---|
1524 | /* to specify the position of the bitmap relative to the current pen */
|
---|
1525 | /* position (e.g. coordinates [0,0] on the baseline). Of course, */
|
---|
1526 | /* `slot->format' is also changed to `FT_GLYPH_FORMAT_BITMAP' . */
|
---|
1527 | /* */
|
---|
1528 | /* <Note> */
|
---|
1529 | /* Here a small pseudo code fragment which shows how to use */
|
---|
1530 | /* `lsb_delta' and `rsb_delta': */
|
---|
1531 | /* */
|
---|
1532 | /* { */
|
---|
1533 | /* FT_Pos origin_x = 0; */
|
---|
1534 | /* FT_Pos prev_rsb_delta = 0; */
|
---|
1535 | /* */
|
---|
1536 | /* */
|
---|
1537 | /* for all glyphs do */
|
---|
1538 | /* <compute kern between current and previous glyph and add it to */
|
---|
1539 | /* `origin_x'> */
|
---|
1540 | /* */
|
---|
1541 | /* <load glyph with `FT_Load_Glyph'> */
|
---|
1542 | /* */
|
---|
1543 | /* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */
|
---|
1544 | /* origin_x -= 64; */
|
---|
1545 | /* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */
|
---|
1546 | /* origin_x += 64; */
|
---|
1547 | /* */
|
---|
1548 | /* prev_rsb_delta = face->glyph->rsb_delta; */
|
---|
1549 | /* */
|
---|
1550 | /* <save glyph image, or render glyph, or ...> */
|
---|
1551 | /* */
|
---|
1552 | /* origin_x += face->glyph->advance.x; */
|
---|
1553 | /* endfor */
|
---|
1554 | /* } */
|
---|
1555 | /* */
|
---|
1556 | typedef struct FT_GlyphSlotRec_
|
---|
1557 | {
|
---|
1558 | FT_Library library;
|
---|
1559 | FT_Face face;
|
---|
1560 | FT_GlyphSlot next;
|
---|
1561 | FT_UInt reserved; /* retained for binary compatibility */
|
---|
1562 | FT_Generic generic;
|
---|
1563 |
|
---|
1564 | FT_Glyph_Metrics metrics;
|
---|
1565 | FT_Fixed linearHoriAdvance;
|
---|
1566 | FT_Fixed linearVertAdvance;
|
---|
1567 | FT_Vector advance;
|
---|
1568 |
|
---|
1569 | FT_Glyph_Format format;
|
---|
1570 |
|
---|
1571 | FT_Bitmap bitmap;
|
---|
1572 | FT_Int bitmap_left;
|
---|
1573 | FT_Int bitmap_top;
|
---|
1574 |
|
---|
1575 | FT_Outline outline;
|
---|
1576 |
|
---|
1577 | FT_UInt num_subglyphs;
|
---|
1578 | FT_SubGlyph subglyphs;
|
---|
1579 |
|
---|
1580 | void* control_data;
|
---|
1581 | long control_len;
|
---|
1582 |
|
---|
1583 | FT_Pos lsb_delta;
|
---|
1584 | FT_Pos rsb_delta;
|
---|
1585 |
|
---|
1586 | void* other;
|
---|
1587 |
|
---|
1588 | FT_Slot_Internal internal;
|
---|
1589 |
|
---|
1590 | } FT_GlyphSlotRec;
|
---|
1591 |
|
---|
1592 |
|
---|
1593 | /*************************************************************************/
|
---|
1594 | /*************************************************************************/
|
---|
1595 | /* */
|
---|
1596 | /* F U N C T I O N S */
|
---|
1597 | /* */
|
---|
1598 | /*************************************************************************/
|
---|
1599 | /*************************************************************************/
|
---|
1600 |
|
---|
1601 |
|
---|
1602 | /*************************************************************************/
|
---|
1603 | /* */
|
---|
1604 | /* <Function> */
|
---|
1605 | /* FT_Init_FreeType */
|
---|
1606 | /* */
|
---|
1607 | /* <Description> */
|
---|
1608 | /* Initializes a new FreeType library object. The set of modules */
|
---|
1609 | /* that are registered by this function is determined at build time. */
|
---|
1610 | /* */
|
---|
1611 | /* <Output> */
|
---|
1612 | /* alibrary :: A handle to a new library object. */
|
---|
1613 | /* */
|
---|
1614 | /* <Return> */
|
---|
1615 | /* FreeType error code. 0 means success. */
|
---|
1616 | /* */
|
---|
1617 | FT_EXPORT( FT_Error )
|
---|
1618 | FT_Init_FreeType( FT_Library *alibrary );
|
---|
1619 |
|
---|
1620 |
|
---|
1621 | /*************************************************************************/
|
---|
1622 | /* */
|
---|
1623 | /* <Function> */
|
---|
1624 | /* FT_Library_Version */
|
---|
1625 | /* */
|
---|
1626 | /* <Description> */
|
---|
1627 | /* Return the version of the FreeType library being used. This is */
|
---|
1628 | /* useful when dynamically linking to the library, since one cannot */
|
---|
1629 | /* use the macros FT_FREETYPE_MAJOR, FT_FREETYPE_MINOR, and */
|
---|
1630 | /* FT_FREETYPE_PATCH. */
|
---|
1631 | /* */
|
---|
1632 | /* <Input> */
|
---|
1633 | /* library :: A source library handle. */
|
---|
1634 | /* */
|
---|
1635 | /* <Output> */
|
---|
1636 | /* amajor :: The major version number. */
|
---|
1637 | /* */
|
---|
1638 | /* aminor :: The minor version number. */
|
---|
1639 | /* */
|
---|
1640 | /* apatch :: The patch version number. */
|
---|
1641 | /* */
|
---|
1642 | /* <Note> */
|
---|
1643 | /* The reason why this function takes a 'library' argument is because */
|
---|
1644 | /* certain programs implement library initialization in a custom way */
|
---|
1645 | /* that doesn't use `FT_Init_FreeType'. */
|
---|
1646 | /* */
|
---|
1647 | /* In such cases, the library version might not be available before */
|
---|
1648 | /* the library object has been created. */
|
---|
1649 | /* */
|
---|
1650 | FT_EXPORT( void )
|
---|
1651 | FT_Library_Version( FT_Library library,
|
---|
1652 | FT_Int *amajor,
|
---|
1653 | FT_Int *aminor,
|
---|
1654 | FT_Int *apatch );
|
---|
1655 |
|
---|
1656 |
|
---|
1657 | /*************************************************************************/
|
---|
1658 | /* */
|
---|
1659 | /* <Function> */
|
---|
1660 | /* FT_Done_FreeType */
|
---|
1661 | /* */
|
---|
1662 | /* <Description> */
|
---|
1663 | /* Destroys a given FreeType library object and all of its childs, */
|
---|
1664 | /* including resources, drivers, faces, sizes, etc. */
|
---|
1665 | /* */
|
---|
1666 | /* <Input> */
|
---|
1667 | /* library :: A handle to the target library object. */
|
---|
1668 | /* */
|
---|
1669 | /* <Return> */
|
---|
1670 | /* FreeType error code. 0 means success. */
|
---|
1671 | /* */
|
---|
1672 | FT_EXPORT( FT_Error )
|
---|
1673 | FT_Done_FreeType( FT_Library library );
|
---|
1674 |
|
---|
1675 |
|
---|
1676 | /*************************************************************************/
|
---|
1677 | /* */
|
---|
1678 | /* <Enum> */
|
---|
1679 | /* FT_OPEN_XXX */
|
---|
1680 | /* */
|
---|
1681 | /* <Description> */
|
---|
1682 | /* A list of bit-field constants used within the `flags' field of the */
|
---|
1683 | /* @FT_Open_Args structure. */
|
---|
1684 | /* */
|
---|
1685 | /* <Values> */
|
---|
1686 | /* FT_OPEN_MEMORY :: This is a memory-based stream. */
|
---|
1687 | /* */
|
---|
1688 | /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */
|
---|
1689 | /* */
|
---|
1690 | /* FT_OPEN_PATHNAME :: Create a new input stream from a C */
|
---|
1691 | /* path name. */
|
---|
1692 | /* */
|
---|
1693 | /* FT_OPEN_DRIVER :: Use the `driver' field. */
|
---|
1694 | /* */
|
---|
1695 | /* FT_OPEN_PARAMS :: Use the `num_params' & `params' field. */
|
---|
1696 | /* */
|
---|
1697 | /* ft_open_memory :: Deprecated; use @FT_OPEN_MEMORY instead. */
|
---|
1698 | /* */
|
---|
1699 | /* ft_open_stream :: Deprecated; use @FT_OPEN_STREAM instead. */
|
---|
1700 | /* */
|
---|
1701 | /* ft_open_pathname :: Deprecated; use @FT_OPEN_PATHNAME instead. */
|
---|
1702 | /* */
|
---|
1703 | /* ft_open_driver :: Deprecated; use @FT_OPEN_DRIVER instead. */
|
---|
1704 | /* */
|
---|
1705 | /* ft_open_params :: Deprecated; use @FT_OPEN_PARAMS instead. */
|
---|
1706 | /* */
|
---|
1707 | /* <Note> */
|
---|
1708 | /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */
|
---|
1709 | /* flags are mutually exclusive. */
|
---|
1710 | /* */
|
---|
1711 | #define FT_OPEN_MEMORY 0x1
|
---|
1712 | #define FT_OPEN_STREAM 0x2
|
---|
1713 | #define FT_OPEN_PATHNAME 0x4
|
---|
1714 | #define FT_OPEN_DRIVER 0x8
|
---|
1715 | #define FT_OPEN_PARAMS 0x10
|
---|
1716 |
|
---|
1717 | #define ft_open_memory FT_OPEN_MEMORY /* deprecated */
|
---|
1718 | #define ft_open_stream FT_OPEN_STREAM /* deprecated */
|
---|
1719 | #define ft_open_pathname FT_OPEN_PATHNAME /* deprecated */
|
---|
1720 | #define ft_open_driver FT_OPEN_DRIVER /* deprecated */
|
---|
1721 | #define ft_open_params FT_OPEN_PARAMS /* deprecated */
|
---|
1722 |
|
---|
1723 |
|
---|
1724 | /*************************************************************************/
|
---|
1725 | /* */
|
---|
1726 | /* <Struct> */
|
---|
1727 | /* FT_Parameter */
|
---|
1728 | /* */
|
---|
1729 | /* <Description> */
|
---|
1730 | /* A simple structure used to pass more or less generic parameters */
|
---|
1731 | /* to @FT_Open_Face. */
|
---|
1732 | /* */
|
---|
1733 | /* <Fields> */
|
---|
1734 | /* tag :: A 4-byte identification tag. */
|
---|
1735 | /* */
|
---|
1736 | /* data :: A pointer to the parameter data. */
|
---|
1737 | /* */
|
---|
1738 | /* <Note> */
|
---|
1739 | /* The id and function of parameters are driver-specific. */
|
---|
1740 | /* */
|
---|
1741 | typedef struct FT_Parameter_
|
---|
1742 | {
|
---|
1743 | FT_ULong tag;
|
---|
1744 | FT_Pointer data;
|
---|
1745 |
|
---|
1746 | } FT_Parameter;
|
---|
1747 |
|
---|
1748 |
|
---|
1749 | /*************************************************************************/
|
---|
1750 | /* */
|
---|
1751 | /* <Struct> */
|
---|
1752 | /* FT_Open_Args */
|
---|
1753 | /* */
|
---|
1754 | /* <Description> */
|
---|
1755 | /* A structure used to indicate how to open a new font file/stream. */
|
---|
1756 | /* A pointer to such a structure can be used as a parameter for the */
|
---|
1757 | /* functions @FT_Open_Face and @FT_Attach_Stream. */
|
---|
1758 | /* */
|
---|
1759 | /* <Fields> */
|
---|
1760 | /* flags :: A set of bit flags indicating how to use the */
|
---|
1761 | /* structure. */
|
---|
1762 | /* */
|
---|
1763 | /* memory_base :: The first byte of the file in memory. */
|
---|
1764 | /* */
|
---|
1765 | /* memory_size :: The size in bytes of the file in memory. */
|
---|
1766 | /* */
|
---|
1767 | /* pathname :: A pointer to an 8-bit file pathname. */
|
---|
1768 | /* */
|
---|
1769 | /* stream :: A handle to a source stream object. */
|
---|
1770 | /* */
|
---|
1771 | /* driver :: This field is exclusively used by @FT_Open_Face; */
|
---|
1772 | /* it simply specifies the font driver to use to open */
|
---|
1773 | /* the face. If set to 0, FreeType tries to load the */
|
---|
1774 | /* face with each one of the drivers in its list. */
|
---|
1775 | /* */
|
---|
1776 | /* num_params :: The number of extra parameters. */
|
---|
1777 | /* */
|
---|
1778 | /* params :: Extra parameters passed to the font driver when */
|
---|
1779 | /* opening a new face. */
|
---|
1780 | /* */
|
---|
1781 | /* <Note> */
|
---|
1782 | /* The stream type is determined by the contents of `flags' which */
|
---|
1783 | /* are tested in the following order by @FT_Open_Face: */
|
---|
1784 | /* */
|
---|
1785 | /* If the `FT_OPEN_MEMORY' bit is set, assume that this is a */
|
---|
1786 | /* memory file of `memory_size' bytes,located at `memory_address'. */
|
---|
1787 | /* */
|
---|
1788 | /* Otherwise, if the `FT_OPEN_STREAM' bit is set, assume that a */
|
---|
1789 | /* custom input stream `stream' is used. */
|
---|
1790 | /* */
|
---|
1791 | /* Otherwise, if the `FT_OPEN_PATHNAME' bit is set, assume that this */
|
---|
1792 | /* is a normal file and use `pathname' to open it. */
|
---|
1793 | /* */
|
---|
1794 | /* If the `FT_OPEN_DRIVER' bit is set, @FT_Open_Face only tries to */
|
---|
1795 | /* open the file with the driver whose handler is in `driver'. */
|
---|
1796 | /* */
|
---|
1797 | /* If the `FT_OPEN_PARAMS' bit is set, the parameters given by */
|
---|
1798 | /* `num_params' and `params' is used. They are ignored otherwise. */
|
---|
1799 | /* */
|
---|
1800 | typedef struct FT_Open_Args_
|
---|
1801 | {
|
---|
1802 | FT_UInt flags;
|
---|
1803 | const FT_Byte* memory_base;
|
---|
1804 | FT_Long memory_size;
|
---|
1805 | FT_String* pathname;
|
---|
1806 | FT_Stream stream;
|
---|
1807 | FT_Module driver;
|
---|
1808 | FT_Int num_params;
|
---|
1809 | FT_Parameter* params;
|
---|
1810 |
|
---|
1811 | } FT_Open_Args;
|
---|
1812 |
|
---|
1813 |
|
---|
1814 | /*************************************************************************/
|
---|
1815 | /* */
|
---|
1816 | /* <Function> */
|
---|
1817 | /* FT_New_Face */
|
---|
1818 | /* */
|
---|
1819 | /* <Description> */
|
---|
1820 | /* Creates a new face object from a given resource and typeface index */
|
---|
1821 | /* using a pathname to the font file. */
|
---|
1822 | /* */
|
---|
1823 | /* <InOut> */
|
---|
1824 | /* library :: A handle to the library resource. */
|
---|
1825 | /* */
|
---|
1826 | /* <Input> */
|
---|
1827 | /* pathname :: A path to the font file. */
|
---|
1828 | /* */
|
---|
1829 | /* face_index :: The index of the face within the resource. The */
|
---|
1830 | /* first face has index 0. */
|
---|
1831 | /* */
|
---|
1832 | /* <Output> */
|
---|
1833 | /* aface :: A handle to a new face object. */
|
---|
1834 | /* */
|
---|
1835 | /* <Return> */
|
---|
1836 | /* FreeType error code. 0 means success. */
|
---|
1837 | /* */
|
---|
1838 | /* <Note> */
|
---|
1839 | /* Unlike FreeType 1.x, this function automatically creates a glyph */
|
---|
1840 | /* slot for the face object which can be accessed directly through */
|
---|
1841 | /* `face->glyph'. */
|
---|
1842 | /* */
|
---|
1843 | /* @FT_New_Face can be used to determine and/or check the font format */
|
---|
1844 | /* of a given font resource. If the `face_index' field is negative, */
|
---|
1845 | /* the function does _not_ return any face handle in `aface'; the */
|
---|
1846 | /* return value is 0 if the font format is recognized, or non-zero */
|
---|
1847 | /* otherwise. */
|
---|
1848 | /* */
|
---|
1849 | /* Each new face object created with this function also owns a */
|
---|
1850 | /* default @FT_Size object, accessible as `face->size'. */
|
---|
1851 | /* */
|
---|
1852 | FT_EXPORT( FT_Error )
|
---|
1853 | FT_New_Face( FT_Library library,
|
---|
1854 | const char* filepathname,
|
---|
1855 | FT_Long face_index,
|
---|
1856 | FT_Face *aface );
|
---|
1857 |
|
---|
1858 |
|
---|
1859 | /*************************************************************************/
|
---|
1860 | /* */
|
---|
1861 | /* <Function> */
|
---|
1862 | /* FT_New_Memory_Face */
|
---|
1863 | /* */
|
---|
1864 | /* <Description> */
|
---|
1865 | /* Creates a new face object from a given resource and typeface index */
|
---|
1866 | /* using a font file already loaded into memory. */
|
---|
1867 | /* */
|
---|
1868 | /* <InOut> */
|
---|
1869 | /* library :: A handle to the library resource. */
|
---|
1870 | /* */
|
---|
1871 | /* <Input> */
|
---|
1872 | /* file_base :: A pointer to the beginning of the font data. */
|
---|
1873 | /* */
|
---|
1874 | /* file_size :: The size of the memory chunk used by the font data. */
|
---|
1875 | /* */
|
---|
1876 | /* face_index :: The index of the face within the resource. The */
|
---|
1877 | /* first face has index 0. */
|
---|
1878 | /* */
|
---|
1879 | /* <Output> */
|
---|
1880 | /* aface :: A handle to a new face object. */
|
---|
1881 | /* */
|
---|
1882 | /* <Return> */
|
---|
1883 | /* FreeType error code. 0 means success. */
|
---|
1884 | /* */
|
---|
1885 | /* <Note> */
|
---|
1886 | /* The font data bytes are used _directly_ by the @FT_Face object. */
|
---|
1887 | /* This means that they are not copied, and that the client is */
|
---|
1888 | /* responsible for releasing/destroying them _after_ the */
|
---|
1889 | /* corresponding call to @FT_Done_Face . */
|
---|
1890 | /* */
|
---|
1891 | /* Unlike FreeType 1.x, this function automatically creates a glyph */
|
---|
1892 | /* slot for the face object which can be accessed directly through */
|
---|
1893 | /* `face->glyph'. */
|
---|
1894 | /* */
|
---|
1895 | /* @FT_New_Memory_Face can be used to determine and/or check the font */
|
---|
1896 | /* format of a given font resource. If the `face_index' field is */
|
---|
1897 | /* negative, the function does _not_ return any face handle in */
|
---|
1898 | /* `aface'; the return value is 0 if the font format is recognized, */
|
---|
1899 | /* or non-zero otherwise. */
|
---|
1900 | /* */
|
---|
1901 | FT_EXPORT( FT_Error )
|
---|
1902 | FT_New_Memory_Face( FT_Library library,
|
---|
1903 | const FT_Byte* file_base,
|
---|
1904 | FT_Long file_size,
|
---|
1905 | FT_Long face_index,
|
---|
1906 | FT_Face *aface );
|
---|
1907 |
|
---|
1908 |
|
---|
1909 | /*************************************************************************/
|
---|
1910 | /* */
|
---|
1911 | /* <Function> */
|
---|
1912 | /* FT_Open_Face */
|
---|
1913 | /* */
|
---|
1914 | /* <Description> */
|
---|
1915 | /* Opens a face object from a given resource and typeface index using */
|
---|
1916 | /* an `FT_Open_Args' structure. If the face object doesn't exist, it */
|
---|
1917 | /* is created. */
|
---|
1918 | /* */
|
---|
1919 | /* <InOut> */
|
---|
1920 | /* library :: A handle to the library resource. */
|
---|
1921 | /* */
|
---|
1922 | /* <Input> */
|
---|
1923 | /* args :: A pointer to an `FT_Open_Args' structure which must */
|
---|
1924 | /* be filled by the caller. */
|
---|
1925 | /* */
|
---|
1926 | /* face_index :: The index of the face within the resource. The */
|
---|
1927 | /* first face has index 0. */
|
---|
1928 | /* */
|
---|
1929 | /* <Output> */
|
---|
1930 | /* aface :: A handle to a new face object. */
|
---|
1931 | /* */
|
---|
1932 | /* <Return> */
|
---|
1933 | /* FreeType error code. 0 means success. */
|
---|
1934 | /* */
|
---|
1935 | /* <Note> */
|
---|
1936 | /* Unlike FreeType 1.x, this function automatically creates a glyph */
|
---|
1937 | /* slot for the face object which can be accessed directly through */
|
---|
1938 | /* `face->glyph'. */
|
---|
1939 | /* */
|
---|
1940 | /* @FT_Open_Face can be used to determine and/or check the font */
|
---|
1941 | /* format of a given font resource. If the `face_index' field is */
|
---|
1942 | /* negative, the function does _not_ return any face handle in */
|
---|
1943 | /* `*aface'; the function's return value is 0 if the font format is */
|
---|
1944 | /* recognized, or non-zero otherwise. */
|
---|
1945 | /* */
|
---|
1946 | FT_EXPORT( FT_Error )
|
---|
1947 | FT_Open_Face( FT_Library library,
|
---|
1948 | const FT_Open_Args* args,
|
---|
1949 | FT_Long face_index,
|
---|
1950 | FT_Face *aface );
|
---|
1951 |
|
---|
1952 |
|
---|
1953 | /*************************************************************************/
|
---|
1954 | /* */
|
---|
1955 | /* <Function> */
|
---|
1956 | /* FT_Attach_File */
|
---|
1957 | /* */
|
---|
1958 | /* <Description> */
|
---|
1959 | /* `Attaches' a given font file to an existing face. This is usually */
|
---|
1960 | /* to read additional information for a single face object. For */
|
---|
1961 | /* example, it is used to read the AFM files that come with Type 1 */
|
---|
1962 | /* fonts in order to add kerning data and other metrics. */
|
---|
1963 | /* */
|
---|
1964 | /* <InOut> */
|
---|
1965 | /* face :: The target face object. */
|
---|
1966 | /* */
|
---|
1967 | /* <Input> */
|
---|
1968 | /* filepathname :: An 8-bit pathname naming the `metrics' file. */
|
---|
1969 | /* */
|
---|
1970 | /* <Return> */
|
---|
1971 | /* FreeType error code. 0 means success. */
|
---|
1972 | /* */
|
---|
1973 | /* <Note> */
|
---|
1974 | /* If your font file is in memory, or if you want to provide your */
|
---|
1975 | /* own input stream object, use @FT_Attach_Stream. */
|
---|
1976 | /* */
|
---|
1977 | /* The meaning of the `attach' action (i.e., what really happens when */
|
---|
1978 | /* the new file is read) is not fixed by FreeType itself. It really */
|
---|
1979 | /* depends on the font format (and thus the font driver). */
|
---|
1980 | /* */
|
---|
1981 | /* Client applications are expected to know what they are doing */
|
---|
1982 | /* when invoking this function. Most drivers simply do not implement */
|
---|
1983 | /* file attachments. */
|
---|
1984 | /* */
|
---|
1985 | FT_EXPORT( FT_Error )
|
---|
1986 | FT_Attach_File( FT_Face face,
|
---|
1987 | const char* filepathname );
|
---|
1988 |
|
---|
1989 |
|
---|
1990 | /*************************************************************************/
|
---|
1991 | /* */
|
---|
1992 | /* <Function> */
|
---|
1993 | /* FT_Attach_Stream */
|
---|
1994 | /* */
|
---|
1995 | /* <Description> */
|
---|
1996 | /* This function is similar to @FT_Attach_File with the exception */
|
---|
1997 | /* that it reads the attachment from an arbitrary stream. */
|
---|
1998 | /* */
|
---|
1999 | /* <InOut> */
|
---|
2000 | /* face :: The target face object. */
|
---|
2001 | /* */
|
---|
2002 | /* <Input> */
|
---|
2003 | /* parameters :: A pointer to an FT_Open_Args structure used to */
|
---|
2004 | /* describe the input stream to FreeType. */
|
---|
2005 | /* <Return> */
|
---|
2006 | /* FreeType error code. 0 means success. */
|
---|
2007 | /* */
|
---|
2008 | /* <Note> */
|
---|
2009 | /* The meaning of the `attach' (i.e. what really happens when the */
|
---|
2010 | /* new file is read) is not fixed by FreeType itself. It really */
|
---|
2011 | /* depends on the font format (and thus the font driver). */
|
---|
2012 | /* */
|
---|
2013 | /* Client applications are expected to know what they are doing */
|
---|
2014 | /* when invoking this function. Most drivers simply do not implement */
|
---|
2015 | /* file attachments. */
|
---|
2016 | /* */
|
---|
2017 | FT_EXPORT( FT_Error )
|
---|
2018 | FT_Attach_Stream( FT_Face face,
|
---|
2019 | FT_Open_Args* parameters );
|
---|
2020 |
|
---|
2021 |
|
---|
2022 | /*************************************************************************/
|
---|
2023 | /* */
|
---|
2024 | /* <Function> */
|
---|
2025 | /* FT_Done_Face */
|
---|
2026 | /* */
|
---|
2027 | /* <Description> */
|
---|
2028 | /* Discards a given face object, as well as all of its child slots */
|
---|
2029 | /* and sizes. */
|
---|
2030 | /* */
|
---|
2031 | /* <Input> */
|
---|
2032 | /* face :: A handle to a target face object. */
|
---|
2033 | /* */
|
---|
2034 | /* <Return> */
|
---|
2035 | /* FreeType error code. 0 means success. */
|
---|
2036 | /* */
|
---|
2037 | FT_EXPORT( FT_Error )
|
---|
2038 | FT_Done_Face( FT_Face face );
|
---|
2039 |
|
---|
2040 |
|
---|
2041 | /*************************************************************************/
|
---|
2042 | /* */
|
---|
2043 | /* <Function> */
|
---|
2044 | /* FT_Set_Char_Size */
|
---|
2045 | /* */
|
---|
2046 | /* <Description> */
|
---|
2047 | /* Sets the character dimensions of a given face object. The */
|
---|
2048 | /* `char_width' and `char_height' values are used for the width and */
|
---|
2049 | /* height, respectively, expressed in 26.6 fractional points. */
|
---|
2050 | /* */
|
---|
2051 | /* If the horizontal or vertical resolution values are zero, a */
|
---|
2052 | /* default value of 72dpi is used. Similarly, if one of the */
|
---|
2053 | /* character dimensions is zero, its value is set equal to the other. */
|
---|
2054 | /* */
|
---|
2055 | /* <InOut> */
|
---|
2056 | /* face :: A handle to a target face object. */
|
---|
2057 | /* */
|
---|
2058 | /* <Input> */
|
---|
2059 | /* char_width :: The character width, in 26.6 fractional points. */
|
---|
2060 | /* */
|
---|
2061 | /* char_height :: The character height, in 26.6 fractional */
|
---|
2062 | /* points. */
|
---|
2063 | /* */
|
---|
2064 | /* horz_resolution :: The horizontal resolution. */
|
---|
2065 | /* */
|
---|
2066 | /* vert_resolution :: The vertical resolution. */
|
---|
2067 | /* */
|
---|
2068 | /* <Return> */
|
---|
2069 | /* FreeType error code. 0 means success. */
|
---|
2070 | /* */
|
---|
2071 | /* <Note> */
|
---|
2072 | /* For BDF and PCF formats, this function uses the `PIXEL_SIZE' */
|
---|
2073 | /* property of the bitmap font; the `char_width' parameter is */
|
---|
2074 | /* ignored. */
|
---|
2075 | /* */
|
---|
2076 | FT_EXPORT( FT_Error )
|
---|
2077 | FT_Set_Char_Size( FT_Face face,
|
---|
2078 | FT_F26Dot6 char_width,
|
---|
2079 | FT_F26Dot6 char_height,
|
---|
2080 | FT_UInt horz_resolution,
|
---|
2081 | FT_UInt vert_resolution );
|
---|
2082 |
|
---|
2083 |
|
---|
2084 | /*************************************************************************/
|
---|
2085 | /* */
|
---|
2086 | /* <Function> */
|
---|
2087 | /* FT_Set_Pixel_Sizes */
|
---|
2088 | /* */
|
---|
2089 | /* <Description> */
|
---|
2090 | /* Sets the character dimensions of a given face object. The width */
|
---|
2091 | /* and height are expressed in integer pixels. */
|
---|
2092 | /* */
|
---|
2093 | /* If one of the character dimensions is zero, its value is set equal */
|
---|
2094 | /* to the other. */
|
---|
2095 | /* */
|
---|
2096 | /* <InOut> */
|
---|
2097 | /* face :: A handle to the target face object. */
|
---|
2098 | /* */
|
---|
2099 | /* <Input> */
|
---|
2100 | /* pixel_width :: The character width, in integer pixels. */
|
---|
2101 | /* */
|
---|
2102 | /* pixel_height :: The character height, in integer pixels. */
|
---|
2103 | /* */
|
---|
2104 | /* <Return> */
|
---|
2105 | /* FreeType error code. 0 means success. */
|
---|
2106 | /* */
|
---|
2107 | /* <Note> */
|
---|
2108 | /* The values of `pixel_width' and `pixel_height' correspond to the */
|
---|
2109 | /* pixel values of the _typographic_ character size, which are NOT */
|
---|
2110 | /* necessarily the same as the dimensions of the glyph `bitmap */
|
---|
2111 | /* cells'. */
|
---|
2112 | /* */
|
---|
2113 | /* The `character size' is really the size of an abstract square */
|
---|
2114 | /* called the `EM', used to design the font. However, depending */
|
---|
2115 | /* on the font design, glyphs is smaller or greater than the EM. */
|
---|
2116 | /* */
|
---|
2117 | /* This means that setting the pixel size to, say, 8x8 doesn't */
|
---|
2118 | /* guarantee in any way that you get glyph bitmaps that all fit */
|
---|
2119 | /* within an 8x8 cell (sometimes even far from it). */
|
---|
2120 | /* */
|
---|
2121 | /* For bitmap fonts, `pixel_height' usually is a reliable value for */
|
---|
2122 | /* the height of the bitmap cell. Drivers for bitmap font formats */
|
---|
2123 | /* which contain a single bitmap strike only (BDF, PCF, FNT) ignore */
|
---|
2124 | /* `pixel_width'. */
|
---|
2125 | /* */
|
---|
2126 | /* For BDF and PCF formats, this function uses the sum of the */
|
---|
2127 | /* `FONT_ASCENT' and `FONT_DESCENT' properties of the bitmap font. */
|
---|
2128 | /* */
|
---|
2129 | FT_EXPORT( FT_Error )
|
---|
2130 | FT_Set_Pixel_Sizes( FT_Face face,
|
---|
2131 | FT_UInt pixel_width,
|
---|
2132 | FT_UInt pixel_height );
|
---|
2133 |
|
---|
2134 |
|
---|
2135 | /*************************************************************************/
|
---|
2136 | /* */
|
---|
2137 | /* <Function> */
|
---|
2138 | /* FT_Load_Glyph */
|
---|
2139 | /* */
|
---|
2140 | /* <Description> */
|
---|
2141 | /* A function used to load a single glyph within a given glyph slot, */
|
---|
2142 | /* for a given size. */
|
---|
2143 | /* */
|
---|
2144 | /* <InOut> */
|
---|
2145 | /* face :: A handle to the target face object where the glyph */
|
---|
2146 | /* is loaded. */
|
---|
2147 | /* */
|
---|
2148 | /* <Input> */
|
---|
2149 | /* glyph_index :: The index of the glyph in the font file. For */
|
---|
2150 | /* CID-keyed fonts (either in PS or in CFF format) */
|
---|
2151 | /* this argument specifies the CID value. */
|
---|
2152 | /* */
|
---|
2153 | /* load_flags :: A flag indicating what to load for this glyph. The */
|
---|
2154 | /* @FT_LOAD_XXX constants can be used to control the */
|
---|
2155 | /* glyph loading process (e.g., whether the outline */
|
---|
2156 | /* should be scaled, whether to load bitmaps or not, */
|
---|
2157 | /* whether to hint the outline, etc). */
|
---|
2158 | /* */
|
---|
2159 | /* <Return> */
|
---|
2160 | /* FreeType error code. 0 means success. */
|
---|
2161 | /* */
|
---|
2162 | /* <Note> */
|
---|
2163 | /* If the glyph image is not a bitmap, and if the bit flag */
|
---|
2164 | /* FT_LOAD_IGNORE_TRANSFORM is unset, the glyph image is transformed */
|
---|
2165 | /* with the information passed to a previous call to */
|
---|
2166 | /* @FT_Set_Transform. */
|
---|
2167 | /* */
|
---|
2168 | /* Note that this also transforms the `face.glyph.advance' field, but */
|
---|
2169 | /* *not* the values in `face.glyph.metrics'. */
|
---|
2170 | /* */
|
---|
2171 | FT_EXPORT( FT_Error )
|
---|
2172 | FT_Load_Glyph( FT_Face face,
|
---|
2173 | FT_UInt glyph_index,
|
---|
2174 | FT_Int32 load_flags );
|
---|
2175 |
|
---|
2176 |
|
---|
2177 | /*************************************************************************/
|
---|
2178 | /* */
|
---|
2179 | /* <Function> */
|
---|
2180 | /* FT_Load_Char */
|
---|
2181 | /* */
|
---|
2182 | /* <Description> */
|
---|
2183 | /* A function used to load a single glyph within a given glyph slot, */
|
---|
2184 | /* for a given size, according to its character code. */
|
---|
2185 | /* */
|
---|
2186 | /* <InOut> */
|
---|
2187 | /* face :: A handle to a target face object where the glyph */
|
---|
2188 | /* is loaded. */
|
---|
2189 | /* */
|
---|
2190 | /* <Input> */
|
---|
2191 | /* char_code :: The glyph's character code, according to the */
|
---|
2192 | /* current charmap used in the face. */
|
---|
2193 | /* */
|
---|
2194 | /* load_flags :: A flag indicating what to load for this glyph. The */
|
---|
2195 | /* @FT_LOAD_XXX constants can be used to control the */
|
---|
2196 | /* glyph loading process (e.g., whether the outline */
|
---|
2197 | /* should be scaled, whether to load bitmaps or not, */
|
---|
2198 | /* whether to hint the outline, etc). */
|
---|
2199 | /* */
|
---|
2200 | /* <Return> */
|
---|
2201 | /* FreeType error code. 0 means success. */
|
---|
2202 | /* */
|
---|
2203 | /* <Note> */
|
---|
2204 | /* If the face has no current charmap, or if the character code */
|
---|
2205 | /* is not defined in the charmap, this function returns an error. */
|
---|
2206 | /* */
|
---|
2207 | /* If the glyph image is not a bitmap, and if the bit flag */
|
---|
2208 | /* FT_LOAD_IGNORE_TRANSFORM is unset, the glyph image is */
|
---|
2209 | /* transformed with the information passed to a previous call to */
|
---|
2210 | /* @FT_Set_Transform. */
|
---|
2211 | /* */
|
---|
2212 | /* Note that this also transforms the `face.glyph.advance' field, but */
|
---|
2213 | /* *not* the values in `face.glyph.metrics'. */
|
---|
2214 | /* */
|
---|
2215 | FT_EXPORT( FT_Error )
|
---|
2216 | FT_Load_Char( FT_Face face,
|
---|
2217 | FT_ULong char_code,
|
---|
2218 | FT_Int32 load_flags );
|
---|
2219 |
|
---|
2220 |
|
---|
2221 | /***************************************************************************
|
---|
2222 | *
|
---|
2223 | * @enum:
|
---|
2224 | * FT_LOAD_XXX
|
---|
2225 | *
|
---|
2226 | * @description:
|
---|
2227 | * A list of bit-field constants, used with @FT_Load_Glyph to indicate
|
---|
2228 | * what kind of operations to perform during glyph loading.
|
---|
2229 | *
|
---|
2230 | * @values:
|
---|
2231 | * FT_LOAD_DEFAULT ::
|
---|
2232 | * Corresponding to 0, this value is used a default glyph load. In this
|
---|
2233 | * case, the following happens:
|
---|
2234 | *
|
---|
2235 | * 1. FreeType looks for a bitmap for the glyph corresponding to the
|
---|
2236 | * face's current size. If one is found, the function returns. The
|
---|
2237 | * bitmap data can be accessed from the glyph slot (see note below).
|
---|
2238 | *
|
---|
2239 | * 2. If no embedded bitmap is searched or found, FreeType looks for a
|
---|
2240 | * scalable outline. If one is found, it is loaded from the font
|
---|
2241 | * file, scaled to device pixels, then "hinted" to the pixel grid in
|
---|
2242 | * order to optimize it. The outline data can be accessed from the
|
---|
2243 | * glyph slot (see note below).
|
---|
2244 | *
|
---|
2245 | * Note that by default, the glyph loader doesn't render outlines into
|
---|
2246 | * bitmaps. The following flags are used to modify this default
|
---|
2247 | * behaviour to more specific and useful cases.
|
---|
2248 | *
|
---|
2249 | * FT_LOAD_NO_SCALE ::
|
---|
2250 | * Don't scale the vector outline being loaded to 26.6 fractional
|
---|
2251 | * pixels, but kept in font units. Note that this also disables
|
---|
2252 | * hinting and the loading of embedded bitmaps. You should only use it
|
---|
2253 | * when you want to retrieve the original glyph outlines in font units.
|
---|
2254 | *
|
---|
2255 | * FT_LOAD_NO_HINTING ::
|
---|
2256 | * Don't hint glyph outlines after their scaling to device pixels.
|
---|
2257 | * This generally generates "blurrier" glyphs in anti-aliased modes.
|
---|
2258 | *
|
---|
2259 | * This flag is ignored if @FT_LOAD_NO_SCALE is set.
|
---|
2260 | *
|
---|
2261 | * FT_LOAD_RENDER ::
|
---|
2262 | * Render the glyph outline immediately into a bitmap before the glyph
|
---|
2263 | * loader returns. By default, the glyph is rendered for the
|
---|
2264 | * @FT_RENDER_MODE_NORMAL mode, which corresponds to 8-bit anti-aliased
|
---|
2265 | * bitmaps using 256 opacity levels. You can use either
|
---|
2266 | * @FT_LOAD_TARGET_MONO or @FT_LOAD_MONOCHROME to render 1-bit
|
---|
2267 | * monochrome bitmaps.
|
---|
2268 | *
|
---|
2269 | * This flag is ignored if @FT_LOAD_NO_SCALE is set.
|
---|
2270 | *
|
---|
2271 | * FT_LOAD_NO_BITMAP ::
|
---|
2272 | * Don't look for bitmaps when loading the glyph. Only scalable
|
---|
2273 | * outlines are loaded when available, and scaled, hinted, or
|
---|
2274 | * rendered depending on other bit flags.
|
---|
2275 | *
|
---|
2276 | * This does not prevent you from rendering outlines to bitmaps
|
---|
2277 | * with @FT_LOAD_RENDER, however.
|
---|
2278 | *
|
---|
2279 | * FT_LOAD_VERTICAL_LAYOUT ::
|
---|
2280 | * Prepare the glyph image for vertical text layout. This basically
|
---|
2281 | * means that `face.glyph.advance' corresponds to the vertical
|
---|
2282 | * advance height (instead of the default horizontal advance width),
|
---|
2283 | * and that the glyph image is translated to match the vertical
|
---|
2284 | * bearings positions.
|
---|
2285 | *
|
---|
2286 | * FT_LOAD_FORCE_AUTOHINT ::
|
---|
2287 | * Force the use of the FreeType auto-hinter when a glyph outline is
|
---|
2288 | * loaded. You shouldn't need this in a typical application, since it
|
---|
2289 | * is mostly used to experiment with its algorithm.
|
---|
2290 | *
|
---|
2291 | * FT_LOAD_CROP_BITMAP ::
|
---|
2292 | * Indicates that the glyph loader should try to crop the bitmap (i.e.,
|
---|
2293 | * remove all space around its black bits) when loading it. This is
|
---|
2294 | * only useful when loading embedded bitmaps in certain fonts, since
|
---|
2295 | * bitmaps rendered with @FT_LOAD_RENDER are always cropped by default.
|
---|
2296 | *
|
---|
2297 | * FT_LOAD_PEDANTIC ::
|
---|
2298 | * Indicates that the glyph loader should perform pedantic
|
---|
2299 | * verifications during glyph loading, rejecting invalid fonts. This
|
---|
2300 | * is mostly used to detect broken glyphs in fonts. By default,
|
---|
2301 | * FreeType tries to handle broken fonts also.
|
---|
2302 | *
|
---|
2303 | * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ::
|
---|
2304 | * Indicates that the glyph loader should ignore the global advance
|
---|
2305 | * width defined in the font. For historical reasons (to support
|
---|
2306 | * buggy CJK fonts), FreeType uses the value of the `advanceWidthMax'
|
---|
2307 | * field in the `htmx' table for all glyphs if the font is monospaced.
|
---|
2308 | * Activating this flags makes FreeType use the metric values given in
|
---|
2309 | * the `htmx' table.
|
---|
2310 | *
|
---|
2311 | * FT_LOAD_NO_RECURSE ::
|
---|
2312 | * This flag is only used internally. It merely indicates that the
|
---|
2313 | * glyph loader should not load composite glyphs recursively. Instead,
|
---|
2314 | * it should set the `num_subglyph' and `subglyphs' values of the glyph
|
---|
2315 | * slot accordingly, and set "glyph->format" to
|
---|
2316 | * @FT_GLYPH_FORMAT_COMPOSITE.
|
---|
2317 | *
|
---|
2318 | * The description of sub-glyphs is not available to client
|
---|
2319 | * applications for now.
|
---|
2320 | *
|
---|
2321 | * FT_LOAD_IGNORE_TRANSFORM ::
|
---|
2322 | * Indicates that the glyph loader should not try to transform the
|
---|
2323 | * loaded glyph image. This doesn't prevent scaling, hinting, or
|
---|
2324 | * rendering.
|
---|
2325 | *
|
---|
2326 | * FT_LOAD_MONOCHROME ::
|
---|
2327 | * This flag is used with @FT_LOAD_RENDER to indicate that you want
|
---|
2328 | * to render a 1-bit monochrome glyph bitmap from a vectorial outline.
|
---|
2329 | *
|
---|
2330 | * Note that this has no effect on the hinting algorithm used by the
|
---|
2331 | * glyph loader. You should better use @FT_LOAD_TARGET_MONO if you
|
---|
2332 | * want to render monochrome-optimized glyph images instead.
|
---|
2333 | *
|
---|
2334 | * FT_LOAD_LINEAR_DESIGN ::
|
---|
2335 | * Return the linearly scaled metrics expressed in original font units
|
---|
2336 | * instead of the default 16.16 pixel values.
|
---|
2337 | *
|
---|
2338 | * FT_LOAD_NO_AUTOHINT ::
|
---|
2339 | * Indicates that the auto-hinter should never be used to hint glyph
|
---|
2340 | * outlines. This doesn't prevent native format-specific hinters from
|
---|
2341 | * being used. This can be important for certain fonts where unhinted
|
---|
2342 | * output is better than auto-hinted one.
|
---|
2343 | *
|
---|
2344 | * FT_LOAD_TARGET_NORMAL ::
|
---|
2345 | * Use hinting for @FT_RENDER_MODE_NORMAL.
|
---|
2346 | *
|
---|
2347 | * FT_LOAD_TARGET_LIGHT ::
|
---|
2348 | * Use hinting for @FT_RENDER_MODE_LIGHT.
|
---|
2349 | *
|
---|
2350 | * FT_LOAD_TARGET_MONO ::
|
---|
2351 | * Use hinting for @FT_RENDER_MODE_MONO.
|
---|
2352 | *
|
---|
2353 | * FT_LOAD_TARGET_LCD ::
|
---|
2354 | * Use hinting for @FT_RENDER_MODE_LCD.
|
---|
2355 | *
|
---|
2356 | * FT_LOAD_TARGET_LCD_V ::
|
---|
2357 | * Use hinting for @FT_RENDER_MODE_LCD_V.
|
---|
2358 | *
|
---|
2359 | * @note:
|
---|
2360 | * You should use only _one_ of the FT_LOAD_TARGET_XXX values; they
|
---|
2361 | * can't be ORed.
|
---|
2362 | *
|
---|
2363 | * However, FreeType makes a distinction between the hinting algorithm
|
---|
2364 | * being used, and the pixel mode of the target bitmaps. For example,
|
---|
2365 | * it is possible to use the `light' hinting algorithm and have the
|
---|
2366 | * results rendered in horizontal LCD pixel mode, with code like this:
|
---|
2367 | *
|
---|
2368 | * FT_Load_Glyph( face, glyph_index,
|
---|
2369 | * load_flags | FT_LOAD_TARGET_LIGHT );
|
---|
2370 | * FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD );
|
---|
2371 | *
|
---|
2372 | */
|
---|
2373 | #define FT_LOAD_DEFAULT 0x0
|
---|
2374 | #define FT_LOAD_NO_SCALE 0x1
|
---|
2375 | #define FT_LOAD_NO_HINTING 0x2
|
---|
2376 | #define FT_LOAD_RENDER 0x4
|
---|
2377 | #define FT_LOAD_NO_BITMAP 0x8
|
---|
2378 | #define FT_LOAD_VERTICAL_LAYOUT 0x10
|
---|
2379 | #define FT_LOAD_FORCE_AUTOHINT 0x20
|
---|
2380 | #define FT_LOAD_CROP_BITMAP 0x40
|
---|
2381 | #define FT_LOAD_PEDANTIC 0x80
|
---|
2382 | #define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH 0x200
|
---|
2383 | #define FT_LOAD_NO_RECURSE 0x400
|
---|
2384 | #define FT_LOAD_IGNORE_TRANSFORM 0x800
|
---|
2385 | #define FT_LOAD_MONOCHROME 0x1000
|
---|
2386 | #define FT_LOAD_LINEAR_DESIGN 0x2000
|
---|
2387 |
|
---|
2388 | /* temporary hack! */
|
---|
2389 | #define FT_LOAD_SBITS_ONLY 0x4000
|
---|
2390 | #define FT_LOAD_NO_AUTOHINT 0x8000U
|
---|
2391 |
|
---|
2392 | /* */
|
---|
2393 |
|
---|
2394 | #define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 )
|
---|
2395 | #define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
|
---|
2396 |
|
---|
2397 | #define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
|
---|
2398 | #define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT )
|
---|
2399 | #define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO )
|
---|
2400 | #define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
|
---|
2401 | #define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
|
---|
2402 |
|
---|
2403 | /* */
|
---|
2404 |
|
---|
2405 |
|
---|
2406 | /*************************************************************************/
|
---|
2407 | /* */
|
---|
2408 | /* <Function> */
|
---|
2409 | /* FT_Set_Transform */
|
---|
2410 | /* */
|
---|
2411 | /* <Description> */
|
---|
2412 | /* A function used to set the transformation that is applied to glyph */
|
---|
2413 | /* images when they are loaded into a glyph slot through */
|
---|
2414 | /* @FT_Load_Glyph. */
|
---|
2415 | /* */
|
---|
2416 | /* <InOut> */
|
---|
2417 | /* face :: A handle to the source face object. */
|
---|
2418 | /* */
|
---|
2419 | /* <Input> */
|
---|
2420 | /* matrix :: A pointer to the transformation's 2x2 matrix. Use 0 for */
|
---|
2421 | /* the identity matrix. */
|
---|
2422 | /* delta :: A pointer to the translation vector. Use 0 for the null */
|
---|
2423 | /* vector. */
|
---|
2424 | /* */
|
---|
2425 | /* <Note> */
|
---|
2426 | /* The transformation is only applied to scalable image formats after */
|
---|
2427 | /* the glyph has been loaded. It means that hinting is unaltered by */
|
---|
2428 | /* the transformation and is performed on the character size given in */
|
---|
2429 | /* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */
|
---|
2430 | /* */
|
---|
2431 | FT_EXPORT( void )
|
---|
2432 | FT_Set_Transform( FT_Face face,
|
---|
2433 | FT_Matrix* matrix,
|
---|
2434 | FT_Vector* delta );
|
---|
2435 |
|
---|
2436 |
|
---|
2437 | /*************************************************************************/
|
---|
2438 | /* */
|
---|
2439 | /* <Enum> */
|
---|
2440 | /* FT_Render_Mode */
|
---|
2441 | /* */
|
---|
2442 | /* <Description> */
|
---|
2443 | /* An enumeration type that lists the render modes supported by */
|
---|
2444 | /* FreeType 2. Each mode corresponds to a specific type of scanline */
|
---|
2445 | /* conversion performed on the outline, as well as specific */
|
---|
2446 | /* hinting optimizations. */
|
---|
2447 | /* */
|
---|
2448 | /* For bitmap fonts the `bitmap->pixel_mode' field in the */
|
---|
2449 | /* @FT_GlyphSlotRec structure gives the format of the returned */
|
---|
2450 | /* bitmap. */
|
---|
2451 | /* */
|
---|
2452 | /* <Values> */
|
---|
2453 | /* FT_RENDER_MODE_NORMAL :: */
|
---|
2454 | /* This is the default render mode; it corresponds to 8-bit */
|
---|
2455 | /* anti-aliased bitmaps, using 256 levels of opacity. */
|
---|
2456 | /* */
|
---|
2457 | /* FT_RENDER_MODE_LIGHT :: */
|
---|
2458 | /* This is similar to @FT_RENDER_MODE_NORMAL -- you have to use */
|
---|
2459 | /* @FT_LOAD_TARGET_LIGHT in calls to @FT_Load_Glyph to get any */
|
---|
2460 | /* effect since the rendering process no longer influences the */
|
---|
2461 | /* positioning of glyph outlines. */
|
---|
2462 | /* */
|
---|
2463 | /* The resulting glyph shapes are more similar to the original, */
|
---|
2464 | /* while being a bit more fuzzy (`better shapes' instead of `better */
|
---|
2465 | /* contrast', so to say. */
|
---|
2466 | /* */
|
---|
2467 | /* FT_RENDER_MODE_MONO :: */
|
---|
2468 | /* This mode corresponds to 1-bit bitmaps. */
|
---|
2469 | /* */
|
---|
2470 | /* FT_RENDER_MODE_LCD :: */
|
---|
2471 | /* This mode corresponds to horizontal RGB/BGR sub-pixel displays, */
|
---|
2472 | /* like LCD-screens. It produces 8-bit bitmaps that are 3 times */
|
---|
2473 | /* the width of the original glyph outline in pixels, and which use */
|
---|
2474 | /* the @FT_PIXEL_MODE_LCD mode. */
|
---|
2475 | /* */
|
---|
2476 | /* FT_RENDER_MODE_LCD_V :: */
|
---|
2477 | /* This mode corresponds to vertical RGB/BGR sub-pixel displays */
|
---|
2478 | /* (like PDA screens, rotated LCD displays, etc.). It produces */
|
---|
2479 | /* 8-bit bitmaps that are 3 times the height of the original */
|
---|
2480 | /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */
|
---|
2481 | /* */
|
---|
2482 | /* <Note> */
|
---|
2483 | /* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph are */
|
---|
2484 | /* _not filtered_ to reduce color-fringes. It is up to the caller to */
|
---|
2485 | /* perform this pass. */
|
---|
2486 | /* */
|
---|
2487 | typedef enum FT_Render_Mode_
|
---|
2488 | {
|
---|
2489 | FT_RENDER_MODE_NORMAL = 0,
|
---|
2490 | FT_RENDER_MODE_LIGHT,
|
---|
2491 | FT_RENDER_MODE_MONO,
|
---|
2492 | FT_RENDER_MODE_LCD,
|
---|
2493 | FT_RENDER_MODE_LCD_V,
|
---|
2494 |
|
---|
2495 | FT_RENDER_MODE_MAX
|
---|
2496 |
|
---|
2497 | } FT_Render_Mode;
|
---|
2498 |
|
---|
2499 |
|
---|
2500 | /*************************************************************************/
|
---|
2501 | /* */
|
---|
2502 | /* <Enum> */
|
---|
2503 | /* ft_render_mode_xxx */
|
---|
2504 | /* */
|
---|
2505 | /* <Description> */
|
---|
2506 | /* These constats are deprecated. Use the corresponding */
|
---|
2507 | /* @FT_Render_Mode values instead. */
|
---|
2508 | /* */
|
---|
2509 | /* <Values> */
|
---|
2510 | /* ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL */
|
---|
2511 | /* ft_render_mode_mono :: see @FT_RENDER_MODE_MONO */
|
---|
2512 | /* */
|
---|
2513 | #define ft_render_mode_normal FT_RENDER_MODE_NORMAL
|
---|
2514 | #define ft_render_mode_mono FT_RENDER_MODE_MONO
|
---|
2515 |
|
---|
2516 |
|
---|
2517 | /*************************************************************************/
|
---|
2518 | /* */
|
---|
2519 | /* <Function> */
|
---|
2520 | /* FT_Render_Glyph */
|
---|
2521 | /* */
|
---|
2522 | /* <Description> */
|
---|
2523 | /* Converts a given glyph image to a bitmap. It does so by */
|
---|
2524 | /* inspecting the glyph image format, find the relevant renderer, and */
|
---|
2525 | /* invoke it. */
|
---|
2526 | /* */
|
---|
2527 | /* <InOut> */
|
---|
2528 | /* slot :: A handle to the glyph slot containing the image to */
|
---|
2529 | /* convert. */
|
---|
2530 | /* */
|
---|
2531 | /* <Input> */
|
---|
2532 | /* render_mode :: This is the render mode used to render the glyph */
|
---|
2533 | /* image into a bitmap. See FT_Render_Mode for a list */
|
---|
2534 | /* of possible values. */
|
---|
2535 | /* */
|
---|
2536 | /* <Return> */
|
---|
2537 | /* FreeType error code. 0 means success. */
|
---|
2538 | /* */
|
---|
2539 | FT_EXPORT( FT_Error )
|
---|
2540 | FT_Render_Glyph( FT_GlyphSlot slot,
|
---|
2541 | FT_Render_Mode render_mode );
|
---|
2542 |
|
---|
2543 |
|
---|
2544 | /*************************************************************************/
|
---|
2545 | /* */
|
---|
2546 | /* <Enum> */
|
---|
2547 | /* FT_Kerning_Mode */
|
---|
2548 | /* */
|
---|
2549 | /* <Description> */
|
---|
2550 | /* An enumeration used to specify which kerning values to return in */
|
---|
2551 | /* @FT_Get_Kerning. */
|
---|
2552 | /* */
|
---|
2553 | /* <Values> */
|
---|
2554 | /* FT_KERNING_DEFAULT :: Return scaled and grid-fitted kerning */
|
---|
2555 | /* distances (value is 0). */
|
---|
2556 | /* */
|
---|
2557 | /* FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning */
|
---|
2558 | /* distances. */
|
---|
2559 | /* */
|
---|
2560 | /* FT_KERNING_UNSCALED :: Return the kerning vector in original font */
|
---|
2561 | /* units. */
|
---|
2562 | /* */
|
---|
2563 | typedef enum FT_Kerning_Mode_
|
---|
2564 | {
|
---|
2565 | FT_KERNING_DEFAULT = 0,
|
---|
2566 | FT_KERNING_UNFITTED,
|
---|
2567 | FT_KERNING_UNSCALED
|
---|
2568 |
|
---|
2569 | } FT_Kerning_Mode;
|
---|
2570 |
|
---|
2571 |
|
---|
2572 | /*************************************************************************/
|
---|
2573 | /* */
|
---|
2574 | /* <Const> */
|
---|
2575 | /* ft_kerning_default */
|
---|
2576 | /* */
|
---|
2577 | /* <Description> */
|
---|
2578 | /* This constant is deprecated. Please use @FT_KERNING_DEFAULT */
|
---|
2579 | /* instead. */
|
---|
2580 | /* */
|
---|
2581 | #define ft_kerning_default FT_KERNING_DEFAULT
|
---|
2582 |
|
---|
2583 |
|
---|
2584 | /*************************************************************************/
|
---|
2585 | /* */
|
---|
2586 | /* <Const> */
|
---|
2587 | /* ft_kerning_unfitted */
|
---|
2588 | /* */
|
---|
2589 | /* <Description> */
|
---|
2590 | /* This constant is deprecated. Please use @FT_KERNING_UNFITTED */
|
---|
2591 | /* instead. */
|
---|
2592 | /* */
|
---|
2593 | #define ft_kerning_unfitted FT_KERNING_UNFITTED
|
---|
2594 |
|
---|
2595 |
|
---|
2596 | /*************************************************************************/
|
---|
2597 | /* */
|
---|
2598 | /* <Const> */
|
---|
2599 | /* ft_kerning_unscaled */
|
---|
2600 | /* */
|
---|
2601 | /* <Description> */
|
---|
2602 | /* This constant is deprecated. Please use @FT_KERNING_UNSCALED */
|
---|
2603 | /* instead. */
|
---|
2604 | /* */
|
---|
2605 | #define ft_kerning_unscaled FT_KERNING_UNSCALED
|
---|
2606 |
|
---|
2607 |
|
---|
2608 | /*************************************************************************/
|
---|
2609 | /* */
|
---|
2610 | /* <Function> */
|
---|
2611 | /* FT_Get_Kerning */
|
---|
2612 | /* */
|
---|
2613 | /* <Description> */
|
---|
2614 | /* Returns the kerning vector between two glyphs of a same face. */
|
---|
2615 | /* */
|
---|
2616 | /* <Input> */
|
---|
2617 | /* face :: A handle to a source face object. */
|
---|
2618 | /* */
|
---|
2619 | /* left_glyph :: The index of the left glyph in the kern pair. */
|
---|
2620 | /* */
|
---|
2621 | /* right_glyph :: The index of the right glyph in the kern pair. */
|
---|
2622 | /* */
|
---|
2623 | /* kern_mode :: See @FT_Kerning_Mode for more information. */
|
---|
2624 | /* Determines the scale/dimension of the returned */
|
---|
2625 | /* kerning vector. */
|
---|
2626 | /* */
|
---|
2627 | /* <Output> */
|
---|
2628 | /* akerning :: The kerning vector. This is either in font units */
|
---|
2629 | /* or in pixels (26.6 format) for scalable formats, */
|
---|
2630 | /* and in pixels for fixed-sizes formats. */
|
---|
2631 | /* */
|
---|
2632 | /* <Return> */
|
---|
2633 | /* FreeType error code. 0 means success. */
|
---|
2634 | /* */
|
---|
2635 | /* <Note> */
|
---|
2636 | /* Only horizontal layouts (left-to-right & right-to-left) are */
|
---|
2637 | /* supported by this method. Other layouts, or more sophisticated */
|
---|
2638 | /* kernings, are out of the scope of this API function -- they can be */
|
---|
2639 | /* implemented through format-specific interfaces. */
|
---|
2640 | /* */
|
---|
2641 | FT_EXPORT( FT_Error )
|
---|
2642 | FT_Get_Kerning( FT_Face face,
|
---|
2643 | FT_UInt left_glyph,
|
---|
2644 | FT_UInt right_glyph,
|
---|
2645 | FT_UInt kern_mode,
|
---|
2646 | FT_Vector *akerning );
|
---|
2647 |
|
---|
2648 |
|
---|
2649 | /*************************************************************************/
|
---|
2650 | /* */
|
---|
2651 | /* <Function> */
|
---|
2652 | /* FT_Get_Glyph_Name */
|
---|
2653 | /* */
|
---|
2654 | /* <Description> */
|
---|
2655 | /* Retrieves the ASCII name of a given glyph in a face. This only */
|
---|
2656 | /* works for those faces where FT_HAS_GLYPH_NAME(face) returns true. */
|
---|
2657 | /* */
|
---|
2658 | /* <Input> */
|
---|
2659 | /* face :: A handle to a source face object. */
|
---|
2660 | /* */
|
---|
2661 | /* glyph_index :: The glyph index. */
|
---|
2662 | /* */
|
---|
2663 | /* buffer_max :: The maximal number of bytes available in the */
|
---|
2664 | /* buffer. */
|
---|
2665 | /* */
|
---|
2666 | /* <Output> */
|
---|
2667 | /* buffer :: A pointer to a target buffer where the name is */
|
---|
2668 | /* copied to. */
|
---|
2669 | /* */
|
---|
2670 | /* <Return> */
|
---|
2671 | /* FreeType error code. 0 means success. */
|
---|
2672 | /* */
|
---|
2673 | /* <Note> */
|
---|
2674 | /* An error is returned if the face doesn't provide glyph names or if */
|
---|
2675 | /* the glyph index is invalid. In all cases of failure, the first */
|
---|
2676 | /* byte of `buffer' is set to 0 to indicate an empty name. */
|
---|
2677 | /* */
|
---|
2678 | /* The glyph name is truncated to fit within the buffer if it is too */
|
---|
2679 | /* long. The returned string is always zero-terminated. */
|
---|
2680 | /* */
|
---|
2681 | /* This function is not compiled within the library if the config */
|
---|
2682 | /* macro FT_CONFIG_OPTION_NO_GLYPH_NAMES is defined in */
|
---|
2683 | /* `include/freetype/config/ftoptions.h' */
|
---|
2684 | /* */
|
---|
2685 | FT_EXPORT( FT_Error )
|
---|
2686 | FT_Get_Glyph_Name( FT_Face face,
|
---|
2687 | FT_UInt glyph_index,
|
---|
2688 | FT_Pointer buffer,
|
---|
2689 | FT_UInt buffer_max );
|
---|
2690 |
|
---|
2691 |
|
---|
2692 | /*************************************************************************/
|
---|
2693 | /* */
|
---|
2694 | /* <Function> */
|
---|
2695 | /* FT_Get_Postscript_Name */
|
---|
2696 | /* */
|
---|
2697 | /* <Description> */
|
---|
2698 | /* Retrieves the ASCII Postscript name of a given face, if available. */
|
---|
2699 | /* This only works with Postscript and TrueType fonts. */
|
---|
2700 | /* */
|
---|
2701 | /* <Input> */
|
---|
2702 | /* face :: A handle to the source face object. */
|
---|
2703 | /* */
|
---|
2704 | /* <Return> */
|
---|
2705 | /* A pointer to the face's Postscript name. NULL if unavailable. */
|
---|
2706 | /* */
|
---|
2707 | /* <Note> */
|
---|
2708 | /* The returned pointer is owned by the face and will be destroyed */
|
---|
2709 | /* with it. */
|
---|
2710 | /* */
|
---|
2711 | FT_EXPORT( const char* )
|
---|
2712 | FT_Get_Postscript_Name( FT_Face face );
|
---|
2713 |
|
---|
2714 |
|
---|
2715 | /*************************************************************************/
|
---|
2716 | /* */
|
---|
2717 | /* <Function> */
|
---|
2718 | /* FT_Select_Charmap */
|
---|
2719 | /* */
|
---|
2720 | /* <Description> */
|
---|
2721 | /* Selects a given charmap by its encoding tag (as listed in */
|
---|
2722 | /* `freetype.h'). */
|
---|
2723 | /* */
|
---|
2724 | /* <InOut> */
|
---|
2725 | /* face :: A handle to the source face object. */
|
---|
2726 | /* */
|
---|
2727 | /* <Input> */
|
---|
2728 | /* encoding :: A handle to the selected charmap. */
|
---|
2729 | /* */
|
---|
2730 | /* <Return> */
|
---|
2731 | /* FreeType error code. 0 means success. */
|
---|
2732 | /* */
|
---|
2733 | /* <Note> */
|
---|
2734 | /* This function returns an error if no charmap in the face */
|
---|
2735 | /* corresponds to the encoding queried here. */
|
---|
2736 | /* */
|
---|
2737 | FT_EXPORT( FT_Error )
|
---|
2738 | FT_Select_Charmap( FT_Face face,
|
---|
2739 | FT_Encoding encoding );
|
---|
2740 |
|
---|
2741 |
|
---|
2742 | /*************************************************************************/
|
---|
2743 | /* */
|
---|
2744 | /* <Function> */
|
---|
2745 | /* FT_Set_Charmap */
|
---|
2746 | /* */
|
---|
2747 | /* <Description> */
|
---|
2748 | /* Selects a given charmap for character code to glyph index */
|
---|
2749 | /* decoding. */
|
---|
2750 | /* */
|
---|
2751 | /* <InOut> */
|
---|
2752 | /* face :: A handle to the source face object. */
|
---|
2753 | /* */
|
---|
2754 | /* <Input> */
|
---|
2755 | /* charmap :: A handle to the selected charmap. */
|
---|
2756 | /* */
|
---|
2757 | /* <Return> */
|
---|
2758 | /* FreeType error code. 0 means success. */
|
---|
2759 | /* */
|
---|
2760 | /* <Note> */
|
---|
2761 | /* This function returns an error if the charmap is not part of */
|
---|
2762 | /* the face (i.e., if it is not listed in the face->charmaps[] */
|
---|
2763 | /* table). */
|
---|
2764 | /* */
|
---|
2765 | FT_EXPORT( FT_Error )
|
---|
2766 | FT_Set_Charmap( FT_Face face,
|
---|
2767 | FT_CharMap charmap );
|
---|
2768 |
|
---|
2769 |
|
---|
2770 | /*************************************************************************/
|
---|
2771 | /* */
|
---|
2772 | /* @function: */
|
---|
2773 | /* FT_Get_Charmap_Index */
|
---|
2774 | /* */
|
---|
2775 | /* @description: */
|
---|
2776 | /* Retrieve index of a given charmap. */
|
---|
2777 | /* */
|
---|
2778 | /* @input: */
|
---|
2779 | /* charmap :: A handle to a charmap. */
|
---|
2780 | /* */
|
---|
2781 | /* @return: */
|
---|
2782 | /* The index into the array of character maps within the face to */
|
---|
2783 | /* which `charmap' belongs. */
|
---|
2784 | /* */
|
---|
2785 | FT_EXPORT( FT_Int )
|
---|
2786 | FT_Get_Charmap_Index( FT_CharMap charmap );
|
---|
2787 |
|
---|
2788 |
|
---|
2789 | /*************************************************************************/
|
---|
2790 | /* */
|
---|
2791 | /* <Function> */
|
---|
2792 | /* FT_Get_Char_Index */
|
---|
2793 | /* */
|
---|
2794 | /* <Description> */
|
---|
2795 | /* Returns the glyph index of a given character code. This function */
|
---|
2796 | /* uses a charmap object to do the translation. */
|
---|
2797 | /* */
|
---|
2798 | /* <Input> */
|
---|
2799 | /* face :: A handle to the source face object. */
|
---|
2800 | /* */
|
---|
2801 | /* charcode :: The character code. */
|
---|
2802 | /* */
|
---|
2803 | /* <Return> */
|
---|
2804 | /* The glyph index. 0 means `undefined character code'. */
|
---|
2805 | /* */
|
---|
2806 | /* <Note> */
|
---|
2807 | /* FreeType computes its own glyph indices which are not necessarily */
|
---|
2808 | /* the same as used in the font in case the font is based on glyph */
|
---|
2809 | /* indices. Reason for this behaviour is to assure that index 0 is */
|
---|
2810 | /* never used, representing the missing glyph. */
|
---|
2811 | /* */
|
---|
2812 | FT_EXPORT( FT_UInt )
|
---|
2813 | FT_Get_Char_Index( FT_Face face,
|
---|
2814 | FT_ULong charcode );
|
---|
2815 |
|
---|
2816 |
|
---|
2817 | /*************************************************************************/
|
---|
2818 | /* */
|
---|
2819 | /* <Function> */
|
---|
2820 | /* FT_Get_First_Char */
|
---|
2821 | /* */
|
---|
2822 | /* <Description> */
|
---|
2823 | /* This function is used to return the first character code in the */
|
---|
2824 | /* current charmap of a given face. It also returns the */
|
---|
2825 | /* corresponding glyph index. */
|
---|
2826 | /* */
|
---|
2827 | /* <Input> */
|
---|
2828 | /* face :: A handle to the source face object. */
|
---|
2829 | /* */
|
---|
2830 | /* <Output> */
|
---|
2831 | /* agindex :: Glyph index of first character code. 0 if charmap is */
|
---|
2832 | /* empty. */
|
---|
2833 | /* */
|
---|
2834 | /* <Return> */
|
---|
2835 | /* The charmap's first character code. */
|
---|
2836 | /* */
|
---|
2837 | /* <Note> */
|
---|
2838 | /* You should use this function with @FT_Get_Next_Char to be able to */
|
---|
2839 | /* parse all character codes available in a given charmap. The code */
|
---|
2840 | /* should look like this: */
|
---|
2841 | /* */
|
---|
2842 | /* { */
|
---|
2843 | /* FT_ULong charcode; */
|
---|
2844 | /* FT_UInt gindex; */
|
---|
2845 | /* */
|
---|
2846 | /* */
|
---|
2847 | /* charcode = FT_Get_First_Char( face, &gindex ); */
|
---|
2848 | /* while ( gindex != 0 ) */
|
---|
2849 | /* { */
|
---|
2850 | /* ... do something with (charcode,gindex) pair ... */
|
---|
2851 | /* */
|
---|
2852 | /* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */
|
---|
2853 | /* } */
|
---|
2854 | /* } */
|
---|
2855 | /* */
|
---|
2856 | /* Note that `*agindex' is set to 0 if the charmap is empty. The */
|
---|
2857 | /* result itself can be 0 in two cases: if the charmap is empty or */
|
---|
2858 | /* when the value 0 is the first valid character code. */
|
---|
2859 | /* */
|
---|
2860 | FT_EXPORT( FT_ULong )
|
---|
2861 | FT_Get_First_Char( FT_Face face,
|
---|
2862 | FT_UInt *agindex );
|
---|
2863 |
|
---|
2864 |
|
---|
2865 | /*************************************************************************/
|
---|
2866 | /* */
|
---|
2867 | /* <Function> */
|
---|
2868 | /* FT_Get_Next_Char */
|
---|
2869 | /* */
|
---|
2870 | /* <Description> */
|
---|
2871 | /* This function is used to return the next character code in the */
|
---|
2872 | /* current charmap of a given face following the value 'char_code', */
|
---|
2873 | /* as well as the corresponding glyph index. */
|
---|
2874 | /* */
|
---|
2875 | /* <Input> */
|
---|
2876 | /* face :: A handle to the source face object. */
|
---|
2877 | /* char_code :: The starting character code. */
|
---|
2878 | /* */
|
---|
2879 | /* <Output> */
|
---|
2880 | /* agindex :: Glyph index of first character code. 0 if charmap */
|
---|
2881 | /* is empty. */
|
---|
2882 | /* */
|
---|
2883 | /* <Return> */
|
---|
2884 | /* The charmap's next character code. */
|
---|
2885 | /* */
|
---|
2886 | /* <Note> */
|
---|
2887 | /* You should use this function with @FT_Get_First_Char to walk */
|
---|
2888 | /* through all character codes available in a given charmap. See */
|
---|
2889 | /* the note for this function for a simple code example. */
|
---|
2890 | /* */
|
---|
2891 | /* Note that `*agindex' is set to 0 when there are no more codes in */
|
---|
2892 | /* the charmap. */
|
---|
2893 | /* */
|
---|
2894 | FT_EXPORT( FT_ULong )
|
---|
2895 | FT_Get_Next_Char( FT_Face face,
|
---|
2896 | FT_ULong char_code,
|
---|
2897 | FT_UInt *agindex );
|
---|
2898 |
|
---|
2899 |
|
---|
2900 | /*************************************************************************/
|
---|
2901 | /* */
|
---|
2902 | /* <Function> */
|
---|
2903 | /* FT_Get_Name_Index */
|
---|
2904 | /* */
|
---|
2905 | /* <Description> */
|
---|
2906 | /* Returns the glyph index of a given glyph name. This function uses */
|
---|
2907 | /* driver specific objects to do the translation. */
|
---|
2908 | /* */
|
---|
2909 | /* <Input> */
|
---|
2910 | /* face :: A handle to the source face object. */
|
---|
2911 | /* */
|
---|
2912 | /* glyph_name :: The glyph name. */
|
---|
2913 | /* */
|
---|
2914 | /* <Return> */
|
---|
2915 | /* The glyph index. 0 means `undefined character code'. */
|
---|
2916 | /* */
|
---|
2917 | FT_EXPORT( FT_UInt )
|
---|
2918 | FT_Get_Name_Index( FT_Face face,
|
---|
2919 | FT_String* glyph_name );
|
---|
2920 |
|
---|
2921 |
|
---|
2922 |
|
---|
2923 | /*************************************************************************/
|
---|
2924 | /* */
|
---|
2925 | /* <Section> */
|
---|
2926 | /* computations */
|
---|
2927 | /* */
|
---|
2928 | /* <Title> */
|
---|
2929 | /* Computations */
|
---|
2930 | /* */
|
---|
2931 | /* <Abstract> */
|
---|
2932 | /* Crunching fixed numbers and vectors. */
|
---|
2933 | /* */
|
---|
2934 | /* <Description> */
|
---|
2935 | /* This section contains various functions used to perform */
|
---|
2936 | /* computations on 16.16 fixed-float numbers or 2d vectors. */
|
---|
2937 | /* */
|
---|
2938 | /* <Order> */
|
---|
2939 | /* FT_MulDiv */
|
---|
2940 | /* FT_MulFix */
|
---|
2941 | /* FT_DivFix */
|
---|
2942 | /* FT_RoundFix */
|
---|
2943 | /* FT_CeilFix */
|
---|
2944 | /* FT_FloorFix */
|
---|
2945 | /* FT_Vector_Transform */
|
---|
2946 | /* FT_Matrix_Multiply */
|
---|
2947 | /* FT_Matrix_Invert */
|
---|
2948 | /* */
|
---|
2949 | /*************************************************************************/
|
---|
2950 |
|
---|
2951 |
|
---|
2952 | /*************************************************************************/
|
---|
2953 | /* */
|
---|
2954 | /* <Function> */
|
---|
2955 | /* FT_MulDiv */
|
---|
2956 | /* */
|
---|
2957 | /* <Description> */
|
---|
2958 | /* A very simple function used to perform the computation `(a*b)/c' */
|
---|
2959 | /* with maximal accuracy (it uses a 64-bit intermediate integer */
|
---|
2960 | /* whenever necessary). */
|
---|
2961 | /* */
|
---|
2962 | /* This function isn't necessarily as fast as some processor specific */
|
---|
2963 | /* operations, but is at least completely portable. */
|
---|
2964 | /* */
|
---|
2965 | /* <Input> */
|
---|
2966 | /* a :: The first multiplier. */
|
---|
2967 | /* b :: The second multiplier. */
|
---|
2968 | /* c :: The divisor. */
|
---|
2969 | /* */
|
---|
2970 | /* <Return> */
|
---|
2971 | /* The result of `(a*b)/c'. This function never traps when trying to */
|
---|
2972 | /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
|
---|
2973 | /* on the signs of `a' and `b'. */
|
---|
2974 | /* */
|
---|
2975 | FT_EXPORT( FT_Long )
|
---|
2976 | FT_MulDiv( FT_Long a,
|
---|
2977 | FT_Long b,
|
---|
2978 | FT_Long c );
|
---|
2979 |
|
---|
2980 |
|
---|
2981 | /*************************************************************************/
|
---|
2982 | /* */
|
---|
2983 | /* <Function> */
|
---|
2984 | /* FT_MulFix */
|
---|
2985 | /* */
|
---|
2986 | /* <Description> */
|
---|
2987 | /* A very simple function used to perform the computation */
|
---|
2988 | /* `(a*b)/0x10000' with maximal accuracy. Most of the time this is */
|
---|
2989 | /* used to multiply a given value by a 16.16 fixed float factor. */
|
---|
2990 | /* */
|
---|
2991 | /* <Input> */
|
---|
2992 | /* a :: The first multiplier. */
|
---|
2993 | /* b :: The second multiplier. Use a 16.16 factor here whenever */
|
---|
2994 | /* possible (see note below). */
|
---|
2995 | /* */
|
---|
2996 | /* <Return> */
|
---|
2997 | /* The result of `(a*b)/0x10000'. */
|
---|
2998 | /* */
|
---|
2999 | /* <Note> */
|
---|
3000 | /* This function has been optimized for the case where the absolute */
|
---|
3001 | /* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */
|
---|
3002 | /* As this happens mainly when scaling from notional units to */
|
---|
3003 | /* fractional pixels in FreeType, it resulted in noticeable speed */
|
---|
3004 | /* improvements between versions 2.x and 1.x. */
|
---|
3005 | /* */
|
---|
3006 | /* As a conclusion, always try to place a 16.16 factor as the */
|
---|
3007 | /* _second_ argument of this function; this can make a great */
|
---|
3008 | /* difference. */
|
---|
3009 | /* */
|
---|
3010 | FT_EXPORT( FT_Long )
|
---|
3011 | FT_MulFix( FT_Long a,
|
---|
3012 | FT_Long b );
|
---|
3013 |
|
---|
3014 |
|
---|
3015 | /*************************************************************************/
|
---|
3016 | /* */
|
---|
3017 | /* <Function> */
|
---|
3018 | /* FT_DivFix */
|
---|
3019 | /* */
|
---|
3020 | /* <Description> */
|
---|
3021 | /* A very simple function used to perform the computation */
|
---|
3022 | /* `(a*0x10000)/b' with maximal accuracy. Most of the time, this is */
|
---|
3023 | /* used to divide a given value by a 16.16 fixed float factor. */
|
---|
3024 | /* */
|
---|
3025 | /* <Input> */
|
---|
3026 | /* a :: The first multiplier. */
|
---|
3027 | /* b :: The second multiplier. Use a 16.16 factor here whenever */
|
---|
3028 | /* possible (see note below). */
|
---|
3029 | /* */
|
---|
3030 | /* <Return> */
|
---|
3031 | /* The result of `(a*0x10000)/b'. */
|
---|
3032 | /* */
|
---|
3033 | /* <Note> */
|
---|
3034 | /* The optimization for FT_DivFix() is simple: If (a << 16) fits in */
|
---|
3035 | /* 32 bits, then the division is computed directly. Otherwise, we */
|
---|
3036 | /* use a specialized version of @FT_MulDiv. */
|
---|
3037 | /* */
|
---|
3038 | FT_EXPORT( FT_Long )
|
---|
3039 | FT_DivFix( FT_Long a,
|
---|
3040 | FT_Long b );
|
---|
3041 |
|
---|
3042 |
|
---|
3043 | /*************************************************************************/
|
---|
3044 | /* */
|
---|
3045 | /* <Function> */
|
---|
3046 | /* FT_RoundFix */
|
---|
3047 | /* */
|
---|
3048 | /* <Description> */
|
---|
3049 | /* A very simple function used to round a 16.16 fixed number. */
|
---|
3050 | /* */
|
---|
3051 | /* <Input> */
|
---|
3052 | /* a :: The number to be rounded. */
|
---|
3053 | /* */
|
---|
3054 | /* <Return> */
|
---|
3055 | /* The result of `(a + 0x8000) & -0x10000'. */
|
---|
3056 | /* */
|
---|
3057 | FT_EXPORT( FT_Fixed )
|
---|
3058 | FT_RoundFix( FT_Fixed a );
|
---|
3059 |
|
---|
3060 |
|
---|
3061 | /*************************************************************************/
|
---|
3062 | /* */
|
---|
3063 | /* <Function> */
|
---|
3064 | /* FT_CeilFix */
|
---|
3065 | /* */
|
---|
3066 | /* <Description> */
|
---|
3067 | /* A very simple function used to compute the ceiling function of a */
|
---|
3068 | /* 16.16 fixed number. */
|
---|
3069 | /* */
|
---|
3070 | /* <Input> */
|
---|
3071 | /* a :: The number for which the ceiling function is to be computed. */
|
---|
3072 | /* */
|
---|
3073 | /* <Return> */
|
---|
3074 | /* The result of `(a + 0x10000 - 1) & -0x10000'. */
|
---|
3075 | /* */
|
---|
3076 | FT_EXPORT( FT_Fixed )
|
---|
3077 | FT_CeilFix( FT_Fixed a );
|
---|
3078 |
|
---|
3079 |
|
---|
3080 | /*************************************************************************/
|
---|
3081 | /* */
|
---|
3082 | /* <Function> */
|
---|
3083 | /* FT_FloorFix */
|
---|
3084 | /* */
|
---|
3085 | /* <Description> */
|
---|
3086 | /* A very simple function used to compute the floor function of a */
|
---|
3087 | /* 16.16 fixed number. */
|
---|
3088 | /* */
|
---|
3089 | /* <Input> */
|
---|
3090 | /* a :: The number for which the floor function is to be computed. */
|
---|
3091 | /* */
|
---|
3092 | /* <Return> */
|
---|
3093 | /* The result of `a & -0x10000'. */
|
---|
3094 | /* */
|
---|
3095 | FT_EXPORT( FT_Fixed )
|
---|
3096 | FT_FloorFix( FT_Fixed a );
|
---|
3097 |
|
---|
3098 |
|
---|
3099 | /*************************************************************************/
|
---|
3100 | /* */
|
---|
3101 | /* <Function> */
|
---|
3102 | /* FT_Vector_Transform */
|
---|
3103 | /* */
|
---|
3104 | /* <Description> */
|
---|
3105 | /* Transforms a single vector through a 2x2 matrix. */
|
---|
3106 | /* */
|
---|
3107 | /* <InOut> */
|
---|
3108 | /* vector :: The target vector to transform. */
|
---|
3109 | /* */
|
---|
3110 | /* <Input> */
|
---|
3111 | /* matrix :: A pointer to the source 2x2 matrix. */
|
---|
3112 | /* */
|
---|
3113 | /* <Note> */
|
---|
3114 | /* The result is undefined if either `vector' or `matrix' is invalid. */
|
---|
3115 | /* */
|
---|
3116 | FT_EXPORT( void )
|
---|
3117 | FT_Vector_Transform( FT_Vector* vec,
|
---|
3118 | const FT_Matrix* matrix );
|
---|
3119 |
|
---|
3120 |
|
---|
3121 | /* */
|
---|
3122 |
|
---|
3123 |
|
---|
3124 | FT_END_HEADER
|
---|
3125 |
|
---|
3126 | #endif /* __FREETYPE_H__ */
|
---|
3127 |
|
---|
3128 |
|
---|
3129 | /* END */
|
---|