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