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