1 /***************************************************************************/
5 /* FreeType high-level API and common types (specification only). */
7 /* Copyright 1996-2013 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
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. */
16 /***************************************************************************/
19 #ifndef __FREETYPE_H__
20 #define __FREETYPE_H__
24 #error "`ft2build.h' hasn't been included yet!"
25 #error "Please always use macros to include FreeType header files."
27 #error " #include <ft2build.h>"
28 #error " #include FT_FREETYPE_H"
33 #include FT_CONFIG_CONFIG_H
42 /*************************************************************************/
51 /* How client applications should allocate FreeType data structures. */
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. */
59 /*************************************************************************/
63 /*************************************************************************/
64 /*************************************************************************/
66 /* B A S I C T Y P E S */
68 /*************************************************************************/
69 /*************************************************************************/
72 /*************************************************************************/
81 /* The FreeType~2 base font interface. */
84 /* This section describes the public high-level API of FreeType~2. */
96 /* FT_FACE_FLAG_SCALABLE */
97 /* FT_FACE_FLAG_FIXED_SIZES */
98 /* FT_FACE_FLAG_FIXED_WIDTH */
99 /* FT_FACE_FLAG_HORIZONTAL */
100 /* FT_FACE_FLAG_VERTICAL */
101 /* FT_FACE_FLAG_SFNT */
102 /* FT_FACE_FLAG_KERNING */
103 /* FT_FACE_FLAG_MULTIPLE_MASTERS */
104 /* FT_FACE_FLAG_GLYPH_NAMES */
105 /* FT_FACE_FLAG_EXTERNAL_STREAM */
106 /* FT_FACE_FLAG_FAST_GLYPHS */
107 /* FT_FACE_FLAG_HINTER */
109 /* FT_STYLE_FLAG_BOLD */
110 /* FT_STYLE_FLAG_ITALIC */
113 /* FT_Size_Metrics */
115 /* FT_GlyphSlotRec */
116 /* FT_Glyph_Metrics */
121 /* FT_Init_FreeType */
122 /* FT_Done_FreeType */
126 /* FT_New_Memory_Face */
131 /* FT_Attach_Stream */
133 /* FT_Set_Char_Size */
134 /* FT_Set_Pixel_Sizes */
135 /* FT_Request_Size */
137 /* FT_Size_Request_Type */
138 /* FT_Size_Request */
139 /* FT_Set_Transform */
141 /* FT_Get_Char_Index */
142 /* FT_Get_Name_Index */
147 /* FT_OPEN_PATHNAME */
151 /* FT_LOAD_DEFAULT */
153 /* FT_LOAD_MONOCHROME */
154 /* FT_LOAD_LINEAR_DESIGN */
155 /* FT_LOAD_NO_SCALE */
156 /* FT_LOAD_NO_HINTING */
157 /* FT_LOAD_NO_BITMAP */
158 /* FT_LOAD_CROP_BITMAP */
160 /* FT_LOAD_VERTICAL_LAYOUT */
161 /* FT_LOAD_IGNORE_TRANSFORM */
162 /* FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */
163 /* FT_LOAD_FORCE_AUTOHINT */
164 /* FT_LOAD_NO_RECURSE */
165 /* FT_LOAD_PEDANTIC */
167 /* FT_LOAD_TARGET_NORMAL */
168 /* FT_LOAD_TARGET_LIGHT */
169 /* FT_LOAD_TARGET_MONO */
170 /* FT_LOAD_TARGET_LCD */
171 /* FT_LOAD_TARGET_LCD_V */
173 /* FT_Render_Glyph */
176 /* FT_Kerning_Mode */
177 /* FT_Get_Track_Kerning */
178 /* FT_Get_Glyph_Name */
179 /* FT_Get_Postscript_Name */
182 /* FT_Select_Charmap */
184 /* FT_Get_Charmap_Index */
186 /* FT_FSTYPE_INSTALLABLE_EMBEDDING */
187 /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING */
188 /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING */
189 /* FT_FSTYPE_EDITABLE_EMBEDDING */
190 /* FT_FSTYPE_NO_SUBSETTING */
191 /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY */
193 /* FT_Get_FSType_Flags */
195 /*************************************************************************/
198 /*************************************************************************/
201 /* FT_Glyph_Metrics */
204 /* A structure used to model the metrics of a single glyph. The */
205 /* values are expressed in 26.6 fractional pixel format; if the flag */
206 /* @FT_LOAD_NO_SCALE has been used while loading the glyph, values */
207 /* are expressed in font units instead. */
211 /* The glyph's width. */
214 /* The glyph's height. */
216 /* horiBearingX :: */
217 /* Left side bearing for horizontal layout. */
219 /* horiBearingY :: */
220 /* Top side bearing for horizontal layout. */
223 /* Advance width for horizontal layout. */
225 /* vertBearingX :: */
226 /* Left side bearing for vertical layout. */
228 /* vertBearingY :: */
229 /* Top side bearing for vertical layout. Larger positive values */
230 /* mean further below the vertical glyph origin. */
233 /* Advance height for vertical layout. Positive values mean the */
234 /* glyph has a positive advance downward. */
237 /* If not disabled with @FT_LOAD_NO_HINTING, the values represent */
238 /* dimensions of the hinted glyph (in case hinting is applicable). */
240 /* Stroking a glyph with an outside border does not increase */
241 /* `horiAdvance' or `vertAdvance'; you have to manually adjust these */
242 /* values to account for the added width and height. */
244 typedef struct FT_Glyph_Metrics_
260 /*************************************************************************/
266 /* This structure models the metrics of a bitmap strike (i.e., a set */
267 /* of glyphs for a given point size and resolution) in a bitmap font. */
268 /* It is used for the `available_sizes' field of @FT_Face. */
271 /* height :: The vertical distance, in pixels, between two */
272 /* consecutive baselines. It is always positive. */
274 /* width :: The average width, in pixels, of all glyphs in the */
277 /* size :: The nominal size of the strike in 26.6 fractional */
278 /* points. This field is not very useful. */
280 /* x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional */
283 /* y_ppem :: The vertical ppem (nominal height) in 26.6 fractional */
288 /* The nominal size given in a FNT font is not reliable. Thus when */
289 /* the driver finds it incorrect, it sets `size' to some calculated */
290 /* values and sets `x_ppem' and `y_ppem' to the pixel width and */
291 /* height given in the font, respectively. */
293 /* TrueType embedded bitmaps: */
294 /* `size', `width', and `height' values are not contained in the */
295 /* bitmap strike itself. They are computed from the global font */
298 typedef struct FT_Bitmap_Size_
311 /*************************************************************************/
312 /*************************************************************************/
314 /* O B J E C T C L A S S E S */
316 /*************************************************************************/
317 /*************************************************************************/
319 /*************************************************************************/
325 /* A handle to a FreeType library instance. Each `library' is */
326 /* completely independent from the others; it is the `root' of a set */
327 /* of objects like fonts, faces, sizes, etc. */
329 /* It also embeds a memory manager (see @FT_Memory), as well as a */
330 /* scan-line converter object (see @FT_Raster). */
332 /* For multi-threading applications each thread should have its own */
333 /* FT_Library object. */
336 /* Library objects are normally created by @FT_Init_FreeType, and */
337 /* destroyed with @FT_Done_FreeType. */
339 typedef struct FT_LibraryRec_ *FT_Library;
342 /*************************************************************************/
348 /* A handle to a given FreeType module object. Each module can be a */
349 /* font driver, a renderer, or anything else that provides services */
350 /* to the formers. */
352 typedef struct FT_ModuleRec_* FT_Module;
355 /*************************************************************************/
361 /* A handle to a given FreeType font driver object. Each font driver */
362 /* is a special module capable of creating faces from font files. */
364 typedef struct FT_DriverRec_* FT_Driver;
367 /*************************************************************************/
373 /* A handle to a given FreeType renderer. A renderer is a special */
374 /* module in charge of converting a glyph image to a bitmap, when */
375 /* necessary. Each renderer supports a given glyph image format, and */
376 /* one or more target surface depths. */
378 typedef struct FT_RendererRec_* FT_Renderer;
381 /*************************************************************************/
387 /* A handle to a given typographic face object. A face object models */
388 /* a given typeface, in a given style. */
391 /* Each face object also owns a single @FT_GlyphSlot object, as well */
392 /* as one or more @FT_Size objects. */
394 /* Use @FT_New_Face or @FT_Open_Face to create a new face object from */
395 /* a given filepathname or a custom input stream. */
397 /* Use @FT_Done_Face to destroy it (along with its slot and sizes). */
400 /* See @FT_FaceRec for the publicly accessible fields of a given face */
403 typedef struct FT_FaceRec_* FT_Face;
406 /*************************************************************************/
412 /* A handle to an object used to model a face scaled to a given */
413 /* character size. */
416 /* Each @FT_Face has an _active_ @FT_Size object that is used by */
417 /* functions like @FT_Load_Glyph to determine the scaling */
418 /* transformation which is used to load and hint glyphs and metrics. */
420 /* You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, */
421 /* @FT_Request_Size or even @FT_Select_Size to change the content */
422 /* (i.e., the scaling values) of the active @FT_Size. */
424 /* You can use @FT_New_Size to create additional size objects for a */
425 /* given @FT_Face, but they won't be used by other functions until */
426 /* you activate it through @FT_Activate_Size. Only one size can be */
427 /* activated at any given time per face. */
430 /* See @FT_SizeRec for the publicly accessible fields of a given size */
433 typedef struct FT_SizeRec_* FT_Size;
436 /*************************************************************************/
442 /* A handle to a given `glyph slot'. A slot is a container where it */
443 /* is possible to load any of the glyphs contained in its parent */
446 /* In other words, each time you call @FT_Load_Glyph or */
447 /* @FT_Load_Char, the slot's content is erased by the new glyph data, */
448 /* i.e., the glyph's metrics, its image (bitmap or outline), and */
449 /* other control information. */
452 /* See @FT_GlyphSlotRec for the publicly accessible glyph fields. */
454 typedef struct FT_GlyphSlotRec_* FT_GlyphSlot;
457 /*************************************************************************/
463 /* A handle to a given character map. A charmap is used to translate */
464 /* character codes in a given encoding into glyph indexes for its */
465 /* parent's face. Some font formats may provide several charmaps per */
468 /* Each face object owns zero or more charmaps, but only one of them */
469 /* can be `active' and used by @FT_Get_Char_Index or @FT_Load_Char. */
471 /* The list of available charmaps in a face is available through the */
472 /* `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec. */
474 /* The currently active charmap is available as `face->charmap'. */
475 /* You should call @FT_Set_Charmap to change it. */
478 /* When a new face is created (either through @FT_New_Face or */
479 /* @FT_Open_Face), the library looks for a Unicode charmap within */
480 /* the list and automatically activates it. */
483 /* See @FT_CharMapRec for the publicly accessible fields of a given */
486 typedef struct FT_CharMapRec_* FT_CharMap;
489 /*************************************************************************/
495 /* This macro converts four-letter tags into an unsigned long. It is */
496 /* used to define `encoding' identifiers (see @FT_Encoding). */
499 /* Since many 16-bit compilers don't like 32-bit enumerations, you */
500 /* should redefine this macro in case of problems to something like */
504 /* #define FT_ENC_TAG( value, a, b, c, d ) value */
507 /* to get a simple enumeration without assigning special numbers. */
511 #define FT_ENC_TAG( value, a, b, c, d ) \
512 value = ( ( (FT_UInt32)(a) << 24 ) | \
513 ( (FT_UInt32)(b) << 16 ) | \
514 ( (FT_UInt32)(c) << 8 ) | \
517 #endif /* FT_ENC_TAG */
520 /*************************************************************************/
526 /* An enumeration used to specify character sets supported by */
527 /* charmaps. Used in the @FT_Select_Charmap API function. */
530 /* Despite the name, this enumeration lists specific character */
531 /* repertories (i.e., charsets), and not text encoding methods (e.g., */
532 /* UTF-8, UTF-16, etc.). */
534 /* Other encodings might be defined in the future. */
537 /* FT_ENCODING_NONE :: */
538 /* The encoding value~0 is reserved. */
540 /* FT_ENCODING_UNICODE :: */
541 /* Corresponds to the Unicode character set. This value covers */
542 /* all versions of the Unicode repertoire, including ASCII and */
543 /* Latin-1. Most fonts include a Unicode charmap, but not all */
546 /* For example, if you want to access Unicode value U+1F028 (and */
547 /* the font contains it), use value 0x1F028 as the input value for */
548 /* @FT_Get_Char_Index. */
550 /* FT_ENCODING_MS_SYMBOL :: */
551 /* Corresponds to the Microsoft Symbol encoding, used to encode */
552 /* mathematical symbols in the 32..255 character code range. For */
553 /* more information, see `http://www.ceviz.net/symbol.htm'. */
555 /* FT_ENCODING_SJIS :: */
556 /* Corresponds to Japanese SJIS encoding. More info at */
557 /* at `http://langsupport.japanreference.com/encoding.shtml'. */
558 /* See note on multi-byte encodings below. */
560 /* FT_ENCODING_GB2312 :: */
561 /* Corresponds to an encoding system for Simplified Chinese as used */
562 /* used in mainland China. */
564 /* FT_ENCODING_BIG5 :: */
565 /* Corresponds to an encoding system for Traditional Chinese as */
566 /* used in Taiwan and Hong Kong. */
568 /* FT_ENCODING_WANSUNG :: */
569 /* Corresponds to the Korean encoding system known as Wansung. */
570 /* For more information see */
571 /* `http://www.microsoft.com/typography/unicode/949.txt'. */
573 /* FT_ENCODING_JOHAB :: */
574 /* The Korean standard character set (KS~C 5601-1992), which */
575 /* corresponds to MS Windows code page 1361. This character set */
576 /* includes all possible Hangeul character combinations. */
578 /* FT_ENCODING_ADOBE_LATIN_1 :: */
579 /* Corresponds to a Latin-1 encoding as defined in a Type~1 */
580 /* PostScript font. It is limited to 256 character codes. */
582 /* FT_ENCODING_ADOBE_STANDARD :: */
583 /* Corresponds to the Adobe Standard encoding, as found in Type~1, */
584 /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
587 /* FT_ENCODING_ADOBE_EXPERT :: */
588 /* Corresponds to the Adobe Expert encoding, as found in Type~1, */
589 /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
592 /* FT_ENCODING_ADOBE_CUSTOM :: */
593 /* Corresponds to a custom encoding, as found in Type~1, CFF, and */
594 /* OpenType/CFF fonts. It is limited to 256 character codes. */
596 /* FT_ENCODING_APPLE_ROMAN :: */
597 /* Corresponds to the 8-bit Apple roman encoding. Many TrueType */
598 /* and OpenType fonts contain a charmap for this encoding, since */
599 /* older versions of Mac OS are able to use it. */
601 /* FT_ENCODING_OLD_LATIN_2 :: */
602 /* This value is deprecated and was never used nor reported by */
603 /* FreeType. Don't use or test for it. */
605 /* FT_ENCODING_MS_SJIS :: */
606 /* Same as FT_ENCODING_SJIS. Deprecated. */
608 /* FT_ENCODING_MS_GB2312 :: */
609 /* Same as FT_ENCODING_GB2312. Deprecated. */
611 /* FT_ENCODING_MS_BIG5 :: */
612 /* Same as FT_ENCODING_BIG5. Deprecated. */
614 /* FT_ENCODING_MS_WANSUNG :: */
615 /* Same as FT_ENCODING_WANSUNG. Deprecated. */
617 /* FT_ENCODING_MS_JOHAB :: */
618 /* Same as FT_ENCODING_JOHAB. Deprecated. */
621 /* By default, FreeType automatically synthesizes a Unicode charmap */
622 /* for PostScript fonts, using their glyph names dictionaries. */
623 /* However, it also reports the encodings defined explicitly in the */
624 /* font file, for the cases when they are needed, with the Adobe */
625 /* values as well. */
627 /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */
628 /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */
629 /* FT_ENCODING_UNICODE). Use @FT_Get_BDF_Charset_ID to find out */
630 /* which encoding is really present. If, for example, the */
631 /* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */
632 /* the font is encoded in KOI8-R. */
634 /* FT_ENCODING_NONE is always set (with a single exception) by the */
635 /* winfonts driver. Use @FT_Get_WinFNT_Header and examine the */
636 /* `charset' field of the @FT_WinFNT_HeaderRec structure to find out */
637 /* which encoding is really present. For example, */
638 /* @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for */
641 /* FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */
642 /* and `encoding_id' is not @TT_MAC_ID_ROMAN (otherwise it is set to */
643 /* FT_ENCODING_APPLE_ROMAN). */
645 /* If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function */
646 /* @FT_Get_CMap_Language_ID to query the Mac language ID which may */
647 /* be needed to be able to distinguish Apple encoding variants. See */
649 /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT */
651 /* to get an idea how to do that. Basically, if the language ID */
652 /* is~0, don't use it, otherwise subtract 1 from the language ID. */
653 /* Then examine `encoding_id'. If, for example, `encoding_id' is */
654 /* @TT_MAC_ID_ROMAN and the language ID (minus~1) is */
655 /* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */
656 /* @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi */
657 /* variant the Arabic encoding. */
659 typedef enum FT_Encoding_
661 FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),
663 FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),
664 FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ),
666 FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ),
667 FT_ENC_TAG( FT_ENCODING_GB2312, 'g', 'b', ' ', ' ' ),
668 FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ),
669 FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),
670 FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ),
672 /* for backwards compatibility */
673 FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS,
674 FT_ENCODING_MS_GB2312 = FT_ENCODING_GB2312,
675 FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5,
676 FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
677 FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB,
679 FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),
680 FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ),
681 FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ),
682 FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ),
684 FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),
686 FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )
691 /*************************************************************************/
694 /* ft_encoding_xxx */
697 /* These constants are deprecated; use the corresponding @FT_Encoding */
698 /* values instead. */
700 #define ft_encoding_none FT_ENCODING_NONE
701 #define ft_encoding_unicode FT_ENCODING_UNICODE
702 #define ft_encoding_symbol FT_ENCODING_MS_SYMBOL
703 #define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1
704 #define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2
705 #define ft_encoding_sjis FT_ENCODING_SJIS
706 #define ft_encoding_gb2312 FT_ENCODING_GB2312
707 #define ft_encoding_big5 FT_ENCODING_BIG5
708 #define ft_encoding_wansung FT_ENCODING_WANSUNG
709 #define ft_encoding_johab FT_ENCODING_JOHAB
711 #define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD
712 #define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT
713 #define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM
714 #define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN
717 /*************************************************************************/
723 /* The base charmap structure. */
726 /* face :: A handle to the parent face object. */
728 /* encoding :: An @FT_Encoding tag identifying the charmap. Use */
729 /* this with @FT_Select_Charmap. */
731 /* platform_id :: An ID number describing the platform for the */
732 /* following encoding ID. This comes directly from */
733 /* the TrueType specification and should be emulated */
734 /* for other formats. */
736 /* encoding_id :: A platform specific encoding number. This also */
737 /* comes from the TrueType specification and should be */
738 /* emulated similarly. */
740 typedef struct FT_CharMapRec_
743 FT_Encoding encoding;
744 FT_UShort platform_id;
745 FT_UShort encoding_id;
750 /*************************************************************************/
751 /*************************************************************************/
753 /* B A S E O B J E C T C L A S S E S */
755 /*************************************************************************/
756 /*************************************************************************/
759 /*************************************************************************/
762 /* FT_Face_Internal */
765 /* An opaque handle to an `FT_Face_InternalRec' structure, used to */
766 /* model private data of a given @FT_Face object. */
768 /* This structure might change between releases of FreeType~2 and is */
769 /* not generally available to client applications. */
771 typedef struct FT_Face_InternalRec_* FT_Face_Internal;
774 /*************************************************************************/
780 /* FreeType root face class structure. A face object models a */
781 /* typeface in a font file. */
784 /* num_faces :: The number of faces in the font file. Some */
785 /* font formats can have multiple faces in */
788 /* face_index :: The index of the face in the font file. It */
789 /* is set to~0 if there is only one face in */
792 /* face_flags :: A set of bit flags that give important */
793 /* information about the face; see */
794 /* @FT_FACE_FLAG_XXX for the details. */
796 /* style_flags :: A set of bit flags indicating the style of */
797 /* the face; see @FT_STYLE_FLAG_XXX for the */
800 /* num_glyphs :: The number of glyphs in the face. If the */
801 /* face is scalable and has sbits (see */
802 /* `num_fixed_sizes'), it is set to the number */
803 /* of outline glyphs. */
805 /* For CID-keyed fonts, this value gives the */
806 /* highest CID used in the font. */
808 /* family_name :: The face's family name. This is an ASCII */
809 /* string, usually in English, which describes */
810 /* the typeface's family (like `Times New */
811 /* Roman', `Bodoni', `Garamond', etc). This */
812 /* is a least common denominator used to list */
813 /* fonts. Some formats (TrueType & OpenType) */
814 /* provide localized and Unicode versions of */
815 /* this string. Applications should use the */
816 /* format specific interface to access them. */
817 /* Can be NULL (e.g., in fonts embedded in a */
820 /* style_name :: The face's style name. This is an ASCII */
821 /* string, usually in English, which describes */
822 /* the typeface's style (like `Italic', */
823 /* `Bold', `Condensed', etc). Not all font */
824 /* formats provide a style name, so this field */
825 /* is optional, and can be set to NULL. As */
826 /* for `family_name', some formats provide */
827 /* localized and Unicode versions of this */
828 /* string. Applications should use the format */
829 /* specific interface to access them. */
831 /* num_fixed_sizes :: The number of bitmap strikes in the face. */
832 /* Even if the face is scalable, there might */
833 /* still be bitmap strikes, which are called */
834 /* `sbits' in that case. */
836 /* available_sizes :: An array of @FT_Bitmap_Size for all bitmap */
837 /* strikes in the face. It is set to NULL if */
838 /* there is no bitmap strike. */
840 /* num_charmaps :: The number of charmaps in the face. */
842 /* charmaps :: An array of the charmaps of the face. */
844 /* generic :: A field reserved for client uses. See the */
845 /* @FT_Generic type description. */
847 /* bbox :: The font bounding box. Coordinates are */
848 /* expressed in font units (see */
849 /* `units_per_EM'). The box is large enough */
850 /* to contain any glyph from the font. Thus, */
851 /* `bbox.yMax' can be seen as the `maximum */
852 /* ascender', and `bbox.yMin' as the `minimum */
853 /* descender'. Only relevant for scalable */
856 /* Note that the bounding box might be off by */
857 /* (at least) one pixel for hinted fonts. See */
858 /* @FT_Size_Metrics for further discussion. */
860 /* units_per_EM :: The number of font units per EM square for */
861 /* this face. This is typically 2048 for */
862 /* TrueType fonts, and 1000 for Type~1 fonts. */
863 /* Only relevant for scalable formats. */
865 /* ascender :: The typographic ascender of the face, */
866 /* expressed in font units. For font formats */
867 /* not having this information, it is set to */
868 /* `bbox.yMax'. Only relevant for scalable */
871 /* descender :: The typographic descender of the face, */
872 /* expressed in font units. For font formats */
873 /* not having this information, it is set to */
874 /* `bbox.yMin'. Note that this field is */
875 /* usually negative. Only relevant for */
876 /* scalable formats. */
878 /* height :: This value is the vertical distance */
879 /* between two consecutive baselines, */
880 /* expressed in font units. It is always */
881 /* positive. Only relevant for scalable */
884 /* If you want the global glyph height, use */
885 /* `ascender - descender'. */
887 /* max_advance_width :: The maximum advance width, in font units, */
888 /* for all glyphs in this face. This can be */
889 /* used to make word wrapping computations */
890 /* faster. Only relevant for scalable */
893 /* max_advance_height :: The maximum advance height, in font units, */
894 /* for all glyphs in this face. This is only */
895 /* relevant for vertical layouts, and is set */
896 /* to `height' for fonts that do not provide */
897 /* vertical metrics. Only relevant for */
898 /* scalable formats. */
900 /* underline_position :: The position, in font units, of the */
901 /* underline line for this face. It is the */
902 /* center of the underlining stem. Only */
903 /* relevant for scalable formats. */
905 /* underline_thickness :: The thickness, in font units, of the */
906 /* underline for this face. Only relevant for */
907 /* scalable formats. */
909 /* glyph :: The face's associated glyph slot(s). */
911 /* size :: The current active size for this face. */
913 /* charmap :: The current active charmap for this face. */
916 /* Fields may be changed after a call to @FT_Attach_File or */
917 /* @FT_Attach_Stream. */
919 typedef struct FT_FaceRec_
929 FT_String* family_name;
930 FT_String* style_name;
932 FT_Int num_fixed_sizes;
933 FT_Bitmap_Size* available_sizes;
936 FT_CharMap* charmaps;
940 /*# The following member variables (down to `underline_thickness') */
941 /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */
942 /*# for bitmap fonts. */
945 FT_UShort units_per_EM;
950 FT_Short max_advance_width;
951 FT_Short max_advance_height;
953 FT_Short underline_position;
954 FT_Short underline_thickness;
966 FT_ListRec sizes_list;
968 FT_Generic autohint; /* face-specific auto-hinter data */
969 void* extensions; /* unused */
971 FT_Face_Internal internal;
978 /*************************************************************************/
981 /* FT_FACE_FLAG_XXX */
984 /* A list of bit flags used in the `face_flags' field of the */
985 /* @FT_FaceRec structure. They inform client applications of */
986 /* properties of the corresponding face. */
989 /* FT_FACE_FLAG_SCALABLE :: */
990 /* Indicates that the face contains outline glyphs. This doesn't */
991 /* prevent bitmap strikes, i.e., a face can have both this and */
992 /* and @FT_FACE_FLAG_FIXED_SIZES set. */
994 /* FT_FACE_FLAG_FIXED_SIZES :: */
995 /* Indicates that the face contains bitmap strikes. See also the */
996 /* `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec. */
998 /* FT_FACE_FLAG_FIXED_WIDTH :: */
999 /* Indicates that the face contains fixed-width characters (like */
1000 /* Courier, Lucido, MonoType, etc.). */
1002 /* FT_FACE_FLAG_SFNT :: */
1003 /* Indicates that the face uses the `sfnt' storage scheme. For */
1004 /* now, this means TrueType and OpenType. */
1006 /* FT_FACE_FLAG_HORIZONTAL :: */
1007 /* Indicates that the face contains horizontal glyph metrics. This */
1008 /* should be set for all common formats. */
1010 /* FT_FACE_FLAG_VERTICAL :: */
1011 /* Indicates that the face contains vertical glyph metrics. This */
1012 /* is only available in some formats, not all of them. */
1014 /* FT_FACE_FLAG_KERNING :: */
1015 /* Indicates that the face contains kerning information. If set, */
1016 /* the kerning distance can be retrieved through the function */
1017 /* @FT_Get_Kerning. Otherwise the function always return the */
1018 /* vector (0,0). Note that FreeType doesn't handle kerning data */
1019 /* from the `GPOS' table (as present in some OpenType fonts). */
1021 /* FT_FACE_FLAG_FAST_GLYPHS :: */
1022 /* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */
1024 /* FT_FACE_FLAG_MULTIPLE_MASTERS :: */
1025 /* Indicates that the font contains multiple masters and is capable */
1026 /* of interpolating between them. See the multiple-masters */
1027 /* specific API for details. */
1029 /* FT_FACE_FLAG_GLYPH_NAMES :: */
1030 /* Indicates that the font contains glyph names that can be */
1031 /* retrieved through @FT_Get_Glyph_Name. Note that some TrueType */
1032 /* fonts contain broken glyph name tables. Use the function */
1033 /* @FT_Has_PS_Glyph_Names when needed. */
1035 /* FT_FACE_FLAG_EXTERNAL_STREAM :: */
1036 /* Used internally by FreeType to indicate that a face's stream was */
1037 /* provided by the client application and should not be destroyed */
1038 /* when @FT_Done_Face is called. Don't read or test this flag. */
1040 /* FT_FACE_FLAG_HINTER :: */
1041 /* Set if the font driver has a hinting machine of its own. For */
1042 /* example, with TrueType fonts, it makes sense to use data from */
1043 /* the SFNT `gasp' table only if the native TrueType hinting engine */
1044 /* (with the bytecode interpreter) is available and active. */
1046 /* FT_FACE_FLAG_CID_KEYED :: */
1047 /* Set if the font is CID-keyed. In that case, the font is not */
1048 /* accessed by glyph indices but by CID values. For subsetted */
1049 /* CID-keyed fonts this has the consequence that not all index */
1050 /* values are a valid argument to FT_Load_Glyph. Only the CID */
1051 /* values for which corresponding glyphs in the subsetted font */
1052 /* exist make FT_Load_Glyph return successfully; in all other cases */
1053 /* you get an `FT_Err_Invalid_Argument' error. */
1055 /* Note that CID-keyed fonts which are in an SFNT wrapper don't */
1056 /* have this flag set since the glyphs are accessed in the normal */
1057 /* way (using contiguous indices); the `CID-ness' isn't visible to */
1058 /* the application. */
1060 /* FT_FACE_FLAG_TRICKY :: */
1061 /* Set if the font is `tricky', this is, it always needs the */
1062 /* font format's native hinting engine to get a reasonable result. */
1063 /* A typical example is the Chinese font `mingli.ttf' which uses */
1064 /* TrueType bytecode instructions to move and scale all of its */
1067 /* It is not possible to autohint such fonts using */
1068 /* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */
1069 /* @FT_LOAD_NO_HINTING. You have to set both @FT_LOAD_NO_HINTING */
1070 /* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */
1071 /* probably never want this except for demonstration purposes. */
1073 /* Currently, there are about a dozen TrueType fonts in the list of */
1074 /* tricky fonts; they are hard-coded in file `ttobjs.c'. */
1076 #define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
1077 #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
1078 #define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )
1079 #define FT_FACE_FLAG_SFNT ( 1L << 3 )
1080 #define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 )
1081 #define FT_FACE_FLAG_VERTICAL ( 1L << 5 )
1082 #define FT_FACE_FLAG_KERNING ( 1L << 6 )
1083 #define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 )
1084 #define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 )
1085 #define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 )
1086 #define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )
1087 #define FT_FACE_FLAG_HINTER ( 1L << 11 )
1088 #define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )
1089 #define FT_FACE_FLAG_TRICKY ( 1L << 13 )
1092 /*************************************************************************
1095 * FT_HAS_HORIZONTAL( face )
1098 * A macro that returns true whenever a face object contains
1099 * horizontal metrics (this is true for all font formats though).
1102 * @FT_HAS_VERTICAL can be used to check for vertical metrics.
1105 #define FT_HAS_HORIZONTAL( face ) \
1106 ( face->face_flags & FT_FACE_FLAG_HORIZONTAL )
1109 /*************************************************************************
1112 * FT_HAS_VERTICAL( face )
1115 * A macro that returns true whenever a face object contains real
1116 * vertical metrics (and not only synthesized ones).
1119 #define FT_HAS_VERTICAL( face ) \
1120 ( face->face_flags & FT_FACE_FLAG_VERTICAL )
1123 /*************************************************************************
1126 * FT_HAS_KERNING( face )
1129 * A macro that returns true whenever a face object contains kerning
1130 * data that can be accessed with @FT_Get_Kerning.
1133 #define FT_HAS_KERNING( face ) \
1134 ( face->face_flags & FT_FACE_FLAG_KERNING )
1137 /*************************************************************************
1140 * FT_IS_SCALABLE( face )
1143 * A macro that returns true whenever a face object contains a scalable
1144 * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF,
1145 * and PFR font formats.
1148 #define FT_IS_SCALABLE( face ) \
1149 ( face->face_flags & FT_FACE_FLAG_SCALABLE )
1152 /*************************************************************************
1155 * FT_IS_SFNT( face )
1158 * A macro that returns true whenever a face object contains a font
1159 * whose format is based on the SFNT storage scheme. This usually
1160 * means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded
1163 * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and
1164 * @FT_TRUETYPE_TABLES_H are available.
1167 #define FT_IS_SFNT( face ) \
1168 ( face->face_flags & FT_FACE_FLAG_SFNT )
1171 /*************************************************************************
1174 * FT_IS_FIXED_WIDTH( face )
1177 * A macro that returns true whenever a face object contains a font face
1178 * that contains fixed-width (or `monospace', `fixed-pitch', etc.)
1182 #define FT_IS_FIXED_WIDTH( face ) \
1183 ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
1186 /*************************************************************************
1189 * FT_HAS_FIXED_SIZES( face )
1192 * A macro that returns true whenever a face object contains some
1193 * embedded bitmaps. See the `available_sizes' field of the
1194 * @FT_FaceRec structure.
1197 #define FT_HAS_FIXED_SIZES( face ) \
1198 ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
1201 /*************************************************************************
1204 * FT_HAS_FAST_GLYPHS( face )
1210 #define FT_HAS_FAST_GLYPHS( face ) 0
1213 /*************************************************************************
1216 * FT_HAS_GLYPH_NAMES( face )
1219 * A macro that returns true whenever a face object contains some glyph
1220 * names that can be accessed through @FT_Get_Glyph_Name.
1223 #define FT_HAS_GLYPH_NAMES( face ) \
1224 ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
1227 /*************************************************************************
1230 * FT_HAS_MULTIPLE_MASTERS( face )
1233 * A macro that returns true whenever a face object contains some
1234 * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H
1235 * are then available to choose the exact design you want.
1238 #define FT_HAS_MULTIPLE_MASTERS( face ) \
1239 ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
1242 /*************************************************************************
1245 * FT_IS_CID_KEYED( face )
1248 * A macro that returns true whenever a face object contains a CID-keyed
1249 * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more
1252 * If this macro is true, all functions defined in @FT_CID_H are
1256 #define FT_IS_CID_KEYED( face ) \
1257 ( face->face_flags & FT_FACE_FLAG_CID_KEYED )
1260 /*************************************************************************
1263 * FT_IS_TRICKY( face )
1266 * A macro that returns true whenever a face represents a `tricky' font.
1267 * See the discussion of @FT_FACE_FLAG_TRICKY for more details.
1270 #define FT_IS_TRICKY( face ) \
1271 ( face->face_flags & FT_FACE_FLAG_TRICKY )
1274 /*************************************************************************/
1277 /* FT_STYLE_FLAG_XXX */
1280 /* A list of bit-flags used to indicate the style of a given face. */
1281 /* These are used in the `style_flags' field of @FT_FaceRec. */
1284 /* FT_STYLE_FLAG_ITALIC :: */
1285 /* Indicates that a given face style is italic or oblique. */
1287 /* FT_STYLE_FLAG_BOLD :: */
1288 /* Indicates that a given face is bold. */
1291 /* The style information as provided by FreeType is very basic. More */
1292 /* details are beyond the scope and should be done on a higher level */
1293 /* (for example, by analyzing various fields of the `OS/2' table in */
1294 /* SFNT based fonts). */
1296 #define FT_STYLE_FLAG_ITALIC ( 1 << 0 )
1297 #define FT_STYLE_FLAG_BOLD ( 1 << 1 )
1300 /*************************************************************************/
1303 /* FT_Size_Internal */
1306 /* An opaque handle to an `FT_Size_InternalRec' structure, used to */
1307 /* model private data of a given @FT_Size object. */
1309 typedef struct FT_Size_InternalRec_* FT_Size_Internal;
1312 /*************************************************************************/
1315 /* FT_Size_Metrics */
1318 /* The size metrics structure gives the metrics of a size object. */
1321 /* x_ppem :: The width of the scaled EM square in pixels, hence */
1322 /* the term `ppem' (pixels per EM). It is also */
1323 /* referred to as `nominal width'. */
1325 /* y_ppem :: The height of the scaled EM square in pixels, */
1326 /* hence the term `ppem' (pixels per EM). It is also */
1327 /* referred to as `nominal height'. */
1329 /* x_scale :: A 16.16 fractional scaling value used to convert */
1330 /* horizontal metrics from font units to 26.6 */
1331 /* fractional pixels. Only relevant for scalable */
1334 /* y_scale :: A 16.16 fractional scaling value used to convert */
1335 /* vertical metrics from font units to 26.6 */
1336 /* fractional pixels. Only relevant for scalable */
1339 /* ascender :: The ascender in 26.6 fractional pixels. See */
1340 /* @FT_FaceRec for the details. */
1342 /* descender :: The descender in 26.6 fractional pixels. See */
1343 /* @FT_FaceRec for the details. */
1345 /* height :: The height in 26.6 fractional pixels. See */
1346 /* @FT_FaceRec for the details. */
1348 /* max_advance :: The maximum advance width in 26.6 fractional */
1349 /* pixels. See @FT_FaceRec for the details. */
1352 /* The scaling values, if relevant, are determined first during a */
1353 /* size changing operation. The remaining fields are then set by the */
1354 /* driver. For scalable formats, they are usually set to scaled */
1355 /* values of the corresponding fields in @FT_FaceRec. */
1357 /* Note that due to glyph hinting, these values might not be exact */
1358 /* for certain fonts. Thus they must be treated as unreliable */
1359 /* with an error margin of at least one pixel! */
1361 /* Indeed, the only way to get the exact metrics is to render _all_ */
1362 /* glyphs. As this would be a definite performance hit, it is up to */
1363 /* client applications to perform such computations. */
1365 /* The FT_Size_Metrics structure is valid for bitmap fonts also. */
1367 typedef struct FT_Size_Metrics_
1369 FT_UShort x_ppem; /* horizontal pixels per EM */
1370 FT_UShort y_ppem; /* vertical pixels per EM */
1372 FT_Fixed x_scale; /* scaling values used to convert font */
1373 FT_Fixed y_scale; /* units to 26.6 fractional pixels */
1375 FT_Pos ascender; /* ascender in 26.6 frac. pixels */
1376 FT_Pos descender; /* descender in 26.6 frac. pixels */
1377 FT_Pos height; /* text height in 26.6 frac. pixels */
1378 FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */
1383 /*************************************************************************/
1389 /* FreeType root size class structure. A size object models a face */
1390 /* object at a given size. */
1393 /* face :: Handle to the parent face object. */
1395 /* generic :: A typeless pointer, which is unused by the FreeType */
1396 /* library or any of its drivers. It can be used by */
1397 /* client applications to link their own data to each size */
1400 /* metrics :: Metrics for this size object. This field is read-only. */
1402 typedef struct FT_SizeRec_
1404 FT_Face face; /* parent face object */
1405 FT_Generic generic; /* generic pointer for client uses */
1406 FT_Size_Metrics metrics; /* size metrics */
1407 FT_Size_Internal internal;
1412 /*************************************************************************/
1418 /* The subglyph structure is an internal object used to describe */
1419 /* subglyphs (for example, in the case of composites). */
1422 /* The subglyph implementation is not part of the high-level API, */
1423 /* hence the forward structure declaration. */
1425 /* You can however retrieve subglyph information with */
1426 /* @FT_Get_SubGlyph_Info. */
1428 typedef struct FT_SubGlyphRec_* FT_SubGlyph;
1431 /*************************************************************************/
1434 /* FT_Slot_Internal */
1437 /* An opaque handle to an `FT_Slot_InternalRec' structure, used to */
1438 /* model private data of a given @FT_GlyphSlot object. */
1440 typedef struct FT_Slot_InternalRec_* FT_Slot_Internal;
1443 /*************************************************************************/
1446 /* FT_GlyphSlotRec */
1449 /* FreeType root glyph slot class structure. A glyph slot is a */
1450 /* container where individual glyphs can be loaded, be they in */
1451 /* outline or bitmap format. */
1454 /* library :: A handle to the FreeType library instance */
1455 /* this slot belongs to. */
1457 /* face :: A handle to the parent face object. */
1459 /* next :: In some cases (like some font tools), several */
1460 /* glyph slots per face object can be a good */
1461 /* thing. As this is rare, the glyph slots are */
1462 /* listed through a direct, single-linked list */
1463 /* using its `next' field. */
1465 /* generic :: A typeless pointer which is unused by the */
1466 /* FreeType library or any of its drivers. It */
1467 /* can be used by client applications to link */
1468 /* their own data to each glyph slot object. */
1470 /* metrics :: The metrics of the last loaded glyph in the */
1471 /* slot. The returned values depend on the last */
1472 /* load flags (see the @FT_Load_Glyph API */
1473 /* function) and can be expressed either in 26.6 */
1474 /* fractional pixels or font units. */
1476 /* Note that even when the glyph image is */
1477 /* transformed, the metrics are not. */
1479 /* linearHoriAdvance :: The advance width of the unhinted glyph. */
1480 /* Its value is expressed in 16.16 fractional */
1481 /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
1482 /* when loading the glyph. This field can be */
1483 /* important to perform correct WYSIWYG layout. */
1484 /* Only relevant for outline glyphs. */
1486 /* linearVertAdvance :: The advance height of the unhinted glyph. */
1487 /* Its value is expressed in 16.16 fractional */
1488 /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
1489 /* when loading the glyph. This field can be */
1490 /* important to perform correct WYSIWYG layout. */
1491 /* Only relevant for outline glyphs. */
1493 /* advance :: This shorthand is, depending on */
1494 /* @FT_LOAD_IGNORE_TRANSFORM, the transformed */
1495 /* advance width for the glyph (in 26.6 */
1496 /* fractional pixel format). As specified with */
1497 /* @FT_LOAD_VERTICAL_LAYOUT, it uses either the */
1498 /* `horiAdvance' or the `vertAdvance' value of */
1499 /* `metrics' field. */
1501 /* format :: This field indicates the format of the image */
1502 /* contained in the glyph slot. Typically */
1503 /* @FT_GLYPH_FORMAT_BITMAP, */
1504 /* @FT_GLYPH_FORMAT_OUTLINE, or */
1505 /* @FT_GLYPH_FORMAT_COMPOSITE, but others are */
1508 /* bitmap :: This field is used as a bitmap descriptor */
1509 /* when the slot format is */
1510 /* @FT_GLYPH_FORMAT_BITMAP. Note that the */
1511 /* address and content of the bitmap buffer can */
1512 /* change between calls of @FT_Load_Glyph and a */
1513 /* few other functions. */
1515 /* bitmap_left :: This is the bitmap's left bearing expressed */
1516 /* in integer pixels. Of course, this is only */
1517 /* valid if the format is */
1518 /* @FT_GLYPH_FORMAT_BITMAP. */
1520 /* bitmap_top :: This is the bitmap's top bearing expressed in */
1521 /* integer pixels. Remember that this is the */
1522 /* distance from the baseline to the top-most */
1523 /* glyph scanline, upwards y~coordinates being */
1526 /* outline :: The outline descriptor for the current glyph */
1527 /* image if its format is */
1528 /* @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is */
1529 /* loaded, `outline' can be transformed, */
1530 /* distorted, embolded, etc. However, it must */
1533 /* num_subglyphs :: The number of subglyphs in a composite glyph. */
1534 /* This field is only valid for the composite */
1535 /* glyph format that should normally only be */
1536 /* loaded with the @FT_LOAD_NO_RECURSE flag. */
1537 /* For now this is internal to FreeType. */
1539 /* subglyphs :: An array of subglyph descriptors for */
1540 /* composite glyphs. There are `num_subglyphs' */
1541 /* elements in there. Currently internal to */
1544 /* control_data :: Certain font drivers can also return the */
1545 /* control data for a given glyph image (e.g. */
1546 /* TrueType bytecode, Type~1 charstrings, etc.). */
1547 /* This field is a pointer to such data. */
1549 /* control_len :: This is the length in bytes of the control */
1552 /* other :: Really wicked formats can use this pointer to */
1553 /* present their own glyph image to client */
1554 /* applications. Note that the application */
1555 /* needs to know about the image format. */
1557 /* lsb_delta :: The difference between hinted and unhinted */
1558 /* left side bearing while autohinting is */
1559 /* active. Zero otherwise. */
1561 /* rsb_delta :: The difference between hinted and unhinted */
1562 /* right side bearing while autohinting is */
1563 /* active. Zero otherwise. */
1566 /* If @FT_Load_Glyph is called with default flags (see */
1567 /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */
1568 /* its native format (e.g., an outline glyph for TrueType and Type~1 */
1571 /* This image can later be converted into a bitmap by calling */
1572 /* @FT_Render_Glyph. This function finds the current renderer for */
1573 /* the native image's format, then invokes it. */
1575 /* The renderer is in charge of transforming the native image through */
1576 /* the slot's face transformation fields, then converting it into a */
1577 /* bitmap that is returned in `slot->bitmap'. */
1579 /* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */
1580 /* to specify the position of the bitmap relative to the current pen */
1581 /* position (e.g., coordinates (0,0) on the baseline). Of course, */
1582 /* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */
1585 /* Here a small pseudo code fragment which shows how to use */
1586 /* `lsb_delta' and `rsb_delta': */
1589 /* FT_Pos origin_x = 0; */
1590 /* FT_Pos prev_rsb_delta = 0; */
1593 /* for all glyphs do */
1594 /* <compute kern between current and previous glyph and add it to */
1597 /* <load glyph with `FT_Load_Glyph'> */
1599 /* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */
1600 /* origin_x -= 64; */
1601 /* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */
1602 /* origin_x += 64; */
1604 /* prev_rsb_delta = face->glyph->rsb_delta; */
1606 /* <save glyph image, or render glyph, or ...> */
1608 /* origin_x += face->glyph->advance.x; */
1612 typedef struct FT_GlyphSlotRec_
1617 FT_UInt reserved; /* retained for binary compatibility */
1620 FT_Glyph_Metrics metrics;
1621 FT_Fixed linearHoriAdvance;
1622 FT_Fixed linearVertAdvance;
1625 FT_Glyph_Format format;
1633 FT_UInt num_subglyphs;
1634 FT_SubGlyph subglyphs;
1644 FT_Slot_Internal internal;
1649 /*************************************************************************/
1650 /*************************************************************************/
1652 /* F U N C T I O N S */
1654 /*************************************************************************/
1655 /*************************************************************************/
1658 /*************************************************************************/
1661 /* FT_Init_FreeType */
1664 /* Initialize a new FreeType library object. The set of modules */
1665 /* that are registered by this function is determined at build time. */
1668 /* alibrary :: A handle to a new library object. */
1671 /* FreeType error code. 0~means success. */
1674 /* In case you want to provide your own memory allocating routines, */
1675 /* use @FT_New_Library instead, followed by a call to */
1676 /* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module). */
1678 /* For multi-threading applications each thread should have its own */
1679 /* FT_Library object. */
1681 FT_EXPORT( FT_Error )
1682 FT_Init_FreeType( FT_Library *alibrary );
1685 /*************************************************************************/
1688 /* FT_Done_FreeType */
1691 /* Destroy a given FreeType library object and all of its children, */
1692 /* including resources, drivers, faces, sizes, etc. */
1695 /* library :: A handle to the target library object. */
1698 /* FreeType error code. 0~means success. */
1700 FT_EXPORT( FT_Error )
1701 FT_Done_FreeType( FT_Library library );
1704 /*************************************************************************/
1710 /* A list of bit-field constants used within the `flags' field of the */
1711 /* @FT_Open_Args structure. */
1714 /* FT_OPEN_MEMORY :: This is a memory-based stream. */
1716 /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */
1718 /* FT_OPEN_PATHNAME :: Create a new input stream from a C~path */
1721 /* FT_OPEN_DRIVER :: Use the `driver' field. */
1723 /* FT_OPEN_PARAMS :: Use the `num_params' and `params' fields. */
1725 /* ft_open_memory :: Deprecated; use @FT_OPEN_MEMORY instead. */
1727 /* ft_open_stream :: Deprecated; use @FT_OPEN_STREAM instead. */
1729 /* ft_open_pathname :: Deprecated; use @FT_OPEN_PATHNAME instead. */
1731 /* ft_open_driver :: Deprecated; use @FT_OPEN_DRIVER instead. */
1733 /* ft_open_params :: Deprecated; use @FT_OPEN_PARAMS instead. */
1736 /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */
1737 /* flags are mutually exclusive. */
1739 #define FT_OPEN_MEMORY 0x1
1740 #define FT_OPEN_STREAM 0x2
1741 #define FT_OPEN_PATHNAME 0x4
1742 #define FT_OPEN_DRIVER 0x8
1743 #define FT_OPEN_PARAMS 0x10
1745 #define ft_open_memory FT_OPEN_MEMORY /* deprecated */
1746 #define ft_open_stream FT_OPEN_STREAM /* deprecated */
1747 #define ft_open_pathname FT_OPEN_PATHNAME /* deprecated */
1748 #define ft_open_driver FT_OPEN_DRIVER /* deprecated */
1749 #define ft_open_params FT_OPEN_PARAMS /* deprecated */
1752 /*************************************************************************/
1758 /* A simple structure used to pass more or less generic parameters to */
1759 /* @FT_Open_Face. */
1762 /* tag :: A four-byte identification tag. */
1764 /* data :: A pointer to the parameter data. */
1767 /* The ID and function of parameters are driver-specific. See the */
1768 /* various FT_PARAM_TAG_XXX flags for more information. */
1770 typedef struct FT_Parameter_
1778 /*************************************************************************/
1784 /* A structure used to indicate how to open a new font file or */
1785 /* stream. A pointer to such a structure can be used as a parameter */
1786 /* for the functions @FT_Open_Face and @FT_Attach_Stream. */
1789 /* flags :: A set of bit flags indicating how to use the */
1792 /* memory_base :: The first byte of the file in memory. */
1794 /* memory_size :: The size in bytes of the file in memory. */
1796 /* pathname :: A pointer to an 8-bit file pathname. */
1798 /* stream :: A handle to a source stream object. */
1800 /* driver :: This field is exclusively used by @FT_Open_Face; */
1801 /* it simply specifies the font driver to use to open */
1802 /* the face. If set to~0, FreeType tries to load the */
1803 /* face with each one of the drivers in its list. */
1805 /* num_params :: The number of extra parameters. */
1807 /* params :: Extra parameters passed to the font driver when */
1808 /* opening a new face. */
1811 /* The stream type is determined by the contents of `flags' which */
1812 /* are tested in the following order by @FT_Open_Face: */
1814 /* If the `FT_OPEN_MEMORY' bit is set, assume that this is a */
1815 /* memory file of `memory_size' bytes, located at `memory_address'. */
1816 /* The data are are not copied, and the client is responsible for */
1817 /* releasing and destroying them _after_ the corresponding call to */
1818 /* @FT_Done_Face. */
1820 /* Otherwise, if the `FT_OPEN_STREAM' bit is set, assume that a */
1821 /* custom input stream `stream' is used. */
1823 /* Otherwise, if the `FT_OPEN_PATHNAME' bit is set, assume that this */
1824 /* is a normal file and use `pathname' to open it. */
1826 /* If the `FT_OPEN_DRIVER' bit is set, @FT_Open_Face only tries to */
1827 /* open the file with the driver whose handler is in `driver'. */
1829 /* If the `FT_OPEN_PARAMS' bit is set, the parameters given by */
1830 /* `num_params' and `params' is used. They are ignored otherwise. */
1832 /* Ideally, both the `pathname' and `params' fields should be tagged */
1833 /* as `const'; this is missing for API backwards compatibility. In */
1834 /* other words, applications should treat them as read-only. */
1836 typedef struct FT_Open_Args_
1839 const FT_Byte* memory_base;
1840 FT_Long memory_size;
1841 FT_String* pathname;
1845 FT_Parameter* params;
1850 /*************************************************************************/
1856 /* This function calls @FT_Open_Face to open a font by its pathname. */
1859 /* library :: A handle to the library resource. */
1862 /* pathname :: A path to the font file. */
1864 /* face_index :: The index of the face within the font. The first */
1865 /* face has index~0. */
1868 /* aface :: A handle to a new face object. If `face_index' is */
1869 /* greater than or equal to zero, it must be non-NULL. */
1870 /* See @FT_Open_Face for more details. */
1873 /* FreeType error code. 0~means success. */
1875 FT_EXPORT( FT_Error )
1876 FT_New_Face( FT_Library library,
1877 const char* filepathname,
1882 /*************************************************************************/
1885 /* FT_New_Memory_Face */
1888 /* This function calls @FT_Open_Face to open a font which has been */
1889 /* loaded into memory. */
1892 /* library :: A handle to the library resource. */
1895 /* file_base :: A pointer to the beginning of the font data. */
1897 /* file_size :: The size of the memory chunk used by the font data. */
1899 /* face_index :: The index of the face within the font. The first */
1900 /* face has index~0. */
1903 /* aface :: A handle to a new face object. If `face_index' is */
1904 /* greater than or equal to zero, it must be non-NULL. */
1905 /* See @FT_Open_Face for more details. */
1908 /* FreeType error code. 0~means success. */
1911 /* You must not deallocate the memory before calling @FT_Done_Face. */
1913 FT_EXPORT( FT_Error )
1914 FT_New_Memory_Face( FT_Library library,
1915 const FT_Byte* file_base,
1921 /*************************************************************************/
1927 /* Create a face object from a given resource described by */
1928 /* @FT_Open_Args. */
1931 /* library :: A handle to the library resource. */
1934 /* args :: A pointer to an `FT_Open_Args' structure which must */
1935 /* be filled by the caller. */
1937 /* face_index :: The index of the face within the font. The first */
1938 /* face has index~0. */
1941 /* aface :: A handle to a new face object. If `face_index' is */
1942 /* greater than or equal to zero, it must be non-NULL. */
1943 /* See note below. */
1946 /* FreeType error code. 0~means success. */
1949 /* Unlike FreeType 1.x, this function automatically creates a glyph */
1950 /* slot for the face object which can be accessed directly through */
1951 /* `face->glyph'. */
1953 /* FT_Open_Face can be used to quickly check whether the font */
1954 /* format of a given font resource is supported by FreeType. If the */
1955 /* `face_index' field is negative, the function's return value is~0 */
1956 /* if the font format is recognized, or non-zero otherwise; */
1957 /* the function returns a more or less empty face handle in `*aface' */
1958 /* (if `aface' isn't NULL). The only useful field in this special */
1959 /* case is `face->num_faces' which gives the number of faces within */
1960 /* the font file. After examination, the returned @FT_Face structure */
1961 /* should be deallocated with a call to @FT_Done_Face. */
1963 /* Each new face object created with this function also owns a */
1964 /* default @FT_Size object, accessible as `face->size'. */
1966 /* One @FT_Library instance can have multiple face objects, this is, */
1967 /* @FT_Open_Face and its siblings can be called multiple times using */
1968 /* the same `library' argument. */
1970 /* See the discussion of reference counters in the description of */
1971 /* @FT_Reference_Face. */
1973 FT_EXPORT( FT_Error )
1974 FT_Open_Face( FT_Library library,
1975 const FT_Open_Args* args,
1980 /*************************************************************************/
1983 /* FT_Attach_File */
1986 /* This function calls @FT_Attach_Stream to attach a file. */
1989 /* face :: The target face object. */
1992 /* filepathname :: The pathname. */
1995 /* FreeType error code. 0~means success. */
1997 FT_EXPORT( FT_Error )
1998 FT_Attach_File( FT_Face face,
1999 const char* filepathname );
2002 /*************************************************************************/
2005 /* FT_Attach_Stream */
2008 /* `Attach' data to a face object. Normally, this is used to read */
2009 /* additional information for the face object. For example, you can */
2010 /* attach an AFM file that comes with a Type~1 font to get the */
2011 /* kerning values and other metrics. */
2014 /* face :: The target face object. */
2017 /* parameters :: A pointer to @FT_Open_Args which must be filled by */
2021 /* FreeType error code. 0~means success. */
2024 /* The meaning of the `attach' (i.e., what really happens when the */
2025 /* new file is read) is not fixed by FreeType itself. It really */
2026 /* depends on the font format (and thus the font driver). */
2028 /* Client applications are expected to know what they are doing */
2029 /* when invoking this function. Most drivers simply do not implement */
2030 /* file attachments. */
2032 FT_EXPORT( FT_Error )
2033 FT_Attach_Stream( FT_Face face,
2034 FT_Open_Args* parameters );
2037 /*************************************************************************/
2040 /* FT_Reference_Face */
2043 /* A counter gets initialized to~1 at the time an @FT_Face structure */
2044 /* is created. This function increments the counter. @FT_Done_Face */
2045 /* then only destroys a face if the counter is~1, otherwise it simply */
2046 /* decrements the counter. */
2048 /* This function helps in managing life-cycles of structures which */
2049 /* reference @FT_Face objects. */
2052 /* face :: A handle to a target face object. */
2055 /* FreeType error code. 0~means success. */
2060 FT_EXPORT( FT_Error )
2061 FT_Reference_Face( FT_Face face );
2064 /*************************************************************************/
2070 /* Discard a given face object, as well as all of its child slots and */
2074 /* face :: A handle to a target face object. */
2077 /* FreeType error code. 0~means success. */
2080 /* See the discussion of reference counters in the description of */
2081 /* @FT_Reference_Face. */
2083 FT_EXPORT( FT_Error )
2084 FT_Done_Face( FT_Face face );
2087 /*************************************************************************/
2090 /* FT_Select_Size */
2093 /* Select a bitmap strike. */
2096 /* face :: A handle to a target face object. */
2099 /* strike_index :: The index of the bitmap strike in the */
2100 /* `available_sizes' field of @FT_FaceRec structure. */
2103 /* FreeType error code. 0~means success. */
2105 FT_EXPORT( FT_Error )
2106 FT_Select_Size( FT_Face face,
2107 FT_Int strike_index );
2110 /*************************************************************************/
2113 /* FT_Size_Request_Type */
2116 /* An enumeration type that lists the supported size request types. */
2119 /* FT_SIZE_REQUEST_TYPE_NOMINAL :: */
2120 /* The nominal size. The `units_per_EM' field of @FT_FaceRec is */
2121 /* used to determine both scaling values. */
2123 /* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */
2124 /* The real dimension. The sum of the the `ascender' and (minus */
2125 /* of) the `descender' fields of @FT_FaceRec are used to determine */
2126 /* both scaling values. */
2128 /* FT_SIZE_REQUEST_TYPE_BBOX :: */
2129 /* The font bounding box. The width and height of the `bbox' field */
2130 /* of @FT_FaceRec are used to determine the horizontal and vertical */
2131 /* scaling value, respectively. */
2133 /* FT_SIZE_REQUEST_TYPE_CELL :: */
2134 /* The `max_advance_width' field of @FT_FaceRec is used to */
2135 /* determine the horizontal scaling value; the vertical scaling */
2136 /* value is determined the same way as */
2137 /* @FT_SIZE_REQUEST_TYPE_REAL_DIM does. Finally, both scaling */
2138 /* values are set to the smaller one. This type is useful if you */
2139 /* want to specify the font size for, say, a window of a given */
2140 /* dimension and 80x24 cells. */
2142 /* FT_SIZE_REQUEST_TYPE_SCALES :: */
2143 /* Specify the scaling values directly. */
2146 /* The above descriptions only apply to scalable formats. For bitmap */
2147 /* formats, the behaviour is up to the driver. */
2149 /* See the note section of @FT_Size_Metrics if you wonder how size */
2150 /* requesting relates to scaling values. */
2152 typedef enum FT_Size_Request_Type_
2154 FT_SIZE_REQUEST_TYPE_NOMINAL,
2155 FT_SIZE_REQUEST_TYPE_REAL_DIM,
2156 FT_SIZE_REQUEST_TYPE_BBOX,
2157 FT_SIZE_REQUEST_TYPE_CELL,
2158 FT_SIZE_REQUEST_TYPE_SCALES,
2160 FT_SIZE_REQUEST_TYPE_MAX
2162 } FT_Size_Request_Type;
2165 /*************************************************************************/
2168 /* FT_Size_RequestRec */
2171 /* A structure used to model a size request. */
2174 /* type :: See @FT_Size_Request_Type. */
2176 /* width :: The desired width. */
2178 /* height :: The desired height. */
2180 /* horiResolution :: The horizontal resolution. If set to zero, */
2181 /* `width' is treated as a 26.6 fractional pixel */
2184 /* vertResolution :: The vertical resolution. If set to zero, */
2185 /* `height' is treated as a 26.6 fractional pixel */
2189 /* If `width' is zero, then the horizontal scaling value is set equal */
2190 /* to the vertical scaling value, and vice versa. */
2192 typedef struct FT_Size_RequestRec_
2194 FT_Size_Request_Type type;
2197 FT_UInt horiResolution;
2198 FT_UInt vertResolution;
2200 } FT_Size_RequestRec;
2203 /*************************************************************************/
2206 /* FT_Size_Request */
2209 /* A handle to a size request structure. */
2211 typedef struct FT_Size_RequestRec_ *FT_Size_Request;
2214 /*************************************************************************/
2217 /* FT_Request_Size */
2220 /* Resize the scale of the active @FT_Size object in a face. */
2223 /* face :: A handle to a target face object. */
2226 /* req :: A pointer to a @FT_Size_RequestRec. */
2229 /* FreeType error code. 0~means success. */
2232 /* Although drivers may select the bitmap strike matching the */
2233 /* request, you should not rely on this if you intend to select a */
2234 /* particular bitmap strike. Use @FT_Select_Size instead in that */
2237 /* The relation between the requested size and the resulting glyph */
2238 /* size is dependent entirely on how the size is defined in the */
2239 /* source face. The font designer chooses the final size of each */
2240 /* glyph relative to this size. For more information refer to */
2241 /* `http://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html' */
2243 FT_EXPORT( FT_Error )
2244 FT_Request_Size( FT_Face face,
2245 FT_Size_Request req );
2248 /*************************************************************************/
2251 /* FT_Set_Char_Size */
2254 /* This function calls @FT_Request_Size to request the nominal size */
2258 /* face :: A handle to a target face object. */
2261 /* char_width :: The nominal width, in 26.6 fractional points. */
2263 /* char_height :: The nominal height, in 26.6 fractional points. */
2265 /* horz_resolution :: The horizontal resolution in dpi. */
2267 /* vert_resolution :: The vertical resolution in dpi. */
2270 /* FreeType error code. 0~means success. */
2273 /* If either the character width or height is zero, it is set equal */
2274 /* to the other value. */
2276 /* If either the horizontal or vertical resolution is zero, it is set */
2277 /* equal to the other value. */
2279 /* A character width or height smaller than 1pt is set to 1pt; if */
2280 /* both resolution values are zero, they are set to 72dpi. */
2282 /* Don't use this function if you are using the FreeType cache API. */
2284 FT_EXPORT( FT_Error )
2285 FT_Set_Char_Size( FT_Face face,
2286 FT_F26Dot6 char_width,
2287 FT_F26Dot6 char_height,
2288 FT_UInt horz_resolution,
2289 FT_UInt vert_resolution );
2292 /*************************************************************************/
2295 /* FT_Set_Pixel_Sizes */
2298 /* This function calls @FT_Request_Size to request the nominal size */
2302 /* face :: A handle to the target face object. */
2305 /* pixel_width :: The nominal width, in pixels. */
2307 /* pixel_height :: The nominal height, in pixels. */
2310 /* FreeType error code. 0~means success. */
2313 /* You should not rely on the resulting glyphs matching, or being */
2314 /* constrained, to this pixel size. Refer to @FT_Request_Size to */
2315 /* understand how requested sizes relate to actual sizes. */
2317 FT_EXPORT( FT_Error )
2318 FT_Set_Pixel_Sizes( FT_Face face,
2319 FT_UInt pixel_width,
2320 FT_UInt pixel_height );
2323 /*************************************************************************/
2329 /* A function used to load a single glyph into the glyph slot of a */
2333 /* face :: A handle to the target face object where the glyph */
2337 /* glyph_index :: The index of the glyph in the font file. For */
2338 /* CID-keyed fonts (either in PS or in CFF format) */
2339 /* this argument specifies the CID value. */
2341 /* load_flags :: A flag indicating what to load for this glyph. The */
2342 /* @FT_LOAD_XXX constants can be used to control the */
2343 /* glyph loading process (e.g., whether the outline */
2344 /* should be scaled, whether to load bitmaps or not, */
2345 /* whether to hint the outline, etc). */
2348 /* FreeType error code. 0~means success. */
2351 /* The loaded glyph may be transformed. See @FT_Set_Transform for */
2354 /* For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is */
2355 /* returned for invalid CID values (this is, for CID values which */
2356 /* don't have a corresponding glyph in the font). See the discussion */
2357 /* of the @FT_FACE_FLAG_CID_KEYED flag for more details. */
2359 FT_EXPORT( FT_Error )
2360 FT_Load_Glyph( FT_Face face,
2361 FT_UInt glyph_index,
2362 FT_Int32 load_flags );
2365 /*************************************************************************/
2371 /* A function used to load a single glyph into the glyph slot of a */
2372 /* face object, according to its character code. */
2375 /* face :: A handle to a target face object where the glyph */
2379 /* char_code :: The glyph's character code, according to the */
2380 /* current charmap used in the face. */
2382 /* load_flags :: A flag indicating what to load for this glyph. The */
2383 /* @FT_LOAD_XXX constants can be used to control the */
2384 /* glyph loading process (e.g., whether the outline */
2385 /* should be scaled, whether to load bitmaps or not, */
2386 /* whether to hint the outline, etc). */
2389 /* FreeType error code. 0~means success. */
2392 /* This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph. */
2394 FT_EXPORT( FT_Error )
2395 FT_Load_Char( FT_Face face,
2397 FT_Int32 load_flags );
2400 /*************************************************************************
2406 * A list of bit-field constants used with @FT_Load_Glyph to indicate
2407 * what kind of operations to perform during glyph loading.
2410 * FT_LOAD_DEFAULT ::
2411 * Corresponding to~0, this value is used as the default glyph load
2412 * operation. In this case, the following happens:
2414 * 1. FreeType looks for a bitmap for the glyph corresponding to the
2415 * face's current size. If one is found, the function returns.
2416 * The bitmap data can be accessed from the glyph slot (see note
2419 * 2. If no embedded bitmap is searched or found, FreeType looks for a
2420 * scalable outline. If one is found, it is loaded from the font
2421 * file, scaled to device pixels, then `hinted' to the pixel grid
2422 * in order to optimize it. The outline data can be accessed from
2423 * the glyph slot (see note below).
2425 * Note that by default, the glyph loader doesn't render outlines into
2426 * bitmaps. The following flags are used to modify this default
2427 * behaviour to more specific and useful cases.
2429 * FT_LOAD_NO_SCALE ::
2430 * Don't scale the loaded outline glyph but keep it in font units.
2432 * This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and
2433 * unsets @FT_LOAD_RENDER.
2435 * If the font is `tricky' (see @FT_FACE_FLAG_TRICKY for more), using
2436 * FT_LOAD_NO_SCALE usually yields meaningless outlines because the
2437 * subglyphs must be scaled and positioned with hinting instructions.
2438 * This can be solved by loading the font without FT_LOAD_NO_SCALE and
2439 * setting the character size to `font->units_per_EM'.
2441 * FT_LOAD_NO_HINTING ::
2442 * Disable hinting. This generally generates `blurrier' bitmap glyphs
2443 * when the glyph are rendered in any of the anti-aliased modes. See
2444 * also the note below.
2446 * This flag is implied by @FT_LOAD_NO_SCALE.
2449 * Call @FT_Render_Glyph after the glyph is loaded. By default, the
2450 * glyph is rendered in @FT_RENDER_MODE_NORMAL mode. This can be
2451 * overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME.
2453 * This flag is unset by @FT_LOAD_NO_SCALE.
2455 * FT_LOAD_NO_BITMAP ::
2456 * Ignore bitmap strikes when loading. Bitmap-only fonts ignore this
2459 * @FT_LOAD_NO_SCALE always sets this flag.
2461 * FT_LOAD_VERTICAL_LAYOUT ::
2462 * Load the glyph for vertical text layout. In particular, the
2463 * `advance' value in the @FT_GlyphSlotRec structure is set to the
2464 * `vertAdvance' value of the `metrics' field.
2466 * In case @FT_HAS_VERTICAL doesn't return true, you shouldn't use
2467 * this flag currently. Reason is that in this case vertical metrics
2468 * get synthesized, and those values are not always consistent across
2469 * various font formats.
2471 * FT_LOAD_FORCE_AUTOHINT ::
2472 * Indicates that the auto-hinter is preferred over the font's native
2473 * hinter. See also the note below.
2475 * FT_LOAD_CROP_BITMAP ::
2476 * Indicates that the font driver should crop the loaded bitmap glyph
2477 * (i.e., remove all space around its black bits). Not all drivers
2480 * FT_LOAD_PEDANTIC ::
2481 * Indicates that the font driver should perform pedantic verifications
2482 * during glyph loading. This is mostly used to detect broken glyphs
2483 * in fonts. By default, FreeType tries to handle broken fonts also.
2485 * In particular, errors from the TrueType bytecode engine are not
2486 * passed to the application if this flag is not set; this might
2487 * result in partially hinted or distorted glyphs in case a glyph's
2488 * bytecode is buggy.
2490 * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ::
2491 * Ignored. Deprecated.
2493 * FT_LOAD_NO_RECURSE ::
2494 * This flag is only used internally. It merely indicates that the
2495 * font driver should not load composite glyphs recursively. Instead,
2496 * it should set the `num_subglyph' and `subglyphs' values of the
2497 * glyph slot accordingly, and set `glyph->format' to
2498 * @FT_GLYPH_FORMAT_COMPOSITE.
2500 * The description of sub-glyphs is not available to client
2501 * applications for now.
2503 * This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM.
2505 * FT_LOAD_IGNORE_TRANSFORM ::
2506 * Indicates that the transform matrix set by @FT_Set_Transform should
2509 * FT_LOAD_MONOCHROME ::
2510 * This flag is used with @FT_LOAD_RENDER to indicate that you want to
2511 * render an outline glyph to a 1-bit monochrome bitmap glyph, with
2512 * 8~pixels packed into each byte of the bitmap data.
2514 * Note that this has no effect on the hinting algorithm used. You
2515 * should rather use @FT_LOAD_TARGET_MONO so that the
2516 * monochrome-optimized hinting algorithm is used.
2518 * FT_LOAD_LINEAR_DESIGN ::
2519 * Indicates that the `linearHoriAdvance' and `linearVertAdvance'
2520 * fields of @FT_GlyphSlotRec should be kept in font units. See
2521 * @FT_GlyphSlotRec for details.
2523 * FT_LOAD_NO_AUTOHINT ::
2524 * Disable auto-hinter. See also the note below.
2527 * By default, hinting is enabled and the font's native hinter (see
2528 * @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can
2529 * disable hinting by setting @FT_LOAD_NO_HINTING or change the
2530 * precedence by setting @FT_LOAD_FORCE_AUTOHINT. You can also set
2531 * @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be
2534 * See the description of @FT_FACE_FLAG_TRICKY for a special exception
2535 * (affecting only a handful of Asian fonts).
2537 * Besides deciding which hinter to use, you can also decide which
2538 * hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details.
2540 * Note that the auto-hinter needs a valid Unicode cmap (either a native
2541 * one or synthesized by FreeType) for producing correct results. If a
2542 * font provides an incorrect mapping (for example, assigning the
2543 * character code U+005A, LATIN CAPITAL LETTER Z, to a glyph depicting a
2544 * mathematical integral sign), the auto-hinter might produce useless
2548 #define FT_LOAD_DEFAULT 0x0
2549 #define FT_LOAD_NO_SCALE ( 1L << 0 )
2550 #define FT_LOAD_NO_HINTING ( 1L << 1 )
2551 #define FT_LOAD_RENDER ( 1L << 2 )
2552 #define FT_LOAD_NO_BITMAP ( 1L << 3 )
2553 #define FT_LOAD_VERTICAL_LAYOUT ( 1L << 4 )
2554 #define FT_LOAD_FORCE_AUTOHINT ( 1L << 5 )
2555 #define FT_LOAD_CROP_BITMAP ( 1L << 6 )
2556 #define FT_LOAD_PEDANTIC ( 1L << 7 )
2557 #define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ( 1L << 9 )
2558 #define FT_LOAD_NO_RECURSE ( 1L << 10 )
2559 #define FT_LOAD_IGNORE_TRANSFORM ( 1L << 11 )
2560 #define FT_LOAD_MONOCHROME ( 1L << 12 )
2561 #define FT_LOAD_LINEAR_DESIGN ( 1L << 13 )
2562 #define FT_LOAD_NO_AUTOHINT ( 1L << 15 )
2566 /* used internally only by certain font drivers! */
2567 #define FT_LOAD_ADVANCE_ONLY ( 1L << 8 )
2568 #define FT_LOAD_SBITS_ONLY ( 1L << 14 )
2571 /**************************************************************************
2574 * FT_LOAD_TARGET_XXX
2577 * A list of values that are used to select a specific hinting algorithm
2578 * to use by the hinter. You should OR one of these values to your
2579 * `load_flags' when calling @FT_Load_Glyph.
2581 * Note that font's native hinters may ignore the hinting algorithm you
2582 * have specified (e.g., the TrueType bytecode interpreter). You can set
2583 * @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used.
2585 * Also note that @FT_LOAD_TARGET_LIGHT is an exception, in that it
2586 * always implies @FT_LOAD_FORCE_AUTOHINT.
2589 * FT_LOAD_TARGET_NORMAL ::
2590 * This corresponds to the default hinting algorithm, optimized for
2591 * standard gray-level rendering. For monochrome output, use
2592 * @FT_LOAD_TARGET_MONO instead.
2594 * FT_LOAD_TARGET_LIGHT ::
2595 * A lighter hinting algorithm for non-monochrome modes. Many
2596 * generated glyphs are more fuzzy but better resemble its original
2597 * shape. A bit like rendering on Mac OS~X.
2599 * As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT.
2601 * FT_LOAD_TARGET_MONO ::
2602 * Strong hinting algorithm that should only be used for monochrome
2603 * output. The result is probably unpleasant if the glyph is rendered
2604 * in non-monochrome modes.
2606 * FT_LOAD_TARGET_LCD ::
2607 * A variant of @FT_LOAD_TARGET_NORMAL optimized for horizontally
2608 * decimated LCD displays.
2610 * FT_LOAD_TARGET_LCD_V ::
2611 * A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically
2612 * decimated LCD displays.
2615 * You should use only _one_ of the FT_LOAD_TARGET_XXX values in your
2616 * `load_flags'. They can't be ORed.
2618 * If @FT_LOAD_RENDER is also set, the glyph is rendered in the
2619 * corresponding mode (i.e., the mode which matches the used algorithm
2620 * best). An exeption is FT_LOAD_TARGET_MONO since it implies
2621 * @FT_LOAD_MONOCHROME.
2623 * You can use a hinting algorithm that doesn't correspond to the same
2624 * rendering mode. As an example, it is possible to use the `light'
2625 * hinting algorithm and have the results rendered in horizontal LCD
2626 * pixel mode, with code like
2629 * FT_Load_Glyph( face, glyph_index,
2630 * load_flags | FT_LOAD_TARGET_LIGHT );
2632 * FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD );
2636 #define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 )
2638 #define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
2639 #define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT )
2640 #define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO )
2641 #define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
2642 #define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
2645 /**************************************************************************
2648 * FT_LOAD_TARGET_MODE
2651 * Return the @FT_Render_Mode corresponding to a given
2652 * @FT_LOAD_TARGET_XXX value.
2655 #define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
2658 /*************************************************************************/
2661 /* FT_Set_Transform */
2664 /* A function used to set the transformation that is applied to glyph */
2665 /* images when they are loaded into a glyph slot through */
2666 /* @FT_Load_Glyph. */
2669 /* face :: A handle to the source face object. */
2672 /* matrix :: A pointer to the transformation's 2x2 matrix. Use~0 for */
2673 /* the identity matrix. */
2674 /* delta :: A pointer to the translation vector. Use~0 for the null */
2678 /* The transformation is only applied to scalable image formats after */
2679 /* the glyph has been loaded. It means that hinting is unaltered by */
2680 /* the transformation and is performed on the character size given in */
2681 /* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */
2683 /* Note that this also transforms the `face.glyph.advance' field, but */
2684 /* *not* the values in `face.glyph.metrics'. */
2687 FT_Set_Transform( FT_Face face,
2692 /*************************************************************************/
2695 /* FT_Render_Mode */
2698 /* An enumeration type that lists the render modes supported by */
2699 /* FreeType~2. Each mode corresponds to a specific type of scanline */
2700 /* conversion performed on the outline. */
2702 /* For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode' */
2703 /* field in the @FT_GlyphSlotRec structure gives the format of the */
2704 /* returned bitmap. */
2706 /* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity. */
2709 /* FT_RENDER_MODE_NORMAL :: */
2710 /* This is the default render mode; it corresponds to 8-bit */
2711 /* anti-aliased bitmaps. */
2713 /* FT_RENDER_MODE_LIGHT :: */
2714 /* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */
2715 /* defined as a separate value because render modes are also used */
2716 /* indirectly to define hinting algorithm selectors. See */
2717 /* @FT_LOAD_TARGET_XXX for details. */
2719 /* FT_RENDER_MODE_MONO :: */
2720 /* This mode corresponds to 1-bit bitmaps (with 2~levels of */
2723 /* FT_RENDER_MODE_LCD :: */
2724 /* This mode corresponds to horizontal RGB and BGR sub-pixel */
2725 /* displays like LCD screens. It produces 8-bit bitmaps that are */
2726 /* 3~times the width of the original glyph outline in pixels, and */
2727 /* which use the @FT_PIXEL_MODE_LCD mode. */
2729 /* FT_RENDER_MODE_LCD_V :: */
2730 /* This mode corresponds to vertical RGB and BGR sub-pixel displays */
2731 /* (like PDA screens, rotated LCD displays, etc.). It produces */
2732 /* 8-bit bitmaps that are 3~times the height of the original */
2733 /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */
2736 /* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph can be */
2737 /* filtered to reduce color-fringes by using @FT_Library_SetLcdFilter */
2738 /* (not active in the default builds). It is up to the caller to */
2739 /* either call @FT_Library_SetLcdFilter (if available) or do the */
2740 /* filtering itself. */
2742 /* The selected render mode only affects vector glyphs of a font. */
2743 /* Embedded bitmaps often have a different pixel mode like */
2744 /* @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform */
2745 /* them into 8-bit pixmaps. */
2747 typedef enum FT_Render_Mode_
2749 FT_RENDER_MODE_NORMAL = 0,
2750 FT_RENDER_MODE_LIGHT,
2751 FT_RENDER_MODE_MONO,
2753 FT_RENDER_MODE_LCD_V,
2760 /*************************************************************************/
2763 /* ft_render_mode_xxx */
2766 /* These constants are deprecated. Use the corresponding */
2767 /* @FT_Render_Mode values instead. */
2770 /* ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL */
2771 /* ft_render_mode_mono :: see @FT_RENDER_MODE_MONO */
2773 #define ft_render_mode_normal FT_RENDER_MODE_NORMAL
2774 #define ft_render_mode_mono FT_RENDER_MODE_MONO
2777 /*************************************************************************/
2780 /* FT_Render_Glyph */
2783 /* Convert a given glyph image to a bitmap. It does so by inspecting */
2784 /* the glyph image format, finding the relevant renderer, and */
2788 /* slot :: A handle to the glyph slot containing the image to */
2792 /* render_mode :: This is the render mode used to render the glyph */
2793 /* image into a bitmap. See @FT_Render_Mode for a */
2794 /* list of possible values. */
2797 /* FreeType error code. 0~means success. */
2799 FT_EXPORT( FT_Error )
2800 FT_Render_Glyph( FT_GlyphSlot slot,
2801 FT_Render_Mode render_mode );
2804 /*************************************************************************/
2807 /* FT_Kerning_Mode */
2810 /* An enumeration used to specify which kerning values to return in */
2811 /* @FT_Get_Kerning. */
2814 /* FT_KERNING_DEFAULT :: Return scaled and grid-fitted kerning */
2815 /* distances (value is~0). */
2817 /* FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning */
2820 /* FT_KERNING_UNSCALED :: Return the kerning vector in original font */
2823 typedef enum FT_Kerning_Mode_
2825 FT_KERNING_DEFAULT = 0,
2826 FT_KERNING_UNFITTED,
2832 /*************************************************************************/
2835 /* ft_kerning_default */
2838 /* This constant is deprecated. Please use @FT_KERNING_DEFAULT */
2841 #define ft_kerning_default FT_KERNING_DEFAULT
2844 /*************************************************************************/
2847 /* ft_kerning_unfitted */
2850 /* This constant is deprecated. Please use @FT_KERNING_UNFITTED */
2853 #define ft_kerning_unfitted FT_KERNING_UNFITTED
2856 /*************************************************************************/
2859 /* ft_kerning_unscaled */
2862 /* This constant is deprecated. Please use @FT_KERNING_UNSCALED */
2865 #define ft_kerning_unscaled FT_KERNING_UNSCALED
2868 /*************************************************************************/
2871 /* FT_Get_Kerning */
2874 /* Return the kerning vector between two glyphs of a same face. */
2877 /* face :: A handle to a source face object. */
2879 /* left_glyph :: The index of the left glyph in the kern pair. */
2881 /* right_glyph :: The index of the right glyph in the kern pair. */
2883 /* kern_mode :: See @FT_Kerning_Mode for more information. */
2884 /* Determines the scale and dimension of the returned */
2885 /* kerning vector. */
2888 /* akerning :: The kerning vector. This is either in font units */
2889 /* or in pixels (26.6 format) for scalable formats, */
2890 /* and in pixels for fixed-sizes formats. */
2893 /* FreeType error code. 0~means success. */
2896 /* Only horizontal layouts (left-to-right & right-to-left) are */
2897 /* supported by this method. Other layouts, or more sophisticated */
2898 /* kernings, are out of the scope of this API function -- they can be */
2899 /* implemented through format-specific interfaces. */
2901 FT_EXPORT( FT_Error )
2902 FT_Get_Kerning( FT_Face face,
2904 FT_UInt right_glyph,
2906 FT_Vector *akerning );
2909 /*************************************************************************/
2912 /* FT_Get_Track_Kerning */
2915 /* Return the track kerning for a given face object at a given size. */
2918 /* face :: A handle to a source face object. */
2920 /* point_size :: The point size in 16.16 fractional points. */
2922 /* degree :: The degree of tightness. Increasingly negative */
2923 /* values represent tighter track kerning, while */
2924 /* increasingly positive values represent looser track */
2925 /* kerning. Value zero means no track kerning. */
2928 /* akerning :: The kerning in 16.16 fractional points, to be */
2929 /* uniformly applied between all glyphs. */
2932 /* FreeType error code. 0~means success. */
2935 /* Currently, only the Type~1 font driver supports track kerning, */
2936 /* using data from AFM files (if attached with @FT_Attach_File or */
2937 /* @FT_Attach_Stream). */
2939 /* Only very few AFM files come with track kerning data; please refer */
2940 /* to the Adobe's AFM specification for more details. */
2942 FT_EXPORT( FT_Error )
2943 FT_Get_Track_Kerning( FT_Face face,
2944 FT_Fixed point_size,
2946 FT_Fixed* akerning );
2949 /*************************************************************************/
2952 /* FT_Get_Glyph_Name */
2955 /* Retrieve the ASCII name of a given glyph in a face. This only */
2956 /* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1. */
2959 /* face :: A handle to a source face object. */
2961 /* glyph_index :: The glyph index. */
2963 /* buffer_max :: The maximum number of bytes available in the */
2967 /* buffer :: A pointer to a target buffer where the name is */
2971 /* FreeType error code. 0~means success. */
2974 /* An error is returned if the face doesn't provide glyph names or if */
2975 /* the glyph index is invalid. In all cases of failure, the first */
2976 /* byte of `buffer' is set to~0 to indicate an empty name. */
2978 /* The glyph name is truncated to fit within the buffer if it is too */
2979 /* long. The returned string is always zero-terminated. */
2981 /* Be aware that FreeType reorders glyph indices internally so that */
2982 /* glyph index~0 always corresponds to the `missing glyph' (called */
2985 /* This function is not compiled within the library if the config */
2986 /* macro `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is defined in */
2987 /* `include/freetype/config/ftoptions.h'. */
2989 FT_EXPORT( FT_Error )
2990 FT_Get_Glyph_Name( FT_Face face,
2991 FT_UInt glyph_index,
2993 FT_UInt buffer_max );
2996 /*************************************************************************/
2999 /* FT_Get_Postscript_Name */
3002 /* Retrieve the ASCII PostScript name of a given face, if available. */
3003 /* This only works with PostScript and TrueType fonts. */
3006 /* face :: A handle to the source face object. */
3009 /* A pointer to the face's PostScript name. NULL if unavailable. */
3012 /* The returned pointer is owned by the face and is destroyed with */
3015 FT_EXPORT( const char* )
3016 FT_Get_Postscript_Name( FT_Face face );
3019 /*************************************************************************/
3022 /* FT_Select_Charmap */
3025 /* Select a given charmap by its encoding tag (as listed in */
3026 /* `freetype.h'). */
3029 /* face :: A handle to the source face object. */
3032 /* encoding :: A handle to the selected encoding. */
3035 /* FreeType error code. 0~means success. */
3038 /* This function returns an error if no charmap in the face */
3039 /* corresponds to the encoding queried here. */
3041 /* Because many fonts contain more than a single cmap for Unicode */
3042 /* encoding, this function has some special code to select the one */
3043 /* which covers Unicode best (`best' in the sense that a UCS-4 cmap */
3044 /* is preferred to a UCS-2 cmap). It is thus preferable to */
3045 /* @FT_Set_Charmap in this case. */
3047 FT_EXPORT( FT_Error )
3048 FT_Select_Charmap( FT_Face face,
3049 FT_Encoding encoding );
3052 /*************************************************************************/
3055 /* FT_Set_Charmap */
3058 /* Select a given charmap for character code to glyph index mapping. */
3061 /* face :: A handle to the source face object. */
3064 /* charmap :: A handle to the selected charmap. */
3067 /* FreeType error code. 0~means success. */
3070 /* This function returns an error if the charmap is not part of */
3071 /* the face (i.e., if it is not listed in the `face->charmaps' */
3074 /* It also fails if a type~14 charmap is selected. */
3076 FT_EXPORT( FT_Error )
3077 FT_Set_Charmap( FT_Face face,
3078 FT_CharMap charmap );
3081 /*************************************************************************
3084 * FT_Get_Charmap_Index
3087 * Retrieve index of a given charmap.
3091 * A handle to a charmap.
3094 * The index into the array of character maps within the face to which
3095 * `charmap' belongs. If an error occurs, -1 is returned.
3099 FT_Get_Charmap_Index( FT_CharMap charmap );
3102 /*************************************************************************/
3105 /* FT_Get_Char_Index */
3108 /* Return the glyph index of a given character code. This function */
3109 /* uses a charmap object to do the mapping. */
3112 /* face :: A handle to the source face object. */
3114 /* charcode :: The character code. */
3117 /* The glyph index. 0~means `undefined character code'. */
3120 /* If you use FreeType to manipulate the contents of font files */
3121 /* directly, be aware that the glyph index returned by this function */
3122 /* doesn't always correspond to the internal indices used within the */
3123 /* file. This is done to ensure that value~0 always corresponds to */
3124 /* the `missing glyph'. If the first glyph is not named `.notdef', */
3125 /* then for Type~1 and Type~42 fonts, `.notdef' will be moved into */
3126 /* the glyph ID~0 position, and whatever was there will be moved to */
3127 /* the position `.notdef' had. For Type~1 fonts, if there is no */
3128 /* `.notdef' glyph at all, then one will be created at index~0 and */
3129 /* whatever was there will be moved to the last index -- Type~42 */
3130 /* fonts are considered invalid under this condition. */
3132 FT_EXPORT( FT_UInt )
3133 FT_Get_Char_Index( FT_Face face,
3134 FT_ULong charcode );
3137 /*************************************************************************/
3140 /* FT_Get_First_Char */
3143 /* This function is used to return the first character code in the */
3144 /* current charmap of a given face. It also returns the */
3145 /* corresponding glyph index. */
3148 /* face :: A handle to the source face object. */
3151 /* agindex :: Glyph index of first character code. 0~if charmap is */
3155 /* The charmap's first character code. */
3158 /* You should use this function with @FT_Get_Next_Char to be able to */
3159 /* parse all character codes available in a given charmap. The code */
3160 /* should look like this: */
3163 /* FT_ULong charcode; */
3164 /* FT_UInt gindex; */
3167 /* charcode = FT_Get_First_Char( face, &gindex ); */
3168 /* while ( gindex != 0 ) */
3170 /* ... do something with (charcode,gindex) pair ... */
3172 /* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */
3176 /* Note that `*agindex' is set to~0 if the charmap is empty. The */
3177 /* result itself can be~0 in two cases: if the charmap is empty or */
3178 /* if the value~0 is the first valid character code. */
3180 FT_EXPORT( FT_ULong )
3181 FT_Get_First_Char( FT_Face face,
3185 /*************************************************************************/
3188 /* FT_Get_Next_Char */
3191 /* This function is used to return the next character code in the */
3192 /* current charmap of a given face following the value `char_code', */
3193 /* as well as the corresponding glyph index. */
3196 /* face :: A handle to the source face object. */
3197 /* char_code :: The starting character code. */
3200 /* agindex :: Glyph index of next character code. 0~if charmap */
3204 /* The charmap's next character code. */
3207 /* You should use this function with @FT_Get_First_Char to walk */
3208 /* over all character codes available in a given charmap. See the */
3209 /* note for this function for a simple code example. */
3211 /* Note that `*agindex' is set to~0 when there are no more codes in */
3214 FT_EXPORT( FT_ULong )
3215 FT_Get_Next_Char( FT_Face face,
3220 /*************************************************************************/
3223 /* FT_Get_Name_Index */
3226 /* Return the glyph index of a given glyph name. This function uses */
3227 /* driver specific objects to do the translation. */
3230 /* face :: A handle to the source face object. */
3232 /* glyph_name :: The glyph name. */
3235 /* The glyph index. 0~means `undefined character code'. */
3237 FT_EXPORT( FT_UInt )
3238 FT_Get_Name_Index( FT_Face face,
3239 FT_String* glyph_name );
3242 /*************************************************************************
3245 * FT_SUBGLYPH_FLAG_XXX
3248 * A list of constants used to describe subglyphs. Please refer to the
3249 * TrueType specification for the meaning of the various flags.
3252 * FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ::
3253 * FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ::
3254 * FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID ::
3255 * FT_SUBGLYPH_FLAG_SCALE ::
3256 * FT_SUBGLYPH_FLAG_XY_SCALE ::
3257 * FT_SUBGLYPH_FLAG_2X2 ::
3258 * FT_SUBGLYPH_FLAG_USE_MY_METRICS ::
3261 #define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1
3262 #define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2
3263 #define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4
3264 #define FT_SUBGLYPH_FLAG_SCALE 8
3265 #define FT_SUBGLYPH_FLAG_XY_SCALE 0x40
3266 #define FT_SUBGLYPH_FLAG_2X2 0x80
3267 #define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
3270 /*************************************************************************
3273 * FT_Get_SubGlyph_Info
3276 * Retrieve a description of a given subglyph. Only use it if
3277 * `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is
3278 * returned otherwise.
3282 * The source glyph slot.
3285 * The index of the subglyph. Must be less than
3286 * `glyph->num_subglyphs'.
3290 * The glyph index of the subglyph.
3293 * The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX.
3296 * The subglyph's first argument (if any).
3299 * The subglyph's second argument (if any).
3302 * The subglyph transformation (if any).
3305 * FreeType error code. 0~means success.
3308 * The values of `*p_arg1', `*p_arg2', and `*p_transform' must be
3309 * interpreted depending on the flags returned in `*p_flags'. See the
3310 * TrueType specification for details.
3313 FT_EXPORT( FT_Error )
3314 FT_Get_SubGlyph_Info( FT_GlyphSlot glyph,
3320 FT_Matrix *p_transform );
3323 /*************************************************************************/
3329 /* A list of bit flags used in the `fsType' field of the OS/2 table */
3330 /* in a TrueType or OpenType font and the `FSType' entry in a */
3331 /* PostScript font. These bit flags are returned by */
3332 /* @FT_Get_FSType_Flags; they inform client applications of embedding */
3333 /* and subsetting restrictions associated with a font. */
3335 /* See http://www.adobe.com/devnet/acrobat/pdfs/FontPolicies.pdf for */
3339 /* FT_FSTYPE_INSTALLABLE_EMBEDDING :: */
3340 /* Fonts with no fsType bit set may be embedded and permanently */
3341 /* installed on the remote system by an application. */
3343 /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING :: */
3344 /* Fonts that have only this bit set must not be modified, embedded */
3345 /* or exchanged in any manner without first obtaining permission of */
3346 /* the font software copyright owner. */
3348 /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING :: */
3349 /* If this bit is set, the font may be embedded and temporarily */
3350 /* loaded on the remote system. Documents containing Preview & */
3351 /* Print fonts must be opened `read-only'; no edits can be applied */
3352 /* to the document. */
3354 /* FT_FSTYPE_EDITABLE_EMBEDDING :: */
3355 /* If this bit is set, the font may be embedded but must only be */
3356 /* installed temporarily on other systems. In contrast to Preview */
3357 /* & Print fonts, documents containing editable fonts may be opened */
3358 /* for reading, editing is permitted, and changes may be saved. */
3360 /* FT_FSTYPE_NO_SUBSETTING :: */
3361 /* If this bit is set, the font may not be subsetted prior to */
3364 /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY :: */
3365 /* If this bit is set, only bitmaps contained in the font may be */
3366 /* embedded; no outline data may be embedded. If there are no */
3367 /* bitmaps available in the font, then the font is unembeddable. */
3370 /* While the fsType flags can indicate that a font may be embedded, a */
3371 /* license with the font vendor may be separately required to use the */
3372 /* font in this way. */
3374 #define FT_FSTYPE_INSTALLABLE_EMBEDDING 0x0000
3375 #define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING 0x0002
3376 #define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING 0x0004
3377 #define FT_FSTYPE_EDITABLE_EMBEDDING 0x0008
3378 #define FT_FSTYPE_NO_SUBSETTING 0x0100
3379 #define FT_FSTYPE_BITMAP_EMBEDDING_ONLY 0x0200
3382 /*************************************************************************/
3385 /* FT_Get_FSType_Flags */
3388 /* Return the fsType flags for a font. */
3391 /* face :: A handle to the source face object. */
3394 /* The fsType flags, @FT_FSTYPE_XXX. */
3397 /* Use this function rather than directly reading the `fs_type' field */
3398 /* in the @PS_FontInfoRec structure which is only guaranteed to */
3399 /* return the correct results for Type~1 fonts. */
3404 FT_EXPORT( FT_UShort )
3405 FT_Get_FSType_Flags( FT_Face face );
3408 /*************************************************************************/
3411 /* glyph_variants */
3414 /* Glyph Variants */
3417 /* The FreeType~2 interface to Unicode Ideographic Variation */
3418 /* Sequences (IVS), using the SFNT cmap format~14. */
3421 /* Many CJK characters have variant forms. They are a sort of grey */
3422 /* area somewhere between being totally irrelevant and semantically */
3423 /* distinct; for this reason, the Unicode consortium decided to */
3424 /* introduce Ideographic Variation Sequences (IVS), consisting of a */
3425 /* Unicode base character and one of 240 variant selectors */
3426 /* (U+E0100-U+E01EF), instead of further extending the already huge */
3427 /* code range for CJK characters. */
3429 /* An IVS is registered and unique; for further details please refer */
3430 /* to Unicode Technical Standard #37, the Ideographic Variation */
3433 /* http://www.unicode.org/reports/tr37/ */
3435 /* To date (November 2012), the character with the most variants is */
3436 /* U+9089, having 31 such IVS. */
3438 /* Adobe and MS decided to support IVS with a new cmap subtable */
3439 /* (format~14). It is an odd subtable because it is not a mapping of */
3440 /* input code points to glyphs, but contains lists of all variants */
3441 /* supported by the font. */
3443 /* A variant may be either `default' or `non-default'. A default */
3444 /* variant is the one you will get for that code point if you look it */
3445 /* up in the standard Unicode cmap. A non-default variant is a */
3446 /* different glyph. */
3448 /*************************************************************************/
3451 /*************************************************************************/
3454 /* FT_Face_GetCharVariantIndex */
3457 /* Return the glyph index of a given character code as modified by */
3458 /* the variation selector. */
3462 /* A handle to the source face object. */
3465 /* The character code point in Unicode. */
3467 /* variantSelector :: */
3468 /* The Unicode code point of the variation selector. */
3471 /* The glyph index. 0~means either `undefined character code', or */
3472 /* `undefined selector code', or `no variation selector cmap */
3473 /* subtable', or `current CharMap is not Unicode'. */
3476 /* If you use FreeType to manipulate the contents of font files */
3477 /* directly, be aware that the glyph index returned by this function */
3478 /* doesn't always correspond to the internal indices used within */
3479 /* the file. This is done to ensure that value~0 always corresponds */
3480 /* to the `missing glyph'. */
3482 /* This function is only meaningful if */
3483 /* a) the font has a variation selector cmap sub table, */
3485 /* b) the current charmap has a Unicode encoding. */
3490 FT_EXPORT( FT_UInt )
3491 FT_Face_GetCharVariantIndex( FT_Face face,
3493 FT_ULong variantSelector );
3496 /*************************************************************************/
3499 /* FT_Face_GetCharVariantIsDefault */
3502 /* Check whether this variant of this Unicode character is the one to */
3503 /* be found in the `cmap'. */
3507 /* A handle to the source face object. */
3510 /* The character codepoint in Unicode. */
3512 /* variantSelector :: */
3513 /* The Unicode codepoint of the variation selector. */
3516 /* 1~if found in the standard (Unicode) cmap, 0~if found in the */
3517 /* variation selector cmap, or -1 if it is not a variant. */
3520 /* This function is only meaningful if the font has a variation */
3521 /* selector cmap subtable. */
3527 FT_Face_GetCharVariantIsDefault( FT_Face face,
3529 FT_ULong variantSelector );
3532 /*************************************************************************/
3535 /* FT_Face_GetVariantSelectors */
3538 /* Return a zero-terminated list of Unicode variant selectors found */
3543 /* A handle to the source face object. */
3546 /* A pointer to an array of selector code points, or NULL if there is */
3547 /* no valid variant selector cmap subtable. */
3550 /* The last item in the array is~0; the array is owned by the */
3551 /* @FT_Face object but can be overwritten or released on the next */
3552 /* call to a FreeType function. */
3557 FT_EXPORT( FT_UInt32* )
3558 FT_Face_GetVariantSelectors( FT_Face face );
3561 /*************************************************************************/
3564 /* FT_Face_GetVariantsOfChar */
3567 /* Return a zero-terminated list of Unicode variant selectors found */
3568 /* for the specified character code. */
3572 /* A handle to the source face object. */
3575 /* The character codepoint in Unicode. */
3578 /* A pointer to an array of variant selector code points which are */
3579 /* active for the given character, or NULL if the corresponding list */
3583 /* The last item in the array is~0; the array is owned by the */
3584 /* @FT_Face object but can be overwritten or released on the next */
3585 /* call to a FreeType function. */
3590 FT_EXPORT( FT_UInt32* )
3591 FT_Face_GetVariantsOfChar( FT_Face face,
3592 FT_ULong charcode );
3595 /*************************************************************************/
3598 /* FT_Face_GetCharsOfVariant */
3601 /* Return a zero-terminated list of Unicode character codes found for */
3602 /* the specified variant selector. */
3606 /* A handle to the source face object. */
3608 /* variantSelector :: */
3609 /* The variant selector code point in Unicode. */
3612 /* A list of all the code points which are specified by this selector */
3613 /* (both default and non-default codes are returned) or NULL if there */
3614 /* is no valid cmap or the variant selector is invalid. */
3617 /* The last item in the array is~0; the array is owned by the */
3618 /* @FT_Face object but can be overwritten or released on the next */
3619 /* call to a FreeType function. */
3624 FT_EXPORT( FT_UInt32* )
3625 FT_Face_GetCharsOfVariant( FT_Face face,
3626 FT_ULong variantSelector );
3629 /*************************************************************************/
3638 /* Crunching fixed numbers and vectors. */
3641 /* This section contains various functions used to perform */
3642 /* computations on 16.16 fixed-float numbers or 2d vectors. */
3651 /* FT_Vector_Transform */
3652 /* FT_Matrix_Multiply */
3653 /* FT_Matrix_Invert */
3655 /*************************************************************************/
3658 /*************************************************************************/
3664 /* A very simple function used to perform the computation `(a*b)/c' */
3665 /* with maximum accuracy (it uses a 64-bit intermediate integer */
3666 /* whenever necessary). */
3668 /* This function isn't necessarily as fast as some processor specific */
3669 /* operations, but is at least completely portable. */
3672 /* a :: The first multiplier. */
3673 /* b :: The second multiplier. */
3674 /* c :: The divisor. */
3677 /* The result of `(a*b)/c'. This function never traps when trying to */
3678 /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
3679 /* on the signs of `a' and `b'. */
3681 FT_EXPORT( FT_Long )
3682 FT_MulDiv( FT_Long a,
3689 /* The following #if 0 ... #endif is for the documentation formatter, */
3690 /* hiding the internal `FT_MULFIX_INLINED' macro. */
3693 /*************************************************************************/
3699 /* A very simple function used to perform the computation */
3700 /* `(a*b)/0x10000' with maximum accuracy. Most of the time this is */
3701 /* used to multiply a given value by a 16.16 fixed-point factor. */
3704 /* a :: The first multiplier. */
3705 /* b :: The second multiplier. Use a 16.16 factor here whenever */
3706 /* possible (see note below). */
3709 /* The result of `(a*b)/0x10000'. */
3712 /* This function has been optimized for the case where the absolute */
3713 /* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */
3714 /* As this happens mainly when scaling from notional units to */
3715 /* fractional pixels in FreeType, it resulted in noticeable speed */
3716 /* improvements between versions 2.x and 1.x. */
3718 /* As a conclusion, always try to place a 16.16 factor as the */
3719 /* _second_ argument of this function; this can make a great */
3722 FT_EXPORT( FT_Long )
3723 FT_MulFix( FT_Long a,
3729 #ifdef FT_MULFIX_INLINED
3730 #define FT_MulFix( a, b ) FT_MULFIX_INLINED( a, b )
3732 FT_EXPORT( FT_Long )
3733 FT_MulFix( FT_Long a,
3738 /*************************************************************************/
3744 /* A very simple function used to perform the computation */
3745 /* `(a*0x10000)/b' with maximum accuracy. Most of the time, this is */
3746 /* used to divide a given value by a 16.16 fixed-point factor. */
3749 /* a :: The first multiplier. */
3750 /* b :: The second multiplier. Use a 16.16 factor here whenever */
3751 /* possible (see note below). */
3754 /* The result of `(a*0x10000)/b'. */
3757 /* The optimization for FT_DivFix() is simple: If (a~<<~16) fits in */
3758 /* 32~bits, then the division is computed directly. Otherwise, we */
3759 /* use a specialized version of @FT_MulDiv. */
3761 FT_EXPORT( FT_Long )
3762 FT_DivFix( FT_Long a,
3766 /*************************************************************************/
3772 /* A very simple function used to round a 16.16 fixed number. */
3775 /* a :: The number to be rounded. */
3778 /* The result of `(a + 0x8000) & -0x10000'. */
3780 FT_EXPORT( FT_Fixed )
3781 FT_RoundFix( FT_Fixed a );
3784 /*************************************************************************/
3790 /* A very simple function used to compute the ceiling function of a */
3791 /* 16.16 fixed number. */
3794 /* a :: The number for which the ceiling function is to be computed. */
3797 /* The result of `(a + 0x10000 - 1) & -0x10000'. */
3799 FT_EXPORT( FT_Fixed )
3800 FT_CeilFix( FT_Fixed a );
3803 /*************************************************************************/
3809 /* A very simple function used to compute the floor function of a */
3810 /* 16.16 fixed number. */
3813 /* a :: The number for which the floor function is to be computed. */
3816 /* The result of `a & -0x10000'. */
3818 FT_EXPORT( FT_Fixed )
3819 FT_FloorFix( FT_Fixed a );
3822 /*************************************************************************/
3825 /* FT_Vector_Transform */
3828 /* Transform a single vector through a 2x2 matrix. */
3831 /* vector :: The target vector to transform. */
3834 /* matrix :: A pointer to the source 2x2 matrix. */
3837 /* The result is undefined if either `vector' or `matrix' is invalid. */
3840 FT_Vector_Transform( FT_Vector* vec,
3841 const FT_Matrix* matrix );
3844 /*************************************************************************/
3850 /* FreeType Version */
3853 /* Functions and macros related to FreeType versions. */
3856 /* Note that those functions and macros are of limited use because */
3857 /* even a new release of FreeType with only documentation changes */
3858 /* increases the version number. */
3860 /*************************************************************************/
3863 /*************************************************************************
3869 * These three macros identify the FreeType source code version.
3870 * Use @FT_Library_Version to access them at runtime.
3873 * FREETYPE_MAJOR :: The major version number.
3874 * FREETYPE_MINOR :: The minor version number.
3875 * FREETYPE_PATCH :: The patch level.
3878 * The version number of FreeType if built as a dynamic link library
3879 * with the `libtool' package is _not_ controlled by these three
3883 #define FREETYPE_MAJOR 2
3884 #define FREETYPE_MINOR 4
3885 #define FREETYPE_PATCH 12
3888 /*************************************************************************/
3891 /* FT_Library_Version */
3894 /* Return the version of the FreeType library being used. This is */
3895 /* useful when dynamically linking to the library, since one cannot */
3896 /* use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and */
3897 /* @FREETYPE_PATCH. */
3900 /* library :: A source library handle. */
3903 /* amajor :: The major version number. */
3905 /* aminor :: The minor version number. */
3907 /* apatch :: The patch version number. */
3910 /* The reason why this function takes a `library' argument is because */
3911 /* certain programs implement library initialization in a custom way */
3912 /* that doesn't use @FT_Init_FreeType. */
3914 /* In such cases, the library version might not be available before */
3915 /* the library object has been created. */
3918 FT_Library_Version( FT_Library library,
3924 /*************************************************************************/
3927 /* FT_Face_CheckTrueTypePatents */
3930 /* Parse all bytecode instructions of a TrueType font file to check */
3931 /* whether any of the patented opcodes are used. This is only useful */
3932 /* if you want to be able to use the unpatented hinter with */
3933 /* fonts that do *not* use these opcodes. */
3935 /* Note that this function parses *all* glyph instructions in the */
3936 /* font file, which may be slow. */
3939 /* face :: A face handle. */
3942 /* 1~if this is a TrueType font that uses one of the patented */
3943 /* opcodes, 0~otherwise. */
3946 /* Since May 2010, TrueType hinting is no longer patented. */
3951 FT_EXPORT( FT_Bool )
3952 FT_Face_CheckTrueTypePatents( FT_Face face );
3955 /*************************************************************************/
3958 /* FT_Face_SetUnpatentedHinting */
3961 /* Enable or disable the unpatented hinter for a given face. */
3962 /* Only enable it if you have determined that the face doesn't */
3963 /* use any patented opcodes (see @FT_Face_CheckTrueTypePatents). */
3966 /* face :: A face handle. */
3968 /* value :: New boolean setting. */
3971 /* The old setting value. This will always be false if this is not */
3972 /* an SFNT font, or if the unpatented hinter is not compiled in this */
3973 /* instance of the library. */
3976 /* Since May 2010, TrueType hinting is no longer patented. */
3981 FT_EXPORT( FT_Bool )
3982 FT_Face_SetUnpatentedHinting( FT_Face face,
3990 #endif /* __FREETYPE_H__ */