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