1 /***************************************************************************/
5 /* FreeType high-level API and common types (specification only). */
7 /* Copyright 1996-2015 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 /*************************************************************************/
45 /* header_inclusion */
48 /* FreeType's header inclusion scheme */
51 /* How client applications should include FreeType header files. */
54 /* To be as flexible as possible (and for historical reasons), */
55 /* FreeType uses a very special inclusion scheme to load header */
56 /* files, for example */
59 /* #include <ft2build.h> */
61 /* #include FT_FREETYPE_H */
62 /* #include FT_OUTLINE_H */
65 /* A compiler and its preprocessor only needs an include path to find */
66 /* the file `ft2build.h'; the exact locations and names of the other */
67 /* FreeType header files are hidden by preprocessor macro names, */
68 /* loaded by `ft2build.h'. The API documentation always gives the */
69 /* header macro name needed for a particular function. */
71 /*************************************************************************/
74 /*************************************************************************/
83 /* How client applications should allocate FreeType data structures. */
86 /* FreeType assumes that structures allocated by the user and passed */
87 /* as arguments are zeroed out except for the actual data. In other */
88 /* words, it is recommended to use `calloc' (or variants of it) */
89 /* instead of `malloc' for allocation. */
91 /*************************************************************************/
95 /*************************************************************************/
96 /*************************************************************************/
98 /* B A S I C T Y P E S */
100 /*************************************************************************/
101 /*************************************************************************/
104 /*************************************************************************/
113 /* The FreeType~2 base font interface. */
116 /* This section describes the most important public high-level API */
117 /* functions of FreeType~2. */
130 /* FT_FACE_FLAG_SCALABLE */
131 /* FT_FACE_FLAG_FIXED_SIZES */
132 /* FT_FACE_FLAG_FIXED_WIDTH */
133 /* FT_FACE_FLAG_HORIZONTAL */
134 /* FT_FACE_FLAG_VERTICAL */
135 /* FT_FACE_FLAG_COLOR */
136 /* FT_FACE_FLAG_SFNT */
137 /* FT_FACE_FLAG_CID_KEYED */
138 /* FT_FACE_FLAG_TRICKY */
139 /* FT_FACE_FLAG_KERNING */
140 /* FT_FACE_FLAG_MULTIPLE_MASTERS */
141 /* FT_FACE_FLAG_GLYPH_NAMES */
142 /* FT_FACE_FLAG_EXTERNAL_STREAM */
143 /* FT_FACE_FLAG_HINTER */
144 /* FT_FACE_FLAG_TRICKY */
146 /* FT_HAS_HORIZONTAL */
147 /* FT_HAS_VERTICAL */
149 /* FT_HAS_FIXED_SIZES */
150 /* FT_HAS_GLYPH_NAMES */
151 /* FT_HAS_MULTIPLE_MASTERS */
156 /* FT_IS_FIXED_WIDTH */
157 /* FT_IS_CID_KEYED */
160 /* FT_STYLE_FLAG_BOLD */
161 /* FT_STYLE_FLAG_ITALIC */
164 /* FT_Size_Metrics */
166 /* FT_GlyphSlotRec */
167 /* FT_Glyph_Metrics */
172 /* FT_Init_FreeType */
173 /* FT_Done_FreeType */
177 /* FT_Reference_Face */
178 /* FT_New_Memory_Face */
183 /* FT_Attach_Stream */
185 /* FT_Set_Char_Size */
186 /* FT_Set_Pixel_Sizes */
187 /* FT_Request_Size */
189 /* FT_Size_Request_Type */
190 /* FT_Size_RequestRec */
191 /* FT_Size_Request */
192 /* FT_Set_Transform */
194 /* FT_Get_Char_Index */
195 /* FT_Get_First_Char */
196 /* FT_Get_Next_Char */
197 /* FT_Get_Name_Index */
202 /* FT_OPEN_PATHNAME */
206 /* FT_LOAD_DEFAULT */
208 /* FT_LOAD_MONOCHROME */
209 /* FT_LOAD_LINEAR_DESIGN */
210 /* FT_LOAD_NO_SCALE */
211 /* FT_LOAD_NO_HINTING */
212 /* FT_LOAD_NO_BITMAP */
213 /* FT_LOAD_NO_AUTOHINT */
216 /* FT_LOAD_VERTICAL_LAYOUT */
217 /* FT_LOAD_IGNORE_TRANSFORM */
218 /* FT_LOAD_FORCE_AUTOHINT */
219 /* FT_LOAD_NO_RECURSE */
220 /* FT_LOAD_PEDANTIC */
222 /* FT_LOAD_TARGET_NORMAL */
223 /* FT_LOAD_TARGET_LIGHT */
224 /* FT_LOAD_TARGET_MONO */
225 /* FT_LOAD_TARGET_LCD */
226 /* FT_LOAD_TARGET_LCD_V */
228 /* FT_LOAD_TARGET_MODE */
230 /* FT_Render_Glyph */
233 /* FT_Kerning_Mode */
234 /* FT_Get_Track_Kerning */
235 /* FT_Get_Glyph_Name */
236 /* FT_Get_Postscript_Name */
239 /* FT_Select_Charmap */
241 /* FT_Get_Charmap_Index */
243 /* FT_Get_FSType_Flags */
244 /* FT_Get_SubGlyph_Info */
246 /* FT_Face_Internal */
247 /* FT_Size_Internal */
248 /* FT_Slot_Internal */
250 /* FT_FACE_FLAG_XXX */
251 /* FT_STYLE_FLAG_XXX */
254 /* FT_LOAD_TARGET_XXX */
255 /* FT_SUBGLYPH_FLAG_XXX */
258 /* FT_HAS_FAST_GLYPHS */
260 /*************************************************************************/
263 /*************************************************************************/
266 /* FT_Glyph_Metrics */
269 /* A structure used to model the metrics of a single glyph. The */
270 /* values are expressed in 26.6 fractional pixel format; if the flag */
271 /* @FT_LOAD_NO_SCALE has been used while loading the glyph, values */
272 /* are expressed in font units instead. */
276 /* The glyph's width. */
279 /* The glyph's height. */
281 /* horiBearingX :: */
282 /* Left side bearing for horizontal layout. */
284 /* horiBearingY :: */
285 /* Top side bearing for horizontal layout. */
288 /* Advance width for horizontal layout. */
290 /* vertBearingX :: */
291 /* Left side bearing for vertical layout. */
293 /* vertBearingY :: */
294 /* Top side bearing for vertical layout. Larger positive values */
295 /* mean further below the vertical glyph origin. */
298 /* Advance height for vertical layout. Positive values mean the */
299 /* glyph has a positive advance downward. */
302 /* If not disabled with @FT_LOAD_NO_HINTING, the values represent */
303 /* dimensions of the hinted glyph (in case hinting is applicable). */
305 /* Stroking a glyph with an outside border does not increase */
306 /* `horiAdvance' or `vertAdvance'; you have to manually adjust these */
307 /* values to account for the added width and height. */
309 typedef struct FT_Glyph_Metrics_
325 /*************************************************************************/
331 /* This structure models the metrics of a bitmap strike (i.e., a set */
332 /* of glyphs for a given point size and resolution) in a bitmap font. */
333 /* It is used for the `available_sizes' field of @FT_Face. */
336 /* height :: The vertical distance, in pixels, between two */
337 /* consecutive baselines. It is always positive. */
339 /* width :: The average width, in pixels, of all glyphs in the */
342 /* size :: The nominal size of the strike in 26.6 fractional */
343 /* points. This field is not very useful. */
345 /* x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional */
348 /* y_ppem :: The vertical ppem (nominal height) in 26.6 fractional */
353 /* The nominal size given in a FNT font is not reliable. Thus when */
354 /* the driver finds it incorrect, it sets `size' to some calculated */
355 /* values and sets `x_ppem' and `y_ppem' to the pixel width and */
356 /* height given in the font, respectively. */
358 /* TrueType embedded bitmaps: */
359 /* `size', `width', and `height' values are not contained in the */
360 /* bitmap strike itself. They are computed from the global font */
363 typedef struct FT_Bitmap_Size_
376 /*************************************************************************/
377 /*************************************************************************/
379 /* O B J E C T C L A S S E S */
381 /*************************************************************************/
382 /*************************************************************************/
384 /*************************************************************************/
390 /* A handle to a FreeType library instance. Each `library' is */
391 /* completely independent from the others; it is the `root' of a set */
392 /* of objects like fonts, faces, sizes, etc. */
394 /* It also embeds a memory manager (see @FT_Memory), as well as a */
395 /* scan-line converter object (see @FT_Raster). */
397 /* In multi-threaded applications it is easiest to use one */
398 /* `FT_Library' object per thread. In case this is too cumbersome, */
399 /* a single `FT_Library' object across threads is possible also */
400 /* (since FreeType version 2.5.6), as long as a mutex lock is used */
401 /* around @FT_New_Face and @FT_Done_Face. */
404 /* Library objects are normally created by @FT_Init_FreeType, and */
405 /* destroyed with @FT_Done_FreeType. If you need reference-counting */
406 /* (cf. @FT_Reference_Library), use @FT_New_Library and */
407 /* @FT_Done_Library. */
409 typedef struct FT_LibraryRec_
*FT_Library
;
412 /*************************************************************************/
415 /* module_management */
417 /*************************************************************************/
419 /*************************************************************************/
425 /* A handle to a given FreeType module object. Each module can be a */
426 /* font driver, a renderer, or anything else that provides services */
427 /* to the formers. */
429 typedef struct FT_ModuleRec_
* FT_Module
;
432 /*************************************************************************/
438 /* A handle to a given FreeType font driver object. Each font driver */
439 /* is a special module capable of creating faces from font files. */
441 typedef struct FT_DriverRec_
* FT_Driver
;
444 /*************************************************************************/
450 /* A handle to a given FreeType renderer. A renderer is a special */
451 /* module in charge of converting a glyph image to a bitmap, when */
452 /* necessary. Each renderer supports a given glyph image format, and */
453 /* one or more target surface depths. */
455 typedef struct FT_RendererRec_
* FT_Renderer
;
458 /*************************************************************************/
463 /*************************************************************************/
465 /*************************************************************************/
471 /* A handle to a given typographic face object. A face object models */
472 /* a given typeface, in a given style. */
475 /* Each face object also owns a single @FT_GlyphSlot object, as well */
476 /* as one or more @FT_Size objects. */
478 /* Use @FT_New_Face or @FT_Open_Face to create a new face object from */
479 /* a given filepathname or a custom input stream. */
481 /* Use @FT_Done_Face to destroy it (along with its slot and sizes). */
483 /* An `FT_Face' object can only be safely used from one thread at a */
484 /* time. Similarly, creation and destruction of `FT_Face' with the */
485 /* same @FT_Library object can only be done from one thread at a */
486 /* time. On the other hand, functions like @FT_Load_Glyph and its */
487 /* siblings are thread-safe and do not need the lock to be held as */
488 /* long as the same `FT_Face' object is not used from multiple */
489 /* threads at the same time. */
492 /* See @FT_FaceRec for the publicly accessible fields of a given face */
495 typedef struct FT_FaceRec_
* FT_Face
;
498 /*************************************************************************/
504 /* A handle to an object used to model a face scaled to a given */
505 /* character size. */
508 /* Each @FT_Face has an _active_ @FT_Size object that is used by */
509 /* functions like @FT_Load_Glyph to determine the scaling */
510 /* transformation that in turn is used to load and hint glyphs and */
513 /* You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, */
514 /* @FT_Request_Size or even @FT_Select_Size to change the content */
515 /* (i.e., the scaling values) of the active @FT_Size. */
517 /* You can use @FT_New_Size to create additional size objects for a */
518 /* given @FT_Face, but they won't be used by other functions until */
519 /* you activate it through @FT_Activate_Size. Only one size can be */
520 /* activated at any given time per face. */
523 /* See @FT_SizeRec for the publicly accessible fields of a given size */
526 typedef struct FT_SizeRec_
* FT_Size
;
529 /*************************************************************************/
535 /* A handle to a given `glyph slot'. A slot is a container where it */
536 /* is possible to load any of the glyphs contained in its parent */
539 /* In other words, each time you call @FT_Load_Glyph or */
540 /* @FT_Load_Char, the slot's content is erased by the new glyph data, */
541 /* i.e., the glyph's metrics, its image (bitmap or outline), and */
542 /* other control information. */
545 /* See @FT_GlyphSlotRec for the publicly accessible glyph fields. */
547 typedef struct FT_GlyphSlotRec_
* FT_GlyphSlot
;
550 /*************************************************************************/
556 /* A handle to a given character map. A charmap is used to translate */
557 /* character codes in a given encoding into glyph indexes for its */
558 /* parent's face. Some font formats may provide several charmaps per */
561 /* Each face object owns zero or more charmaps, but only one of them */
562 /* can be `active' and used by @FT_Get_Char_Index or @FT_Load_Char. */
564 /* The list of available charmaps in a face is available through the */
565 /* `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec. */
567 /* The currently active charmap is available as `face->charmap'. */
568 /* You should call @FT_Set_Charmap to change it. */
571 /* When a new face is created (either through @FT_New_Face or */
572 /* @FT_Open_Face), the library looks for a Unicode charmap within */
573 /* the list and automatically activates it. */
576 /* See @FT_CharMapRec for the publicly accessible fields of a given */
579 typedef struct FT_CharMapRec_
* FT_CharMap
;
582 /*************************************************************************/
588 /* This macro converts four-letter tags into an unsigned long. It is */
589 /* used to define `encoding' identifiers (see @FT_Encoding). */
592 /* Since many 16-bit compilers don't like 32-bit enumerations, you */
593 /* should redefine this macro in case of problems to something like */
597 /* #define FT_ENC_TAG( value, a, b, c, d ) value */
600 /* to get a simple enumeration without assigning special numbers. */
604 #define FT_ENC_TAG( value, a, b, c, d ) \
605 value = ( ( (FT_UInt32)(a) << 24 ) | \
606 ( (FT_UInt32)(b) << 16 ) | \
607 ( (FT_UInt32)(c) << 8 ) | \
610 #endif /* FT_ENC_TAG */
613 /*************************************************************************/
619 /* An enumeration used to specify character sets supported by */
620 /* charmaps. Used in the @FT_Select_Charmap API function. */
623 /* Despite the name, this enumeration lists specific character */
624 /* repertories (i.e., charsets), and not text encoding methods (e.g., */
625 /* UTF-8, UTF-16, etc.). */
627 /* Other encodings might be defined in the future. */
630 /* FT_ENCODING_NONE :: */
631 /* The encoding value~0 is reserved. */
633 /* FT_ENCODING_UNICODE :: */
634 /* Corresponds to the Unicode character set. This value covers */
635 /* all versions of the Unicode repertoire, including ASCII and */
636 /* Latin-1. Most fonts include a Unicode charmap, but not all */
639 /* For example, if you want to access Unicode value U+1F028 (and */
640 /* the font contains it), use value 0x1F028 as the input value for */
641 /* @FT_Get_Char_Index. */
643 /* FT_ENCODING_MS_SYMBOL :: */
644 /* Corresponds to the Microsoft Symbol encoding, used to encode */
645 /* mathematical symbols and wingdings. For more information, see */
646 /* `http://www.microsoft.com/typography/otspec/recom.htm', */
647 /* `http://www.kostis.net/charsets/symbol.htm', and */
648 /* `http://www.kostis.net/charsets/wingding.htm'. */
650 /* This encoding uses character codes from the PUA (Private Unicode */
651 /* Area) in the range U+F020-U+F0FF. */
653 /* FT_ENCODING_SJIS :: */
654 /* Corresponds to Japanese SJIS encoding. More info at */
655 /* at `http://en.wikipedia.org/wiki/Shift_JIS'. */
656 /* See note on multi-byte encodings below. */
658 /* FT_ENCODING_GB2312 :: */
659 /* Corresponds to an encoding system for Simplified Chinese as used */
660 /* used in mainland China. */
662 /* FT_ENCODING_BIG5 :: */
663 /* Corresponds to an encoding system for Traditional Chinese as */
664 /* used in Taiwan and Hong Kong. */
666 /* FT_ENCODING_WANSUNG :: */
667 /* Corresponds to the Korean encoding system known as Wansung. */
668 /* For more information see */
669 /* `https://msdn.microsoft.com/en-US/goglobal/cc305154'. */
671 /* FT_ENCODING_JOHAB :: */
672 /* The Korean standard character set (KS~C 5601-1992), which */
673 /* corresponds to MS Windows code page 1361. This character set */
674 /* includes all possible Hangeul character combinations. */
676 /* FT_ENCODING_ADOBE_LATIN_1 :: */
677 /* Corresponds to a Latin-1 encoding as defined in a Type~1 */
678 /* PostScript font. It is limited to 256 character codes. */
680 /* FT_ENCODING_ADOBE_STANDARD :: */
681 /* Corresponds to the Adobe Standard encoding, as found in Type~1, */
682 /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
685 /* FT_ENCODING_ADOBE_EXPERT :: */
686 /* Corresponds to the Adobe Expert encoding, as found in Type~1, */
687 /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
690 /* FT_ENCODING_ADOBE_CUSTOM :: */
691 /* Corresponds to a custom encoding, as found in Type~1, CFF, and */
692 /* OpenType/CFF fonts. It is limited to 256 character codes. */
694 /* FT_ENCODING_APPLE_ROMAN :: */
695 /* Corresponds to the 8-bit Apple roman encoding. Many TrueType */
696 /* and OpenType fonts contain a charmap for this encoding, since */
697 /* older versions of Mac OS are able to use it. */
699 /* FT_ENCODING_OLD_LATIN_2 :: */
700 /* This value is deprecated and was never used nor reported by */
701 /* FreeType. Don't use or test for it. */
703 /* FT_ENCODING_MS_SJIS :: */
704 /* Same as FT_ENCODING_SJIS. Deprecated. */
706 /* FT_ENCODING_MS_GB2312 :: */
707 /* Same as FT_ENCODING_GB2312. Deprecated. */
709 /* FT_ENCODING_MS_BIG5 :: */
710 /* Same as FT_ENCODING_BIG5. Deprecated. */
712 /* FT_ENCODING_MS_WANSUNG :: */
713 /* Same as FT_ENCODING_WANSUNG. Deprecated. */
715 /* FT_ENCODING_MS_JOHAB :: */
716 /* Same as FT_ENCODING_JOHAB. Deprecated. */
719 /* By default, FreeType automatically synthesizes a Unicode charmap */
720 /* for PostScript fonts, using their glyph names dictionaries. */
721 /* However, it also reports the encodings defined explicitly in the */
722 /* font file, for the cases when they are needed, with the Adobe */
723 /* values as well. */
725 /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */
726 /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */
727 /* FT_ENCODING_UNICODE). Use @FT_Get_BDF_Charset_ID to find out */
728 /* which encoding is really present. If, for example, the */
729 /* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */
730 /* the font is encoded in KOI8-R. */
732 /* FT_ENCODING_NONE is always set (with a single exception) by the */
733 /* winfonts driver. Use @FT_Get_WinFNT_Header and examine the */
734 /* `charset' field of the @FT_WinFNT_HeaderRec structure to find out */
735 /* which encoding is really present. For example, */
736 /* @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for */
739 /* FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */
740 /* and `encoding_id' is not @TT_MAC_ID_ROMAN (otherwise it is set to */
741 /* FT_ENCODING_APPLE_ROMAN). */
743 /* If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function */
744 /* @FT_Get_CMap_Language_ID to query the Mac language ID that may */
745 /* be needed to be able to distinguish Apple encoding variants. See */
747 /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt */
749 /* to get an idea how to do that. Basically, if the language ID */
750 /* is~0, don't use it, otherwise subtract 1 from the language ID. */
751 /* Then examine `encoding_id'. If, for example, `encoding_id' is */
752 /* @TT_MAC_ID_ROMAN and the language ID (minus~1) is */
753 /* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */
754 /* @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi */
755 /* variant the Arabic encoding. */
757 typedef enum FT_Encoding_
759 FT_ENC_TAG( FT_ENCODING_NONE
, 0, 0, 0, 0 ),
761 FT_ENC_TAG( FT_ENCODING_MS_SYMBOL
, 's', 'y', 'm', 'b' ),
762 FT_ENC_TAG( FT_ENCODING_UNICODE
, 'u', 'n', 'i', 'c' ),
764 FT_ENC_TAG( FT_ENCODING_SJIS
, 's', 'j', 'i', 's' ),
765 FT_ENC_TAG( FT_ENCODING_GB2312
, 'g', 'b', ' ', ' ' ),
766 FT_ENC_TAG( FT_ENCODING_BIG5
, 'b', 'i', 'g', '5' ),
767 FT_ENC_TAG( FT_ENCODING_WANSUNG
, 'w', 'a', 'n', 's' ),
768 FT_ENC_TAG( FT_ENCODING_JOHAB
, 'j', 'o', 'h', 'a' ),
770 /* for backwards compatibility */
771 FT_ENCODING_MS_SJIS
= FT_ENCODING_SJIS
,
772 FT_ENCODING_MS_GB2312
= FT_ENCODING_GB2312
,
773 FT_ENCODING_MS_BIG5
= FT_ENCODING_BIG5
,
774 FT_ENCODING_MS_WANSUNG
= FT_ENCODING_WANSUNG
,
775 FT_ENCODING_MS_JOHAB
= FT_ENCODING_JOHAB
,
777 FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD
, 'A', 'D', 'O', 'B' ),
778 FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT
, 'A', 'D', 'B', 'E' ),
779 FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM
, 'A', 'D', 'B', 'C' ),
780 FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1
, 'l', 'a', 't', '1' ),
782 FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2
, 'l', 'a', 't', '2' ),
784 FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN
, 'a', 'r', 'm', 'n' )
789 /* these constants are deprecated; use the corresponding `FT_Encoding' */
791 #define ft_encoding_none FT_ENCODING_NONE
792 #define ft_encoding_unicode FT_ENCODING_UNICODE
793 #define ft_encoding_symbol FT_ENCODING_MS_SYMBOL
794 #define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1
795 #define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2
796 #define ft_encoding_sjis FT_ENCODING_SJIS
797 #define ft_encoding_gb2312 FT_ENCODING_GB2312
798 #define ft_encoding_big5 FT_ENCODING_BIG5
799 #define ft_encoding_wansung FT_ENCODING_WANSUNG
800 #define ft_encoding_johab FT_ENCODING_JOHAB
802 #define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD
803 #define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT
804 #define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM
805 #define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN
808 /*************************************************************************/
814 /* The base charmap structure. */
817 /* face :: A handle to the parent face object. */
819 /* encoding :: An @FT_Encoding tag identifying the charmap. Use */
820 /* this with @FT_Select_Charmap. */
822 /* platform_id :: An ID number describing the platform for the */
823 /* following encoding ID. This comes directly from */
824 /* the TrueType specification and should be emulated */
825 /* for other formats. */
827 /* encoding_id :: A platform specific encoding number. This also */
828 /* comes from the TrueType specification and should be */
829 /* emulated similarly. */
831 typedef struct FT_CharMapRec_
834 FT_Encoding encoding
;
835 FT_UShort platform_id
;
836 FT_UShort encoding_id
;
841 /*************************************************************************/
842 /*************************************************************************/
844 /* B A S E O B J E C T C L A S S E S */
846 /*************************************************************************/
847 /*************************************************************************/
850 /*************************************************************************/
853 /* FT_Face_Internal */
856 /* An opaque handle to an `FT_Face_InternalRec' structure, used to */
857 /* model private data of a given @FT_Face object. */
859 /* This structure might change between releases of FreeType~2 and is */
860 /* not generally available to client applications. */
862 typedef struct FT_Face_InternalRec_
* FT_Face_Internal
;
865 /*************************************************************************/
871 /* FreeType root face class structure. A face object models a */
872 /* typeface in a font file. */
875 /* num_faces :: The number of faces in the font file. Some */
876 /* font formats can have multiple faces in */
879 /* face_index :: This field holds two different values. */
880 /* Bits 0-15 are the index of the face in the */
881 /* font file (starting with value~0). They */
882 /* are set to~0 if there is only one face in */
885 /* Bits 16-30 are relevant to GX variation */
886 /* fonts only, holding the named instance */
887 /* index for the current face index (starting */
888 /* with value~1; value~0 indicates font access */
889 /* without GX variation data). For non-GX */
890 /* fonts, bits 16-30 are ignored. If we have */
891 /* the third named instance of face~4, say, */
892 /* `face_index' is set to 0x00030004. */
894 /* Bit 31 is always zero (this is, */
895 /* `face_index' is always a positive value). */
897 /* face_flags :: A set of bit flags that give important */
898 /* information about the face; see */
899 /* @FT_FACE_FLAG_XXX for the details. */
901 /* style_flags :: The lower 16~bits contain a set of bit */
902 /* flags indicating the style of the face; see */
903 /* @FT_STYLE_FLAG_XXX for the details. Bits */
904 /* 16-30 hold the number of named instances */
905 /* available for the current face if we have a */
906 /* GX variation (sub)font. Bit 31 is always */
907 /* zero (this is, `style_flags' is always a */
908 /* positive value). */
910 /* num_glyphs :: The number of glyphs in the face. If the */
911 /* face is scalable and has sbits (see */
912 /* `num_fixed_sizes'), it is set to the number */
913 /* of outline glyphs. */
915 /* For CID-keyed fonts, this value gives the */
916 /* highest CID used in the font. */
918 /* family_name :: The face's family name. This is an ASCII */
919 /* string, usually in English, that describes */
920 /* the typeface's family (like `Times New */
921 /* Roman', `Bodoni', `Garamond', etc). This */
922 /* is a least common denominator used to list */
923 /* fonts. Some formats (TrueType & OpenType) */
924 /* provide localized and Unicode versions of */
925 /* this string. Applications should use the */
926 /* format specific interface to access them. */
927 /* Can be NULL (e.g., in fonts embedded in a */
930 /* In case the font doesn't provide a specific */
931 /* family name entry, FreeType tries to */
932 /* synthesize one, deriving it from other name */
935 /* style_name :: The face's style name. This is an ASCII */
936 /* string, usually in English, that describes */
937 /* the typeface's style (like `Italic', */
938 /* `Bold', `Condensed', etc). Not all font */
939 /* formats provide a style name, so this field */
940 /* is optional, and can be set to NULL. As */
941 /* for `family_name', some formats provide */
942 /* localized and Unicode versions of this */
943 /* string. Applications should use the format */
944 /* specific interface to access them. */
946 /* num_fixed_sizes :: The number of bitmap strikes in the face. */
947 /* Even if the face is scalable, there might */
948 /* still be bitmap strikes, which are called */
949 /* `sbits' in that case. */
951 /* available_sizes :: An array of @FT_Bitmap_Size for all bitmap */
952 /* strikes in the face. It is set to NULL if */
953 /* there is no bitmap strike. */
955 /* num_charmaps :: The number of charmaps in the face. */
957 /* charmaps :: An array of the charmaps of the face. */
959 /* generic :: A field reserved for client uses. See the */
960 /* @FT_Generic type description. */
962 /* bbox :: The font bounding box. Coordinates are */
963 /* expressed in font units (see */
964 /* `units_per_EM'). The box is large enough */
965 /* to contain any glyph from the font. Thus, */
966 /* `bbox.yMax' can be seen as the `maximum */
967 /* ascender', and `bbox.yMin' as the `minimum */
968 /* descender'. Only relevant for scalable */
971 /* Note that the bounding box might be off by */
972 /* (at least) one pixel for hinted fonts. See */
973 /* @FT_Size_Metrics for further discussion. */
975 /* units_per_EM :: The number of font units per EM square for */
976 /* this face. This is typically 2048 for */
977 /* TrueType fonts, and 1000 for Type~1 fonts. */
978 /* Only relevant for scalable formats. */
980 /* ascender :: The typographic ascender of the face, */
981 /* expressed in font units. For font formats */
982 /* not having this information, it is set to */
983 /* `bbox.yMax'. Only relevant for scalable */
986 /* descender :: The typographic descender of the face, */
987 /* expressed in font units. For font formats */
988 /* not having this information, it is set to */
989 /* `bbox.yMin'. Note that this field is */
990 /* usually negative. Only relevant for */
991 /* scalable formats. */
993 /* height :: This value is the vertical distance */
994 /* between two consecutive baselines, */
995 /* expressed in font units. It is always */
996 /* positive. Only relevant for scalable */
999 /* If you want the global glyph height, use */
1000 /* `ascender - descender'. */
1002 /* max_advance_width :: The maximum advance width, in font units, */
1003 /* for all glyphs in this face. This can be */
1004 /* used to make word wrapping computations */
1005 /* faster. Only relevant for scalable */
1008 /* max_advance_height :: The maximum advance height, in font units, */
1009 /* for all glyphs in this face. This is only */
1010 /* relevant for vertical layouts, and is set */
1011 /* to `height' for fonts that do not provide */
1012 /* vertical metrics. Only relevant for */
1013 /* scalable formats. */
1015 /* underline_position :: The position, in font units, of the */
1016 /* underline line for this face. It is the */
1017 /* center of the underlining stem. Only */
1018 /* relevant for scalable formats. */
1020 /* underline_thickness :: The thickness, in font units, of the */
1021 /* underline for this face. Only relevant for */
1022 /* scalable formats. */
1024 /* glyph :: The face's associated glyph slot(s). */
1026 /* size :: The current active size for this face. */
1028 /* charmap :: The current active charmap for this face. */
1031 /* Fields may be changed after a call to @FT_Attach_File or */
1032 /* @FT_Attach_Stream. */
1034 typedef struct FT_FaceRec_
1040 FT_Long style_flags
;
1044 FT_String
* family_name
;
1045 FT_String
* style_name
;
1047 FT_Int num_fixed_sizes
;
1048 FT_Bitmap_Size
* available_sizes
;
1050 FT_Int num_charmaps
;
1051 FT_CharMap
* charmaps
;
1055 /*# The following member variables (down to `underline_thickness') */
1056 /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */
1057 /*# for bitmap fonts. */
1060 FT_UShort units_per_EM
;
1065 FT_Short max_advance_width
;
1066 FT_Short max_advance_height
;
1068 FT_Short underline_position
;
1069 FT_Short underline_thickness
;
1081 FT_ListRec sizes_list
;
1083 FT_Generic autohint
; /* face-specific auto-hinter data */
1084 void* extensions
; /* unused */
1086 FT_Face_Internal internal
;
1093 /*************************************************************************/
1096 /* FT_FACE_FLAG_XXX */
1099 /* A list of bit flags used in the `face_flags' field of the */
1100 /* @FT_FaceRec structure. They inform client applications of */
1101 /* properties of the corresponding face. */
1104 /* FT_FACE_FLAG_SCALABLE :: */
1105 /* Indicates that the face contains outline glyphs. This doesn't */
1106 /* prevent bitmap strikes, i.e., a face can have both this and */
1107 /* and @FT_FACE_FLAG_FIXED_SIZES set. */
1109 /* FT_FACE_FLAG_FIXED_SIZES :: */
1110 /* Indicates that the face contains bitmap strikes. See also the */
1111 /* `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec. */
1113 /* FT_FACE_FLAG_FIXED_WIDTH :: */
1114 /* Indicates that the face contains fixed-width characters (like */
1115 /* Courier, Lucido, MonoType, etc.). */
1117 /* FT_FACE_FLAG_SFNT :: */
1118 /* Indicates that the face uses the `sfnt' storage scheme. For */
1119 /* now, this means TrueType and OpenType. */
1121 /* FT_FACE_FLAG_HORIZONTAL :: */
1122 /* Indicates that the face contains horizontal glyph metrics. This */
1123 /* should be set for all common formats. */
1125 /* FT_FACE_FLAG_VERTICAL :: */
1126 /* Indicates that the face contains vertical glyph metrics. This */
1127 /* is only available in some formats, not all of them. */
1129 /* FT_FACE_FLAG_KERNING :: */
1130 /* Indicates that the face contains kerning information. If set, */
1131 /* the kerning distance can be retrieved through the function */
1132 /* @FT_Get_Kerning. Otherwise the function always return the */
1133 /* vector (0,0). Note that FreeType doesn't handle kerning data */
1134 /* from the `GPOS' table (as present in some OpenType fonts). */
1136 /* FT_FACE_FLAG_FAST_GLYPHS :: */
1137 /* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */
1139 /* FT_FACE_FLAG_MULTIPLE_MASTERS :: */
1140 /* Indicates that the font contains multiple masters and is capable */
1141 /* of interpolating between them. See the multiple-masters */
1142 /* specific API for details. */
1144 /* FT_FACE_FLAG_GLYPH_NAMES :: */
1145 /* Indicates that the font contains glyph names that can be */
1146 /* retrieved through @FT_Get_Glyph_Name. Note that some TrueType */
1147 /* fonts contain broken glyph name tables. Use the function */
1148 /* @FT_Has_PS_Glyph_Names when needed. */
1150 /* FT_FACE_FLAG_EXTERNAL_STREAM :: */
1151 /* Used internally by FreeType to indicate that a face's stream was */
1152 /* provided by the client application and should not be destroyed */
1153 /* when @FT_Done_Face is called. Don't read or test this flag. */
1155 /* FT_FACE_FLAG_HINTER :: */
1156 /* Set if the font driver has a hinting machine of its own. For */
1157 /* example, with TrueType fonts, it makes sense to use data from */
1158 /* the SFNT `gasp' table only if the native TrueType hinting engine */
1159 /* (with the bytecode interpreter) is available and active. */
1161 /* FT_FACE_FLAG_CID_KEYED :: */
1162 /* Set if the font is CID-keyed. In that case, the font is not */
1163 /* accessed by glyph indices but by CID values. For subsetted */
1164 /* CID-keyed fonts this has the consequence that not all index */
1165 /* values are a valid argument to FT_Load_Glyph. Only the CID */
1166 /* values for which corresponding glyphs in the subsetted font */
1167 /* exist make FT_Load_Glyph return successfully; in all other cases */
1168 /* you get an `FT_Err_Invalid_Argument' error. */
1170 /* Note that CID-keyed fonts that are in an SFNT wrapper don't */
1171 /* have this flag set since the glyphs are accessed in the normal */
1172 /* way (using contiguous indices); the `CID-ness' isn't visible to */
1173 /* the application. */
1175 /* FT_FACE_FLAG_TRICKY :: */
1176 /* Set if the font is `tricky', this is, it always needs the */
1177 /* font format's native hinting engine to get a reasonable result. */
1178 /* A typical example is the Chinese font `mingli.ttf' that uses */
1179 /* TrueType bytecode instructions to move and scale all of its */
1182 /* It is not possible to auto-hint such fonts using */
1183 /* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */
1184 /* @FT_LOAD_NO_HINTING. You have to set both @FT_LOAD_NO_HINTING */
1185 /* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */
1186 /* probably never want this except for demonstration purposes. */
1188 /* Currently, there are about a dozen TrueType fonts in the list of */
1189 /* tricky fonts; they are hard-coded in file `ttobjs.c'. */
1191 /* FT_FACE_FLAG_COLOR :: */
1192 /* Set if the font has color glyph tables. To access color glyphs */
1193 /* use @FT_LOAD_COLOR. */
1195 #define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
1196 #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
1197 #define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )
1198 #define FT_FACE_FLAG_SFNT ( 1L << 3 )
1199 #define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 )
1200 #define FT_FACE_FLAG_VERTICAL ( 1L << 5 )
1201 #define FT_FACE_FLAG_KERNING ( 1L << 6 )
1202 #define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 )
1203 #define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 )
1204 #define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 )
1205 #define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )
1206 #define FT_FACE_FLAG_HINTER ( 1L << 11 )
1207 #define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )
1208 #define FT_FACE_FLAG_TRICKY ( 1L << 13 )
1209 #define FT_FACE_FLAG_COLOR ( 1L << 14 )
1212 /*************************************************************************
1215 * FT_HAS_HORIZONTAL( face )
1218 * A macro that returns true whenever a face object contains
1219 * horizontal metrics (this is true for all font formats though).
1222 * @FT_HAS_VERTICAL can be used to check for vertical metrics.
1225 #define FT_HAS_HORIZONTAL( face ) \
1226 ( face->face_flags & FT_FACE_FLAG_HORIZONTAL )
1229 /*************************************************************************
1232 * FT_HAS_VERTICAL( face )
1235 * A macro that returns true whenever a face object contains real
1236 * vertical metrics (and not only synthesized ones).
1239 #define FT_HAS_VERTICAL( face ) \
1240 ( face->face_flags & FT_FACE_FLAG_VERTICAL )
1243 /*************************************************************************
1246 * FT_HAS_KERNING( face )
1249 * A macro that returns true whenever a face object contains kerning
1250 * data that can be accessed with @FT_Get_Kerning.
1253 #define FT_HAS_KERNING( face ) \
1254 ( face->face_flags & FT_FACE_FLAG_KERNING )
1257 /*************************************************************************
1260 * FT_IS_SCALABLE( face )
1263 * A macro that returns true whenever a face object contains a scalable
1264 * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF,
1265 * and PFR font formats.
1268 #define FT_IS_SCALABLE( face ) \
1269 ( face->face_flags & FT_FACE_FLAG_SCALABLE )
1272 /*************************************************************************
1275 * FT_IS_SFNT( face )
1278 * A macro that returns true whenever a face object contains a font
1279 * whose format is based on the SFNT storage scheme. This usually
1280 * means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded
1283 * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and
1284 * @FT_TRUETYPE_TABLES_H are available.
1287 #define FT_IS_SFNT( face ) \
1288 ( face->face_flags & FT_FACE_FLAG_SFNT )
1291 /*************************************************************************
1294 * FT_IS_FIXED_WIDTH( face )
1297 * A macro that returns true whenever a face object contains a font face
1298 * that contains fixed-width (or `monospace', `fixed-pitch', etc.)
1302 #define FT_IS_FIXED_WIDTH( face ) \
1303 ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
1306 /*************************************************************************
1309 * FT_HAS_FIXED_SIZES( face )
1312 * A macro that returns true whenever a face object contains some
1313 * embedded bitmaps. See the `available_sizes' field of the
1314 * @FT_FaceRec structure.
1317 #define FT_HAS_FIXED_SIZES( face ) \
1318 ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
1321 /*************************************************************************
1324 * FT_HAS_FAST_GLYPHS( face )
1330 #define FT_HAS_FAST_GLYPHS( face ) 0
1333 /*************************************************************************
1336 * FT_HAS_GLYPH_NAMES( face )
1339 * A macro that returns true whenever a face object contains some glyph
1340 * names that can be accessed through @FT_Get_Glyph_Name.
1343 #define FT_HAS_GLYPH_NAMES( face ) \
1344 ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
1347 /*************************************************************************
1350 * FT_HAS_MULTIPLE_MASTERS( face )
1353 * A macro that returns true whenever a face object contains some
1354 * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H
1355 * are then available to choose the exact design you want.
1358 #define FT_HAS_MULTIPLE_MASTERS( face ) \
1359 ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
1362 /*************************************************************************
1365 * FT_IS_CID_KEYED( face )
1368 * A macro that returns true whenever a face object contains a CID-keyed
1369 * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more
1372 * If this macro is true, all functions defined in @FT_CID_H are
1376 #define FT_IS_CID_KEYED( face ) \
1377 ( face->face_flags & FT_FACE_FLAG_CID_KEYED )
1380 /*************************************************************************
1383 * FT_IS_TRICKY( face )
1386 * A macro that returns true whenever a face represents a `tricky' font.
1387 * See the discussion of @FT_FACE_FLAG_TRICKY for more details.
1390 #define FT_IS_TRICKY( face ) \
1391 ( face->face_flags & FT_FACE_FLAG_TRICKY )
1394 /*************************************************************************
1397 * FT_HAS_COLOR( face )
1400 * A macro that returns true whenever a face object contains
1401 * tables for color glyphs.
1404 #define FT_HAS_COLOR( face ) \
1405 ( face->face_flags & FT_FACE_FLAG_COLOR )
1408 /*************************************************************************/
1411 /* FT_STYLE_FLAG_XXX */
1414 /* A list of bit flags used to indicate the style of a given face. */
1415 /* These are used in the `style_flags' field of @FT_FaceRec. */
1418 /* FT_STYLE_FLAG_ITALIC :: */
1419 /* Indicates that a given face style is italic or oblique. */
1421 /* FT_STYLE_FLAG_BOLD :: */
1422 /* Indicates that a given face is bold. */
1425 /* The style information as provided by FreeType is very basic. More */
1426 /* details are beyond the scope and should be done on a higher level */
1427 /* (for example, by analyzing various fields of the `OS/2' table in */
1428 /* SFNT based fonts). */
1430 #define FT_STYLE_FLAG_ITALIC ( 1 << 0 )
1431 #define FT_STYLE_FLAG_BOLD ( 1 << 1 )
1434 /*************************************************************************/
1437 /* FT_Size_Internal */
1440 /* An opaque handle to an `FT_Size_InternalRec' structure, used to */
1441 /* model private data of a given @FT_Size object. */
1443 typedef struct FT_Size_InternalRec_
* FT_Size_Internal
;
1446 /*************************************************************************/
1449 /* FT_Size_Metrics */
1452 /* The size metrics structure gives the metrics of a size object. */
1455 /* x_ppem :: The width of the scaled EM square in pixels, hence */
1456 /* the term `ppem' (pixels per EM). It is also */
1457 /* referred to as `nominal width'. */
1459 /* y_ppem :: The height of the scaled EM square in pixels, */
1460 /* hence the term `ppem' (pixels per EM). It is also */
1461 /* referred to as `nominal height'. */
1463 /* x_scale :: A 16.16 fractional scaling value used to convert */
1464 /* horizontal metrics from font units to 26.6 */
1465 /* fractional pixels. Only relevant for scalable */
1468 /* y_scale :: A 16.16 fractional scaling value used to convert */
1469 /* vertical metrics from font units to 26.6 */
1470 /* fractional pixels. Only relevant for scalable */
1473 /* ascender :: The ascender in 26.6 fractional pixels. See */
1474 /* @FT_FaceRec for the details. */
1476 /* descender :: The descender in 26.6 fractional pixels. See */
1477 /* @FT_FaceRec for the details. */
1479 /* height :: The height in 26.6 fractional pixels. See */
1480 /* @FT_FaceRec for the details. */
1482 /* max_advance :: The maximum advance width in 26.6 fractional */
1483 /* pixels. See @FT_FaceRec for the details. */
1486 /* The scaling values, if relevant, are determined first during a */
1487 /* size changing operation. The remaining fields are then set by the */
1488 /* driver. For scalable formats, they are usually set to scaled */
1489 /* values of the corresponding fields in @FT_FaceRec. */
1491 /* Note that due to glyph hinting, these values might not be exact */
1492 /* for certain fonts. Thus they must be treated as unreliable */
1493 /* with an error margin of at least one pixel! */
1495 /* Indeed, the only way to get the exact metrics is to render _all_ */
1496 /* glyphs. As this would be a definite performance hit, it is up to */
1497 /* client applications to perform such computations. */
1499 /* The FT_Size_Metrics structure is valid for bitmap fonts also. */
1501 typedef struct FT_Size_Metrics_
1503 FT_UShort x_ppem
; /* horizontal pixels per EM */
1504 FT_UShort y_ppem
; /* vertical pixels per EM */
1506 FT_Fixed x_scale
; /* scaling values used to convert font */
1507 FT_Fixed y_scale
; /* units to 26.6 fractional pixels */
1509 FT_Pos ascender
; /* ascender in 26.6 frac. pixels */
1510 FT_Pos descender
; /* descender in 26.6 frac. pixels */
1511 FT_Pos height
; /* text height in 26.6 frac. pixels */
1512 FT_Pos max_advance
; /* max horizontal advance, in 26.6 pixels */
1517 /*************************************************************************/
1523 /* FreeType root size class structure. A size object models a face */
1524 /* object at a given size. */
1527 /* face :: Handle to the parent face object. */
1529 /* generic :: A typeless pointer, unused by the FreeType library or */
1530 /* any of its drivers. It can be used by client */
1531 /* applications to link their own data to each size */
1534 /* metrics :: Metrics for this size object. This field is read-only. */
1536 typedef struct FT_SizeRec_
1538 FT_Face face
; /* parent face object */
1539 FT_Generic generic
; /* generic pointer for client uses */
1540 FT_Size_Metrics metrics
; /* size metrics */
1541 FT_Size_Internal internal
;
1546 /*************************************************************************/
1552 /* The subglyph structure is an internal object used to describe */
1553 /* subglyphs (for example, in the case of composites). */
1556 /* The subglyph implementation is not part of the high-level API, */
1557 /* hence the forward structure declaration. */
1559 /* You can however retrieve subglyph information with */
1560 /* @FT_Get_SubGlyph_Info. */
1562 typedef struct FT_SubGlyphRec_
* FT_SubGlyph
;
1565 /*************************************************************************/
1568 /* FT_Slot_Internal */
1571 /* An opaque handle to an `FT_Slot_InternalRec' structure, used to */
1572 /* model private data of a given @FT_GlyphSlot object. */
1574 typedef struct FT_Slot_InternalRec_
* FT_Slot_Internal
;
1577 /*************************************************************************/
1580 /* FT_GlyphSlotRec */
1583 /* FreeType root glyph slot class structure. A glyph slot is a */
1584 /* container where individual glyphs can be loaded, be they in */
1585 /* outline or bitmap format. */
1588 /* library :: A handle to the FreeType library instance */
1589 /* this slot belongs to. */
1591 /* face :: A handle to the parent face object. */
1593 /* next :: In some cases (like some font tools), several */
1594 /* glyph slots per face object can be a good */
1595 /* thing. As this is rare, the glyph slots are */
1596 /* listed through a direct, single-linked list */
1597 /* using its `next' field. */
1599 /* generic :: A typeless pointer unused by the FreeType */
1600 /* library or any of its drivers. It can be */
1601 /* used by client applications to link their own */
1602 /* data to each glyph slot object. */
1604 /* metrics :: The metrics of the last loaded glyph in the */
1605 /* slot. The returned values depend on the last */
1606 /* load flags (see the @FT_Load_Glyph API */
1607 /* function) and can be expressed either in 26.6 */
1608 /* fractional pixels or font units. */
1610 /* Note that even when the glyph image is */
1611 /* transformed, the metrics are not. */
1613 /* linearHoriAdvance :: The advance width of the unhinted glyph. */
1614 /* Its value is expressed in 16.16 fractional */
1615 /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
1616 /* when loading the glyph. This field can be */
1617 /* important to perform correct WYSIWYG layout. */
1618 /* Only relevant for outline glyphs. */
1620 /* linearVertAdvance :: The advance height of the unhinted glyph. */
1621 /* Its value is expressed in 16.16 fractional */
1622 /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
1623 /* when loading the glyph. This field can be */
1624 /* important to perform correct WYSIWYG layout. */
1625 /* Only relevant for outline glyphs. */
1627 /* advance :: This shorthand is, depending on */
1628 /* @FT_LOAD_IGNORE_TRANSFORM, the transformed */
1629 /* (hinted) advance width for the glyph, in 26.6 */
1630 /* fractional pixel format. As specified with */
1631 /* @FT_LOAD_VERTICAL_LAYOUT, it uses either the */
1632 /* `horiAdvance' or the `vertAdvance' value of */
1633 /* `metrics' field. */
1635 /* format :: This field indicates the format of the image */
1636 /* contained in the glyph slot. Typically */
1637 /* @FT_GLYPH_FORMAT_BITMAP, */
1638 /* @FT_GLYPH_FORMAT_OUTLINE, or */
1639 /* @FT_GLYPH_FORMAT_COMPOSITE, but others are */
1642 /* bitmap :: This field is used as a bitmap descriptor */
1643 /* when the slot format is */
1644 /* @FT_GLYPH_FORMAT_BITMAP. Note that the */
1645 /* address and content of the bitmap buffer can */
1646 /* change between calls of @FT_Load_Glyph and a */
1647 /* few other functions. */
1649 /* bitmap_left :: The bitmap's left bearing expressed in */
1650 /* integer pixels. Only valid if the format is */
1651 /* @FT_GLYPH_FORMAT_BITMAP, this is, if the */
1652 /* glyph slot contains a bitmap. */
1654 /* bitmap_top :: The bitmap's top bearing expressed in integer */
1655 /* pixels. Remember that this is the distance */
1656 /* from the baseline to the top-most glyph */
1657 /* scanline, upwards y~coordinates being */
1660 /* outline :: The outline descriptor for the current glyph */
1661 /* image if its format is */
1662 /* @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is */
1663 /* loaded, `outline' can be transformed, */
1664 /* distorted, embolded, etc. However, it must */
1667 /* num_subglyphs :: The number of subglyphs in a composite glyph. */
1668 /* This field is only valid for the composite */
1669 /* glyph format that should normally only be */
1670 /* loaded with the @FT_LOAD_NO_RECURSE flag. */
1672 /* subglyphs :: An array of subglyph descriptors for */
1673 /* composite glyphs. There are `num_subglyphs' */
1674 /* elements in there. Currently internal to */
1677 /* control_data :: Certain font drivers can also return the */
1678 /* control data for a given glyph image (e.g. */
1679 /* TrueType bytecode, Type~1 charstrings, etc.). */
1680 /* This field is a pointer to such data. */
1682 /* control_len :: This is the length in bytes of the control */
1685 /* other :: Really wicked formats can use this pointer to */
1686 /* present their own glyph image to client */
1687 /* applications. Note that the application */
1688 /* needs to know about the image format. */
1690 /* lsb_delta :: The difference between hinted and unhinted */
1691 /* left side bearing while auto-hinting is */
1692 /* active. Zero otherwise. */
1694 /* rsb_delta :: The difference between hinted and unhinted */
1695 /* right side bearing while auto-hinting is */
1696 /* active. Zero otherwise. */
1699 /* If @FT_Load_Glyph is called with default flags (see */
1700 /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */
1701 /* its native format (e.g., an outline glyph for TrueType and Type~1 */
1704 /* This image can later be converted into a bitmap by calling */
1705 /* @FT_Render_Glyph. This function finds the current renderer for */
1706 /* the native image's format, then invokes it. */
1708 /* The renderer is in charge of transforming the native image through */
1709 /* the slot's face transformation fields, then converting it into a */
1710 /* bitmap that is returned in `slot->bitmap'. */
1712 /* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */
1713 /* to specify the position of the bitmap relative to the current pen */
1714 /* position (e.g., coordinates (0,0) on the baseline). Of course, */
1715 /* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */
1718 /* Here is a small pseudo code fragment that shows how to use */
1719 /* `lsb_delta' and `rsb_delta': */
1722 /* FT_Pos origin_x = 0; */
1723 /* FT_Pos prev_rsb_delta = 0; */
1726 /* for all glyphs do */
1727 /* <compute kern between current and previous glyph and add it to */
1730 /* <load glyph with `FT_Load_Glyph'> */
1732 /* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */
1733 /* origin_x -= 64; */
1734 /* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */
1735 /* origin_x += 64; */
1737 /* prev_rsb_delta = face->glyph->rsb_delta; */
1739 /* <save glyph image, or render glyph, or ...> */
1741 /* origin_x += face->glyph->advance.x; */
1745 typedef struct FT_GlyphSlotRec_
1750 FT_UInt reserved
; /* retained for binary compatibility */
1753 FT_Glyph_Metrics metrics
;
1754 FT_Fixed linearHoriAdvance
;
1755 FT_Fixed linearVertAdvance
;
1758 FT_Glyph_Format format
;
1766 FT_UInt num_subglyphs
;
1767 FT_SubGlyph subglyphs
;
1777 FT_Slot_Internal internal
;
1782 /*************************************************************************/
1783 /*************************************************************************/
1785 /* F U N C T I O N S */
1787 /*************************************************************************/
1788 /*************************************************************************/
1791 /*************************************************************************/
1794 /* FT_Init_FreeType */
1797 /* Initialize a new FreeType library object. The set of modules */
1798 /* that are registered by this function is determined at build time. */
1801 /* alibrary :: A handle to a new library object. */
1804 /* FreeType error code. 0~means success. */
1807 /* In case you want to provide your own memory allocating routines, */
1808 /* use @FT_New_Library instead, followed by a call to */
1809 /* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module). */
1811 /* See the documentation of @FT_Library and @FT_Face for */
1812 /* multi-threading issues. */
1814 /* If you need reference-counting (cf. @FT_Reference_Library), use */
1815 /* @FT_New_Library and @FT_Done_Library. */
1817 FT_EXPORT( FT_Error
)
1818 FT_Init_FreeType( FT_Library
*alibrary
);
1821 /*************************************************************************/
1824 /* FT_Done_FreeType */
1827 /* Destroy a given FreeType library object and all of its children, */
1828 /* including resources, drivers, faces, sizes, etc. */
1831 /* library :: A handle to the target library object. */
1834 /* FreeType error code. 0~means success. */
1836 FT_EXPORT( FT_Error
)
1837 FT_Done_FreeType( FT_Library library
);
1840 /*************************************************************************/
1846 /* A list of bit field constants used within the `flags' field of the */
1847 /* @FT_Open_Args structure. */
1850 /* FT_OPEN_MEMORY :: This is a memory-based stream. */
1852 /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */
1854 /* FT_OPEN_PATHNAME :: Create a new input stream from a C~path */
1857 /* FT_OPEN_DRIVER :: Use the `driver' field. */
1859 /* FT_OPEN_PARAMS :: Use the `num_params' and `params' fields. */
1862 /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */
1863 /* flags are mutually exclusive. */
1865 #define FT_OPEN_MEMORY 0x1
1866 #define FT_OPEN_STREAM 0x2
1867 #define FT_OPEN_PATHNAME 0x4
1868 #define FT_OPEN_DRIVER 0x8
1869 #define FT_OPEN_PARAMS 0x10
1872 /* these constants are deprecated; use the corresponding `FT_OPEN_XXX' */
1873 /* values instead */
1874 #define ft_open_memory FT_OPEN_MEMORY
1875 #define ft_open_stream FT_OPEN_STREAM
1876 #define ft_open_pathname FT_OPEN_PATHNAME
1877 #define ft_open_driver FT_OPEN_DRIVER
1878 #define ft_open_params FT_OPEN_PARAMS
1881 /*************************************************************************/
1887 /* A simple structure used to pass more or less generic parameters to */
1888 /* @FT_Open_Face. */
1891 /* tag :: A four-byte identification tag. */
1893 /* data :: A pointer to the parameter data. */
1896 /* The ID and function of parameters are driver-specific. See the */
1897 /* various FT_PARAM_TAG_XXX flags for more information. */
1899 typedef struct FT_Parameter_
1907 /*************************************************************************/
1913 /* A structure used to indicate how to open a new font file or */
1914 /* stream. A pointer to such a structure can be used as a parameter */
1915 /* for the functions @FT_Open_Face and @FT_Attach_Stream. */
1918 /* flags :: A set of bit flags indicating how to use the */
1921 /* memory_base :: The first byte of the file in memory. */
1923 /* memory_size :: The size in bytes of the file in memory. */
1925 /* pathname :: A pointer to an 8-bit file pathname. */
1927 /* stream :: A handle to a source stream object. */
1929 /* driver :: This field is exclusively used by @FT_Open_Face; */
1930 /* it simply specifies the font driver to use to open */
1931 /* the face. If set to~0, FreeType tries to load the */
1932 /* face with each one of the drivers in its list. */
1934 /* num_params :: The number of extra parameters. */
1936 /* params :: Extra parameters passed to the font driver when */
1937 /* opening a new face. */
1940 /* The stream type is determined by the contents of `flags' that */
1941 /* are tested in the following order by @FT_Open_Face: */
1943 /* If the @FT_OPEN_MEMORY bit is set, assume that this is a */
1944 /* memory file of `memory_size' bytes, located at `memory_address'. */
1945 /* The data are are not copied, and the client is responsible for */
1946 /* releasing and destroying them _after_ the corresponding call to */
1947 /* @FT_Done_Face. */
1949 /* Otherwise, if the @FT_OPEN_STREAM bit is set, assume that a */
1950 /* custom input stream `stream' is used. */
1952 /* Otherwise, if the @FT_OPEN_PATHNAME bit is set, assume that this */
1953 /* is a normal file and use `pathname' to open it. */
1955 /* If the @FT_OPEN_DRIVER bit is set, @FT_Open_Face only tries to */
1956 /* open the file with the driver whose handler is in `driver'. */
1958 /* If the @FT_OPEN_PARAMS bit is set, the parameters given by */
1959 /* `num_params' and `params' is used. They are ignored otherwise. */
1961 /* Ideally, both the `pathname' and `params' fields should be tagged */
1962 /* as `const'; this is missing for API backwards compatibility. In */
1963 /* other words, applications should treat them as read-only. */
1965 typedef struct FT_Open_Args_
1968 const FT_Byte
* memory_base
;
1969 FT_Long memory_size
;
1970 FT_String
* pathname
;
1974 FT_Parameter
* params
;
1979 /*************************************************************************/
1985 /* This function calls @FT_Open_Face to open a font by its pathname. */
1988 /* library :: A handle to the library resource. */
1991 /* pathname :: A path to the font file. */
1993 /* face_index :: See @FT_Open_Face for a detailed description of this */
1997 /* aface :: A handle to a new face object. If `face_index' is */
1998 /* greater than or equal to zero, it must be non-NULL. */
2001 /* FreeType error code. 0~means success. */
2004 /* Use @FT_Done_Face to destroy the created @FT_Face object (along */
2005 /* with its slot and sizes). */
2007 FT_EXPORT( FT_Error
)
2008 FT_New_Face( FT_Library library
,
2009 const char* filepathname
,
2014 /*************************************************************************/
2017 /* FT_New_Memory_Face */
2020 /* This function calls @FT_Open_Face to open a font that has been */
2021 /* loaded into memory. */
2024 /* library :: A handle to the library resource. */
2027 /* file_base :: A pointer to the beginning of the font data. */
2029 /* file_size :: The size of the memory chunk used by the font data. */
2031 /* face_index :: See @FT_Open_Face for a detailed description of this */
2035 /* aface :: A handle to a new face object. If `face_index' is */
2036 /* greater than or equal to zero, it must be non-NULL. */
2039 /* FreeType error code. 0~means success. */
2042 /* You must not deallocate the memory before calling @FT_Done_Face. */
2044 FT_EXPORT( FT_Error
)
2045 FT_New_Memory_Face( FT_Library library
,
2046 const FT_Byte
* file_base
,
2052 /*************************************************************************/
2058 /* Create a face object from a given resource described by */
2059 /* @FT_Open_Args. */
2062 /* library :: A handle to the library resource. */
2065 /* args :: A pointer to an `FT_Open_Args' structure that must */
2066 /* be filled by the caller. */
2068 /* face_index :: This field holds two different values. Bits 0-15 */
2069 /* are the index of the face in the font file (starting */
2070 /* with value~0). Set it to~0 if there is only one */
2071 /* face in the font file. */
2073 /* Bits 16-30 are relevant to GX variation fonts only, */
2074 /* specifying the named instance index for the current */
2075 /* face index (starting with value~1; value~0 makes */
2076 /* FreeType ignore named instances). For non-GX fonts, */
2077 /* bits 16-30 are ignored. Assuming that you want to */
2078 /* access the third named instance in face~4, */
2079 /* `face_index' should be set to 0x00030004. If you */
2080 /* want to access face~4 without GX variation handling, */
2081 /* simply set `face_index' to value~4. */
2083 /* FT_Open_Face and its siblings can be used to quickly */
2084 /* check whether the font format of a given font */
2085 /* resource is supported by FreeType. In general, if */
2086 /* the `face_index' argument is negative, the */
2087 /* function's return value is~0 if the font format is */
2088 /* recognized, or non-zero otherwise. The function */
2089 /* allocates a more or less empty face handle in */
2090 /* `*aface' (if `aface' isn't NULL); the only two */
2091 /* useful fields in this special case are */
2092 /* `face->num_faces' and `face->style_flags'. For any */
2093 /* negative value of `face_index', `face->num_faces' */
2094 /* gives the number of faces within the font file. For */
2095 /* the negative value `-(N+1)' (with `N' a 16-bit */
2096 /* value), bits 16-30 in `face->style_flags' give the */
2097 /* number of named instances in face `N' if we have a */
2098 /* GX variation font (or zero otherwise). After */
2099 /* examination, the returned @FT_Face structure should */
2100 /* be deallocated with a call to @FT_Done_Face. */
2103 /* aface :: A handle to a new face object. If `face_index' is */
2104 /* greater than or equal to zero, it must be non-NULL. */
2107 /* FreeType error code. 0~means success. */
2110 /* Unlike FreeType 1.x, this function automatically creates a glyph */
2111 /* slot for the face object that can be accessed directly through */
2112 /* `face->glyph'. */
2114 /* Each new face object created with this function also owns a */
2115 /* default @FT_Size object, accessible as `face->size'. */
2117 /* One @FT_Library instance can have multiple face objects, this is, */
2118 /* @FT_Open_Face and its siblings can be called multiple times using */
2119 /* the same `library' argument. */
2121 /* See the discussion of reference counters in the description of */
2122 /* @FT_Reference_Face. */
2124 /* To loop over all faces, use code similar to the following snippet */
2125 /* (omitting the error handling). */
2130 /* FT_Long i, num_faces; */
2133 /* error = FT_Open_Face( library, args, -1, &face ); */
2134 /* if ( error ) { ... } */
2136 /* num_faces = face->num_faces; */
2137 /* FT_Done_Face( face ); */
2139 /* for ( i = 0; i < num_faces; i++ ) */
2142 /* error = FT_Open_Face( library, args, i, &face ); */
2144 /* FT_Done_Face( face ); */
2149 /* To loop over all valid values for `face_index', use something */
2150 /* similar to the following snippet, again without error handling. */
2151 /* The code accesses all faces immediately (thus only a single call */
2152 /* of `FT_Open_Face' within the do-loop), with and without named */
2159 /* FT_Long num_faces = 0; */
2160 /* FT_Long num_instances = 0; */
2162 /* FT_Long face_idx = 0; */
2163 /* FT_Long instance_idx = 0; */
2168 /* FT_Long id = ( instance_idx << 16 ) + face_idx; */
2171 /* error = FT_Open_Face( library, args, id, &face ); */
2172 /* if ( error ) { ... } */
2174 /* num_faces = face->num_faces; */
2175 /* num_instances = face->style_flags >> 16; */
2179 /* FT_Done_Face( face ); */
2181 /* if ( instance_idx < num_instances ) */
2182 /* instance_idx++; */
2186 /* instance_idx = 0; */
2189 /* } while ( face_idx < num_faces ) */
2192 FT_EXPORT( FT_Error
)
2193 FT_Open_Face( FT_Library library
,
2194 const FT_Open_Args
* args
,
2199 /*************************************************************************/
2202 /* FT_Attach_File */
2205 /* This function calls @FT_Attach_Stream to attach a file. */
2208 /* face :: The target face object. */
2211 /* filepathname :: The pathname. */
2214 /* FreeType error code. 0~means success. */
2216 FT_EXPORT( FT_Error
)
2217 FT_Attach_File( FT_Face face
,
2218 const char* filepathname
);
2221 /*************************************************************************/
2224 /* FT_Attach_Stream */
2227 /* `Attach' data to a face object. Normally, this is used to read */
2228 /* additional information for the face object. For example, you can */
2229 /* attach an AFM file that comes with a Type~1 font to get the */
2230 /* kerning values and other metrics. */
2233 /* face :: The target face object. */
2236 /* parameters :: A pointer to @FT_Open_Args that must be filled by */
2240 /* FreeType error code. 0~means success. */
2243 /* The meaning of the `attach' (i.e., what really happens when the */
2244 /* new file is read) is not fixed by FreeType itself. It really */
2245 /* depends on the font format (and thus the font driver). */
2247 /* Client applications are expected to know what they are doing */
2248 /* when invoking this function. Most drivers simply do not implement */
2249 /* file attachments. */
2251 FT_EXPORT( FT_Error
)
2252 FT_Attach_Stream( FT_Face face
,
2253 FT_Open_Args
* parameters
);
2256 /*************************************************************************/
2259 /* FT_Reference_Face */
2262 /* A counter gets initialized to~1 at the time an @FT_Face structure */
2263 /* is created. This function increments the counter. @FT_Done_Face */
2264 /* then only destroys a face if the counter is~1, otherwise it simply */
2265 /* decrements the counter. */
2267 /* This function helps in managing life-cycles of structures that */
2268 /* reference @FT_Face objects. */
2271 /* face :: A handle to a target face object. */
2274 /* FreeType error code. 0~means success. */
2279 FT_EXPORT( FT_Error
)
2280 FT_Reference_Face( FT_Face face
);
2283 /*************************************************************************/
2289 /* Discard a given face object, as well as all of its child slots and */
2293 /* face :: A handle to a target face object. */
2296 /* FreeType error code. 0~means success. */
2299 /* See the discussion of reference counters in the description of */
2300 /* @FT_Reference_Face. */
2302 FT_EXPORT( FT_Error
)
2303 FT_Done_Face( FT_Face face
);
2306 /*************************************************************************/
2309 /* FT_Select_Size */
2312 /* Select a bitmap strike. */
2315 /* face :: A handle to a target face object. */
2318 /* strike_index :: The index of the bitmap strike in the */
2319 /* `available_sizes' field of @FT_FaceRec structure. */
2322 /* FreeType error code. 0~means success. */
2324 FT_EXPORT( FT_Error
)
2325 FT_Select_Size( FT_Face face
,
2326 FT_Int strike_index
);
2329 /*************************************************************************/
2332 /* FT_Size_Request_Type */
2335 /* An enumeration type that lists the supported size request types. */
2338 /* FT_SIZE_REQUEST_TYPE_NOMINAL :: */
2339 /* The nominal size. The `units_per_EM' field of @FT_FaceRec is */
2340 /* used to determine both scaling values. */
2342 /* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */
2343 /* The real dimension. The sum of the the `ascender' and (minus */
2344 /* of) the `descender' fields of @FT_FaceRec are used to determine */
2345 /* both scaling values. */
2347 /* FT_SIZE_REQUEST_TYPE_BBOX :: */
2348 /* The font bounding box. The width and height of the `bbox' field */
2349 /* of @FT_FaceRec are used to determine the horizontal and vertical */
2350 /* scaling value, respectively. */
2352 /* FT_SIZE_REQUEST_TYPE_CELL :: */
2353 /* The `max_advance_width' field of @FT_FaceRec is used to */
2354 /* determine the horizontal scaling value; the vertical scaling */
2355 /* value is determined the same way as */
2356 /* @FT_SIZE_REQUEST_TYPE_REAL_DIM does. Finally, both scaling */
2357 /* values are set to the smaller one. This type is useful if you */
2358 /* want to specify the font size for, say, a window of a given */
2359 /* dimension and 80x24 cells. */
2361 /* FT_SIZE_REQUEST_TYPE_SCALES :: */
2362 /* Specify the scaling values directly. */
2365 /* The above descriptions only apply to scalable formats. For bitmap */
2366 /* formats, the behaviour is up to the driver. */
2368 /* See the note section of @FT_Size_Metrics if you wonder how size */
2369 /* requesting relates to scaling values. */
2371 typedef enum FT_Size_Request_Type_
2373 FT_SIZE_REQUEST_TYPE_NOMINAL
,
2374 FT_SIZE_REQUEST_TYPE_REAL_DIM
,
2375 FT_SIZE_REQUEST_TYPE_BBOX
,
2376 FT_SIZE_REQUEST_TYPE_CELL
,
2377 FT_SIZE_REQUEST_TYPE_SCALES
,
2379 FT_SIZE_REQUEST_TYPE_MAX
2381 } FT_Size_Request_Type
;
2384 /*************************************************************************/
2387 /* FT_Size_RequestRec */
2390 /* A structure used to model a size request. */
2393 /* type :: See @FT_Size_Request_Type. */
2395 /* width :: The desired width. */
2397 /* height :: The desired height. */
2399 /* horiResolution :: The horizontal resolution. If set to zero, */
2400 /* `width' is treated as a 26.6 fractional pixel */
2403 /* vertResolution :: The vertical resolution. If set to zero, */
2404 /* `height' is treated as a 26.6 fractional pixel */
2408 /* If `width' is zero, then the horizontal scaling value is set equal */
2409 /* to the vertical scaling value, and vice versa. */
2411 typedef struct FT_Size_RequestRec_
2413 FT_Size_Request_Type type
;
2416 FT_UInt horiResolution
;
2417 FT_UInt vertResolution
;
2419 } FT_Size_RequestRec
;
2422 /*************************************************************************/
2425 /* FT_Size_Request */
2428 /* A handle to a size request structure. */
2430 typedef struct FT_Size_RequestRec_
*FT_Size_Request
;
2433 /*************************************************************************/
2436 /* FT_Request_Size */
2439 /* Resize the scale of the active @FT_Size object in a face. */
2442 /* face :: A handle to a target face object. */
2445 /* req :: A pointer to a @FT_Size_RequestRec. */
2448 /* FreeType error code. 0~means success. */
2451 /* Although drivers may select the bitmap strike matching the */
2452 /* request, you should not rely on this if you intend to select a */
2453 /* particular bitmap strike. Use @FT_Select_Size instead in that */
2456 /* The relation between the requested size and the resulting glyph */
2457 /* size is dependent entirely on how the size is defined in the */
2458 /* source face. The font designer chooses the final size of each */
2459 /* glyph relative to this size. For more information refer to */
2460 /* `http://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html' */
2462 /* Don't use this function if you are using the FreeType cache API. */
2464 FT_EXPORT( FT_Error
)
2465 FT_Request_Size( FT_Face face
,
2466 FT_Size_Request req
);
2469 /*************************************************************************/
2472 /* FT_Set_Char_Size */
2475 /* This function calls @FT_Request_Size to request the nominal size */
2479 /* face :: A handle to a target face object. */
2482 /* char_width :: The nominal width, in 26.6 fractional points. */
2484 /* char_height :: The nominal height, in 26.6 fractional points. */
2486 /* horz_resolution :: The horizontal resolution in dpi. */
2488 /* vert_resolution :: The vertical resolution in dpi. */
2491 /* FreeType error code. 0~means success. */
2494 /* If either the character width or height is zero, it is set equal */
2495 /* to the other value. */
2497 /* If either the horizontal or vertical resolution is zero, it is set */
2498 /* equal to the other value. */
2500 /* A character width or height smaller than 1pt is set to 1pt; if */
2501 /* both resolution values are zero, they are set to 72dpi. */
2503 /* Don't use this function if you are using the FreeType cache API. */
2505 FT_EXPORT( FT_Error
)
2506 FT_Set_Char_Size( FT_Face face
,
2507 FT_F26Dot6 char_width
,
2508 FT_F26Dot6 char_height
,
2509 FT_UInt horz_resolution
,
2510 FT_UInt vert_resolution
);
2513 /*************************************************************************/
2516 /* FT_Set_Pixel_Sizes */
2519 /* This function calls @FT_Request_Size to request the nominal size */
2523 /* face :: A handle to the target face object. */
2526 /* pixel_width :: The nominal width, in pixels. */
2528 /* pixel_height :: The nominal height, in pixels. */
2531 /* FreeType error code. 0~means success. */
2534 /* You should not rely on the resulting glyphs matching, or being */
2535 /* constrained, to this pixel size. Refer to @FT_Request_Size to */
2536 /* understand how requested sizes relate to actual sizes. */
2538 /* Don't use this function if you are using the FreeType cache API. */
2540 FT_EXPORT( FT_Error
)
2541 FT_Set_Pixel_Sizes( FT_Face face
,
2542 FT_UInt pixel_width
,
2543 FT_UInt pixel_height
);
2546 /*************************************************************************/
2552 /* A function used to load a single glyph into the glyph slot of a */
2556 /* face :: A handle to the target face object where the glyph */
2560 /* glyph_index :: The index of the glyph in the font file. For */
2561 /* CID-keyed fonts (either in PS or in CFF format) */
2562 /* this argument specifies the CID value. */
2564 /* load_flags :: A flag indicating what to load for this glyph. The */
2565 /* @FT_LOAD_XXX constants can be used to control the */
2566 /* glyph loading process (e.g., whether the outline */
2567 /* should be scaled, whether to load bitmaps or not, */
2568 /* whether to hint the outline, etc). */
2571 /* FreeType error code. 0~means success. */
2574 /* The loaded glyph may be transformed. See @FT_Set_Transform for */
2577 /* For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is */
2578 /* returned for invalid CID values (this is, for CID values that */
2579 /* don't have a corresponding glyph in the font). See the discussion */
2580 /* of the @FT_FACE_FLAG_CID_KEYED flag for more details. */
2582 FT_EXPORT( FT_Error
)
2583 FT_Load_Glyph( FT_Face face
,
2584 FT_UInt glyph_index
,
2585 FT_Int32 load_flags
);
2588 /*************************************************************************/
2594 /* A function used to load a single glyph into the glyph slot of a */
2595 /* face object, according to its character code. */
2598 /* face :: A handle to a target face object where the glyph */
2602 /* char_code :: The glyph's character code, according to the */
2603 /* current charmap used in the face. */
2605 /* load_flags :: A flag indicating what to load for this glyph. The */
2606 /* @FT_LOAD_XXX constants can be used to control the */
2607 /* glyph loading process (e.g., whether the outline */
2608 /* should be scaled, whether to load bitmaps or not, */
2609 /* whether to hint the outline, etc). */
2612 /* FreeType error code. 0~means success. */
2615 /* This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph. */
2617 FT_EXPORT( FT_Error
)
2618 FT_Load_Char( FT_Face face
,
2620 FT_Int32 load_flags
);
2623 /*************************************************************************
2629 * A list of bit field constants used with @FT_Load_Glyph to indicate
2630 * what kind of operations to perform during glyph loading.
2633 * FT_LOAD_DEFAULT ::
2634 * Corresponding to~0, this value is used as the default glyph load
2635 * operation. In this case, the following happens:
2637 * 1. FreeType looks for a bitmap for the glyph corresponding to the
2638 * face's current size. If one is found, the function returns.
2639 * The bitmap data can be accessed from the glyph slot (see note
2642 * 2. If no embedded bitmap is searched or found, FreeType looks for a
2643 * scalable outline. If one is found, it is loaded from the font
2644 * file, scaled to device pixels, then `hinted' to the pixel grid
2645 * in order to optimize it. The outline data can be accessed from
2646 * the glyph slot (see note below).
2648 * Note that by default, the glyph loader doesn't render outlines into
2649 * bitmaps. The following flags are used to modify this default
2650 * behaviour to more specific and useful cases.
2652 * FT_LOAD_NO_SCALE ::
2653 * Don't scale the loaded outline glyph but keep it in font units.
2655 * This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and
2656 * unsets @FT_LOAD_RENDER.
2658 * If the font is `tricky' (see @FT_FACE_FLAG_TRICKY for more), using
2659 * FT_LOAD_NO_SCALE usually yields meaningless outlines because the
2660 * subglyphs must be scaled and positioned with hinting instructions.
2661 * This can be solved by loading the font without FT_LOAD_NO_SCALE and
2662 * setting the character size to `font->units_per_EM'.
2664 * FT_LOAD_NO_HINTING ::
2665 * Disable hinting. This generally generates `blurrier' bitmap glyphs
2666 * when the glyph are rendered in any of the anti-aliased modes. See
2667 * also the note below.
2669 * This flag is implied by @FT_LOAD_NO_SCALE.
2672 * Call @FT_Render_Glyph after the glyph is loaded. By default, the
2673 * glyph is rendered in @FT_RENDER_MODE_NORMAL mode. This can be
2674 * overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME.
2676 * This flag is unset by @FT_LOAD_NO_SCALE.
2678 * FT_LOAD_NO_BITMAP ::
2679 * Ignore bitmap strikes when loading. Bitmap-only fonts ignore this
2682 * @FT_LOAD_NO_SCALE always sets this flag.
2684 * FT_LOAD_VERTICAL_LAYOUT ::
2685 * Load the glyph for vertical text layout. In particular, the
2686 * `advance' value in the @FT_GlyphSlotRec structure is set to the
2687 * `vertAdvance' value of the `metrics' field.
2689 * In case @FT_HAS_VERTICAL doesn't return true, you shouldn't use
2690 * this flag currently. Reason is that in this case vertical metrics
2691 * get synthesized, and those values are not always consistent across
2692 * various font formats.
2694 * FT_LOAD_FORCE_AUTOHINT ::
2695 * Indicates that the auto-hinter is preferred over the font's native
2696 * hinter. See also the note below.
2698 * FT_LOAD_PEDANTIC ::
2699 * Indicates that the font driver should perform pedantic verifications
2700 * during glyph loading. This is mostly used to detect broken glyphs
2701 * in fonts. By default, FreeType tries to handle broken fonts also.
2703 * In particular, errors from the TrueType bytecode engine are not
2704 * passed to the application if this flag is not set; this might
2705 * result in partially hinted or distorted glyphs in case a glyph's
2706 * bytecode is buggy.
2708 * FT_LOAD_NO_RECURSE ::
2709 * Indicate that the font driver should not load composite glyphs
2710 * recursively. Instead, it should set the `num_subglyph' and
2711 * `subglyphs' values of the glyph slot accordingly, and set
2712 * `glyph->format' to @FT_GLYPH_FORMAT_COMPOSITE. The description of
2713 * subglyphs can then be accessed with @FT_Get_SubGlyph_Info.
2715 * This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM.
2717 * FT_LOAD_IGNORE_TRANSFORM ::
2718 * Indicates that the transform matrix set by @FT_Set_Transform should
2721 * FT_LOAD_MONOCHROME ::
2722 * This flag is used with @FT_LOAD_RENDER to indicate that you want to
2723 * render an outline glyph to a 1-bit monochrome bitmap glyph, with
2724 * 8~pixels packed into each byte of the bitmap data.
2726 * Note that this has no effect on the hinting algorithm used. You
2727 * should rather use @FT_LOAD_TARGET_MONO so that the
2728 * monochrome-optimized hinting algorithm is used.
2730 * FT_LOAD_LINEAR_DESIGN ::
2731 * Indicates that the `linearHoriAdvance' and `linearVertAdvance'
2732 * fields of @FT_GlyphSlotRec should be kept in font units. See
2733 * @FT_GlyphSlotRec for details.
2735 * FT_LOAD_NO_AUTOHINT ::
2736 * Disable auto-hinter. See also the note below.
2739 * This flag is used to request loading of color embedded-bitmap
2740 * images. The resulting color bitmaps, if available, will have the
2741 * @FT_PIXEL_MODE_BGRA format. When the flag is not used and color
2742 * bitmaps are found, they will be converted to 256-level gray
2743 * bitmaps transparently. Those bitmaps will be in the
2744 * @FT_PIXEL_MODE_GRAY format.
2746 * FT_LOAD_COMPUTE_METRICS ::
2747 * This flag sets computing glyph metrics without the use of bundled
2748 * metrics tables (for example, the `hdmx' table in TrueType fonts).
2749 * Well-behaving fonts have optimized bundled metrics and these should
2750 * be used. This flag is mainly used by font validating or font
2751 * editing applications, which need to ignore, verify, or edit those
2754 * Currently, this flag is only implemented for TrueType fonts.
2756 * FT_LOAD_CROP_BITMAP ::
2757 * Ignored. Deprecated.
2759 * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ::
2760 * Ignored. Deprecated.
2763 * By default, hinting is enabled and the font's native hinter (see
2764 * @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can
2765 * disable hinting by setting @FT_LOAD_NO_HINTING or change the
2766 * precedence by setting @FT_LOAD_FORCE_AUTOHINT. You can also set
2767 * @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be
2770 * See the description of @FT_FACE_FLAG_TRICKY for a special exception
2771 * (affecting only a handful of Asian fonts).
2773 * Besides deciding which hinter to use, you can also decide which
2774 * hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details.
2776 * Note that the auto-hinter needs a valid Unicode cmap (either a native
2777 * one or synthesized by FreeType) for producing correct results. If a
2778 * font provides an incorrect mapping (for example, assigning the
2779 * character code U+005A, LATIN CAPITAL LETTER Z, to a glyph depicting a
2780 * mathematical integral sign), the auto-hinter might produce useless
2784 #define FT_LOAD_DEFAULT 0x0
2785 #define FT_LOAD_NO_SCALE ( 1L << 0 )
2786 #define FT_LOAD_NO_HINTING ( 1L << 1 )
2787 #define FT_LOAD_RENDER ( 1L << 2 )
2788 #define FT_LOAD_NO_BITMAP ( 1L << 3 )
2789 #define FT_LOAD_VERTICAL_LAYOUT ( 1L << 4 )
2790 #define FT_LOAD_FORCE_AUTOHINT ( 1L << 5 )
2791 #define FT_LOAD_CROP_BITMAP ( 1L << 6 )
2792 #define FT_LOAD_PEDANTIC ( 1L << 7 )
2793 #define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ( 1L << 9 )
2794 #define FT_LOAD_NO_RECURSE ( 1L << 10 )
2795 #define FT_LOAD_IGNORE_TRANSFORM ( 1L << 11 )
2796 #define FT_LOAD_MONOCHROME ( 1L << 12 )
2797 #define FT_LOAD_LINEAR_DESIGN ( 1L << 13 )
2798 #define FT_LOAD_NO_AUTOHINT ( 1L << 15 )
2799 /* Bits 16..19 are used by `FT_LOAD_TARGET_' */
2800 #define FT_LOAD_COLOR ( 1L << 20 )
2801 #define FT_LOAD_COMPUTE_METRICS ( 1L << 21 )
2805 /* used internally only by certain font drivers! */
2806 #define FT_LOAD_ADVANCE_ONLY ( 1L << 8 )
2807 #define FT_LOAD_SBITS_ONLY ( 1L << 14 )
2810 /**************************************************************************
2813 * FT_LOAD_TARGET_XXX
2816 * A list of values that are used to select a specific hinting algorithm
2817 * to use by the hinter. You should OR one of these values to your
2818 * `load_flags' when calling @FT_Load_Glyph.
2820 * Note that font's native hinters may ignore the hinting algorithm you
2821 * have specified (e.g., the TrueType bytecode interpreter). You can set
2822 * @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used.
2824 * Also note that @FT_LOAD_TARGET_LIGHT is an exception, in that it
2825 * always implies @FT_LOAD_FORCE_AUTOHINT.
2828 * FT_LOAD_TARGET_NORMAL ::
2829 * This corresponds to the default hinting algorithm, optimized for
2830 * standard gray-level rendering. For monochrome output, use
2831 * @FT_LOAD_TARGET_MONO instead.
2833 * FT_LOAD_TARGET_LIGHT ::
2834 * A lighter hinting algorithm for non-monochrome modes. Many
2835 * generated glyphs are more fuzzy but better resemble its original
2836 * shape. A bit like rendering on Mac OS~X.
2838 * As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT.
2840 * FT_LOAD_TARGET_MONO ::
2841 * Strong hinting algorithm that should only be used for monochrome
2842 * output. The result is probably unpleasant if the glyph is rendered
2843 * in non-monochrome modes.
2845 * FT_LOAD_TARGET_LCD ::
2846 * A variant of @FT_LOAD_TARGET_NORMAL optimized for horizontally
2847 * decimated LCD displays.
2849 * FT_LOAD_TARGET_LCD_V ::
2850 * A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically
2851 * decimated LCD displays.
2854 * You should use only _one_ of the FT_LOAD_TARGET_XXX values in your
2855 * `load_flags'. They can't be ORed.
2857 * If @FT_LOAD_RENDER is also set, the glyph is rendered in the
2858 * corresponding mode (i.e., the mode that matches the used algorithm
2859 * best). An exeption is FT_LOAD_TARGET_MONO since it implies
2860 * @FT_LOAD_MONOCHROME.
2862 * You can use a hinting algorithm that doesn't correspond to the same
2863 * rendering mode. As an example, it is possible to use the `light'
2864 * hinting algorithm and have the results rendered in horizontal LCD
2865 * pixel mode, with code like
2868 * FT_Load_Glyph( face, glyph_index,
2869 * load_flags | FT_LOAD_TARGET_LIGHT );
2871 * FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD );
2875 #define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 )
2877 #define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
2878 #define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT )
2879 #define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO )
2880 #define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
2881 #define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
2884 /**************************************************************************
2887 * FT_LOAD_TARGET_MODE
2890 * Return the @FT_Render_Mode corresponding to a given
2891 * @FT_LOAD_TARGET_XXX value.
2894 #define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
2897 /*************************************************************************/
2900 /* FT_Set_Transform */
2903 /* A function used to set the transformation that is applied to glyph */
2904 /* images when they are loaded into a glyph slot through */
2905 /* @FT_Load_Glyph. */
2908 /* face :: A handle to the source face object. */
2911 /* matrix :: A pointer to the transformation's 2x2 matrix. Use~0 for */
2912 /* the identity matrix. */
2913 /* delta :: A pointer to the translation vector. Use~0 for the null */
2917 /* The transformation is only applied to scalable image formats after */
2918 /* the glyph has been loaded. It means that hinting is unaltered by */
2919 /* the transformation and is performed on the character size given in */
2920 /* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */
2922 /* Note that this also transforms the `face.glyph.advance' field, but */
2923 /* *not* the values in `face.glyph.metrics'. */
2926 FT_Set_Transform( FT_Face face
,
2931 /*************************************************************************/
2934 /* FT_Render_Mode */
2937 /* An enumeration type that lists the render modes supported by */
2938 /* FreeType~2. Each mode corresponds to a specific type of scanline */
2939 /* conversion performed on the outline. */
2941 /* For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode' */
2942 /* field in the @FT_GlyphSlotRec structure gives the format of the */
2943 /* returned bitmap. */
2945 /* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity. */
2948 /* FT_RENDER_MODE_NORMAL :: */
2949 /* This is the default render mode; it corresponds to 8-bit */
2950 /* anti-aliased bitmaps. */
2952 /* FT_RENDER_MODE_LIGHT :: */
2953 /* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */
2954 /* defined as a separate value because render modes are also used */
2955 /* indirectly to define hinting algorithm selectors. See */
2956 /* @FT_LOAD_TARGET_XXX for details. */
2958 /* FT_RENDER_MODE_MONO :: */
2959 /* This mode corresponds to 1-bit bitmaps (with 2~levels of */
2962 /* FT_RENDER_MODE_LCD :: */
2963 /* This mode corresponds to horizontal RGB and BGR sub-pixel */
2964 /* displays like LCD screens. It produces 8-bit bitmaps that are */
2965 /* 3~times the width of the original glyph outline in pixels, and */
2966 /* which use the @FT_PIXEL_MODE_LCD mode. */
2968 /* FT_RENDER_MODE_LCD_V :: */
2969 /* This mode corresponds to vertical RGB and BGR sub-pixel displays */
2970 /* (like PDA screens, rotated LCD displays, etc.). It produces */
2971 /* 8-bit bitmaps that are 3~times the height of the original */
2972 /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */
2975 /* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph can be */
2976 /* filtered to reduce color-fringes by using @FT_Library_SetLcdFilter */
2977 /* (not active in the default builds). It is up to the caller to */
2978 /* either call @FT_Library_SetLcdFilter (if available) or do the */
2979 /* filtering itself. */
2981 /* The selected render mode only affects vector glyphs of a font. */
2982 /* Embedded bitmaps often have a different pixel mode like */
2983 /* @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform */
2984 /* them into 8-bit pixmaps. */
2986 typedef enum FT_Render_Mode_
2988 FT_RENDER_MODE_NORMAL
= 0,
2989 FT_RENDER_MODE_LIGHT
,
2990 FT_RENDER_MODE_MONO
,
2992 FT_RENDER_MODE_LCD_V
,
2999 /* these constants are deprecated; use the corresponding */
3000 /* `FT_Render_Mode' values instead */
3001 #define ft_render_mode_normal FT_RENDER_MODE_NORMAL
3002 #define ft_render_mode_mono FT_RENDER_MODE_MONO
3005 /*************************************************************************/
3008 /* FT_Render_Glyph */
3011 /* Convert a given glyph image to a bitmap. It does so by inspecting */
3012 /* the glyph image format, finding the relevant renderer, and */
3016 /* slot :: A handle to the glyph slot containing the image to */
3020 /* render_mode :: This is the render mode used to render the glyph */
3021 /* image into a bitmap. See @FT_Render_Mode for a */
3022 /* list of possible values. */
3025 /* FreeType error code. 0~means success. */
3028 /* To get meaningful results, font scaling values must be set with */
3029 /* functions like @FT_Set_Char_Size before calling FT_Render_Glyph. */
3031 FT_EXPORT( FT_Error
)
3032 FT_Render_Glyph( FT_GlyphSlot slot
,
3033 FT_Render_Mode render_mode
);
3036 /*************************************************************************/
3039 /* FT_Kerning_Mode */
3042 /* An enumeration used to specify which kerning values to return in */
3043 /* @FT_Get_Kerning. */
3046 /* FT_KERNING_DEFAULT :: Return grid-fitted kerning distances in */
3047 /* pixels (value is~0). Whether they are */
3048 /* scaled depends on @FT_LOAD_NO_SCALE. */
3050 /* FT_KERNING_UNFITTED :: Return un-grid-fitted kerning distances in */
3051 /* 26.6 fractional pixels. Whether they are */
3052 /* scaled depends on @FT_LOAD_NO_SCALE. */
3054 /* FT_KERNING_UNSCALED :: Return the kerning vector in original font */
3058 /* FT_KERNING_DEFAULT returns full pixel values; it also makes */
3059 /* FreeType heuristically scale down kerning distances at small ppem */
3060 /* values so that they don't become too big. */
3062 typedef enum FT_Kerning_Mode_
3064 FT_KERNING_DEFAULT
= 0,
3065 FT_KERNING_UNFITTED
,
3071 /* these constants are deprecated; use the corresponding */
3072 /* `FT_Kerning_Mode' values instead */
3073 #define ft_kerning_default FT_KERNING_DEFAULT
3074 #define ft_kerning_unfitted FT_KERNING_UNFITTED
3075 #define ft_kerning_unscaled FT_KERNING_UNSCALED
3078 /*************************************************************************/
3081 /* FT_Get_Kerning */
3084 /* Return the kerning vector between two glyphs of a same face. */
3087 /* face :: A handle to a source face object. */
3089 /* left_glyph :: The index of the left glyph in the kern pair. */
3091 /* right_glyph :: The index of the right glyph in the kern pair. */
3093 /* kern_mode :: See @FT_Kerning_Mode for more information. */
3094 /* Determines the scale and dimension of the returned */
3095 /* kerning vector. */
3098 /* akerning :: The kerning vector. This is either in font units, */
3099 /* fractional pixels (26.6 format), or pixels for */
3100 /* scalable formats, and in pixels for fixed-sizes */
3104 /* FreeType error code. 0~means success. */
3107 /* Only horizontal layouts (left-to-right & right-to-left) are */
3108 /* supported by this method. Other layouts, or more sophisticated */
3109 /* kernings, are out of the scope of this API function -- they can be */
3110 /* implemented through format-specific interfaces. */
3112 FT_EXPORT( FT_Error
)
3113 FT_Get_Kerning( FT_Face face
,
3115 FT_UInt right_glyph
,
3117 FT_Vector
*akerning
);
3120 /*************************************************************************/
3123 /* FT_Get_Track_Kerning */
3126 /* Return the track kerning for a given face object at a given size. */
3129 /* face :: A handle to a source face object. */
3131 /* point_size :: The point size in 16.16 fractional points. */
3133 /* degree :: The degree of tightness. Increasingly negative */
3134 /* values represent tighter track kerning, while */
3135 /* increasingly positive values represent looser track */
3136 /* kerning. Value zero means no track kerning. */
3139 /* akerning :: The kerning in 16.16 fractional points, to be */
3140 /* uniformly applied between all glyphs. */
3143 /* FreeType error code. 0~means success. */
3146 /* Currently, only the Type~1 font driver supports track kerning, */
3147 /* using data from AFM files (if attached with @FT_Attach_File or */
3148 /* @FT_Attach_Stream). */
3150 /* Only very few AFM files come with track kerning data; please refer */
3151 /* to the Adobe's AFM specification for more details. */
3153 FT_EXPORT( FT_Error
)
3154 FT_Get_Track_Kerning( FT_Face face
,
3155 FT_Fixed point_size
,
3157 FT_Fixed
* akerning
);
3160 /*************************************************************************/
3163 /* FT_Get_Glyph_Name */
3166 /* Retrieve the ASCII name of a given glyph in a face. This only */
3167 /* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1. */
3170 /* face :: A handle to a source face object. */
3172 /* glyph_index :: The glyph index. */
3174 /* buffer_max :: The maximum number of bytes available in the */
3178 /* buffer :: A pointer to a target buffer where the name is */
3182 /* FreeType error code. 0~means success. */
3185 /* An error is returned if the face doesn't provide glyph names or if */
3186 /* the glyph index is invalid. In all cases of failure, the first */
3187 /* byte of `buffer' is set to~0 to indicate an empty name. */
3189 /* The glyph name is truncated to fit within the buffer if it is too */
3190 /* long. The returned string is always zero-terminated. */
3192 /* Be aware that FreeType reorders glyph indices internally so that */
3193 /* glyph index~0 always corresponds to the `missing glyph' (called */
3196 /* This function always returns an error if the config macro */
3197 /* `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is not defined in `ftoptions.h'. */
3199 FT_EXPORT( FT_Error
)
3200 FT_Get_Glyph_Name( FT_Face face
,
3201 FT_UInt glyph_index
,
3203 FT_UInt buffer_max
);
3206 /*************************************************************************/
3209 /* FT_Get_Postscript_Name */
3212 /* Retrieve the ASCII PostScript name of a given face, if available. */
3213 /* This only works with PostScript and TrueType fonts. */
3216 /* face :: A handle to the source face object. */
3219 /* A pointer to the face's PostScript name. NULL if unavailable. */
3222 /* The returned pointer is owned by the face and is destroyed with */
3225 FT_EXPORT( const char* )
3226 FT_Get_Postscript_Name( FT_Face face
);
3229 /*************************************************************************/
3232 /* FT_Select_Charmap */
3235 /* Select a given charmap by its encoding tag (as listed in */
3236 /* `freetype.h'). */
3239 /* face :: A handle to the source face object. */
3242 /* encoding :: A handle to the selected encoding. */
3245 /* FreeType error code. 0~means success. */
3248 /* This function returns an error if no charmap in the face */
3249 /* corresponds to the encoding queried here. */
3251 /* Because many fonts contain more than a single cmap for Unicode */
3252 /* encoding, this function has some special code to select the one */
3253 /* that covers Unicode best (`best' in the sense that a UCS-4 cmap is */
3254 /* preferred to a UCS-2 cmap). It is thus preferable to */
3255 /* @FT_Set_Charmap in this case. */
3257 FT_EXPORT( FT_Error
)
3258 FT_Select_Charmap( FT_Face face
,
3259 FT_Encoding encoding
);
3262 /*************************************************************************/
3265 /* FT_Set_Charmap */
3268 /* Select a given charmap for character code to glyph index mapping. */
3271 /* face :: A handle to the source face object. */
3274 /* charmap :: A handle to the selected charmap. */
3277 /* FreeType error code. 0~means success. */
3280 /* This function returns an error if the charmap is not part of */
3281 /* the face (i.e., if it is not listed in the `face->charmaps' */
3284 /* It also fails if a type~14 charmap is selected. */
3286 FT_EXPORT( FT_Error
)
3287 FT_Set_Charmap( FT_Face face
,
3288 FT_CharMap charmap
);
3291 /*************************************************************************
3294 * FT_Get_Charmap_Index
3297 * Retrieve index of a given charmap.
3301 * A handle to a charmap.
3304 * The index into the array of character maps within the face to which
3305 * `charmap' belongs. If an error occurs, -1 is returned.
3309 FT_Get_Charmap_Index( FT_CharMap charmap
);
3312 /*************************************************************************/
3315 /* FT_Get_Char_Index */
3318 /* Return the glyph index of a given character code. This function */
3319 /* uses a charmap object to do the mapping. */
3322 /* face :: A handle to the source face object. */
3324 /* charcode :: The character code. */
3327 /* The glyph index. 0~means `undefined character code'. */
3330 /* If you use FreeType to manipulate the contents of font files */
3331 /* directly, be aware that the glyph index returned by this function */
3332 /* doesn't always correspond to the internal indices used within the */
3333 /* file. This is done to ensure that value~0 always corresponds to */
3334 /* the `missing glyph'. If the first glyph is not named `.notdef', */
3335 /* then for Type~1 and Type~42 fonts, `.notdef' will be moved into */
3336 /* the glyph ID~0 position, and whatever was there will be moved to */
3337 /* the position `.notdef' had. For Type~1 fonts, if there is no */
3338 /* `.notdef' glyph at all, then one will be created at index~0 and */
3339 /* whatever was there will be moved to the last index -- Type~42 */
3340 /* fonts are considered invalid under this condition. */
3342 FT_EXPORT( FT_UInt
)
3343 FT_Get_Char_Index( FT_Face face
,
3344 FT_ULong charcode
);
3347 /*************************************************************************/
3350 /* FT_Get_First_Char */
3353 /* This function is used to return the first character code in the */
3354 /* current charmap of a given face. It also returns the */
3355 /* corresponding glyph index. */
3358 /* face :: A handle to the source face object. */
3361 /* agindex :: Glyph index of first character code. 0~if charmap is */
3365 /* The charmap's first character code. */
3368 /* You should use this function with @FT_Get_Next_Char to be able to */
3369 /* parse all character codes available in a given charmap. The code */
3370 /* should look like this: */
3373 /* FT_ULong charcode; */
3374 /* FT_UInt gindex; */
3377 /* charcode = FT_Get_First_Char( face, &gindex ); */
3378 /* while ( gindex != 0 ) */
3380 /* ... do something with (charcode,gindex) pair ... */
3382 /* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */
3386 /* Be aware that character codes can have values up to 0xFFFFFFFF; */
3387 /* this might happen for non-Unicode or malformed cmaps. However, */
3388 /* even with regular Unicode encoding, so-called `last resort fonts' */
3389 /* (using SFNT cmap format 13, see function @FT_Get_CMap_Format) */
3390 /* normally have entries for all Unicode characters up to 0x1FFFFF, */
3391 /* which can cause *a lot* of iterations. */
3393 /* Note that `*agindex' is set to~0 if the charmap is empty. The */
3394 /* result itself can be~0 in two cases: if the charmap is empty or */
3395 /* if the value~0 is the first valid character code. */
3397 FT_EXPORT( FT_ULong
)
3398 FT_Get_First_Char( FT_Face face
,
3402 /*************************************************************************/
3405 /* FT_Get_Next_Char */
3408 /* This function is used to return the next character code in the */
3409 /* current charmap of a given face following the value `char_code', */
3410 /* as well as the corresponding glyph index. */
3413 /* face :: A handle to the source face object. */
3414 /* char_code :: The starting character code. */
3417 /* agindex :: Glyph index of next character code. 0~if charmap */
3421 /* The charmap's next character code. */
3424 /* You should use this function with @FT_Get_First_Char to walk */
3425 /* over all character codes available in a given charmap. See the */
3426 /* note for this function for a simple code example. */
3428 /* Note that `*agindex' is set to~0 when there are no more codes in */
3431 FT_EXPORT( FT_ULong
)
3432 FT_Get_Next_Char( FT_Face face
,
3437 /*************************************************************************/
3440 /* FT_Get_Name_Index */
3443 /* Return the glyph index of a given glyph name. This function uses */
3444 /* driver specific objects to do the translation. */
3447 /* face :: A handle to the source face object. */
3449 /* glyph_name :: The glyph name. */
3452 /* The glyph index. 0~means `undefined character code'. */
3454 FT_EXPORT( FT_UInt
)
3455 FT_Get_Name_Index( FT_Face face
,
3456 FT_String
* glyph_name
);
3459 /*************************************************************************
3462 * FT_SUBGLYPH_FLAG_XXX
3465 * A list of constants used to describe subglyphs. Please refer to the
3466 * TrueType specification for the meaning of the various flags.
3469 * FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ::
3470 * FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ::
3471 * FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID ::
3472 * FT_SUBGLYPH_FLAG_SCALE ::
3473 * FT_SUBGLYPH_FLAG_XY_SCALE ::
3474 * FT_SUBGLYPH_FLAG_2X2 ::
3475 * FT_SUBGLYPH_FLAG_USE_MY_METRICS ::
3478 #define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1
3479 #define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2
3480 #define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4
3481 #define FT_SUBGLYPH_FLAG_SCALE 8
3482 #define FT_SUBGLYPH_FLAG_XY_SCALE 0x40
3483 #define FT_SUBGLYPH_FLAG_2X2 0x80
3484 #define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
3487 /*************************************************************************
3490 * FT_Get_SubGlyph_Info
3493 * Retrieve a description of a given subglyph. Only use it if
3494 * `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is
3495 * returned otherwise.
3499 * The source glyph slot.
3502 * The index of the subglyph. Must be less than
3503 * `glyph->num_subglyphs'.
3507 * The glyph index of the subglyph.
3510 * The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX.
3513 * The subglyph's first argument (if any).
3516 * The subglyph's second argument (if any).
3519 * The subglyph transformation (if any).
3522 * FreeType error code. 0~means success.
3525 * The values of `*p_arg1', `*p_arg2', and `*p_transform' must be
3526 * interpreted depending on the flags returned in `*p_flags'. See the
3527 * TrueType specification for details.
3530 FT_EXPORT( FT_Error
)
3531 FT_Get_SubGlyph_Info( FT_GlyphSlot glyph
,
3537 FT_Matrix
*p_transform
);
3540 /*************************************************************************/
3546 /* A list of bit flags used in the `fsType' field of the OS/2 table */
3547 /* in a TrueType or OpenType font and the `FSType' entry in a */
3548 /* PostScript font. These bit flags are returned by */
3549 /* @FT_Get_FSType_Flags; they inform client applications of embedding */
3550 /* and subsetting restrictions associated with a font. */
3553 /* http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/FontPolicies.pdf */
3554 /* for more details. */
3557 /* FT_FSTYPE_INSTALLABLE_EMBEDDING :: */
3558 /* Fonts with no fsType bit set may be embedded and permanently */
3559 /* installed on the remote system by an application. */
3561 /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING :: */
3562 /* Fonts that have only this bit set must not be modified, embedded */
3563 /* or exchanged in any manner without first obtaining permission of */
3564 /* the font software copyright owner. */
3566 /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING :: */
3567 /* If this bit is set, the font may be embedded and temporarily */
3568 /* loaded on the remote system. Documents containing Preview & */
3569 /* Print fonts must be opened `read-only'; no edits can be applied */
3570 /* to the document. */
3572 /* FT_FSTYPE_EDITABLE_EMBEDDING :: */
3573 /* If this bit is set, the font may be embedded but must only be */
3574 /* installed temporarily on other systems. In contrast to Preview */
3575 /* & Print fonts, documents containing editable fonts may be opened */
3576 /* for reading, editing is permitted, and changes may be saved. */
3578 /* FT_FSTYPE_NO_SUBSETTING :: */
3579 /* If this bit is set, the font may not be subsetted prior to */
3582 /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY :: */
3583 /* If this bit is set, only bitmaps contained in the font may be */
3584 /* embedded; no outline data may be embedded. If there are no */
3585 /* bitmaps available in the font, then the font is unembeddable. */
3588 /* The flags are ORed together, thus more than a single value can be */
3591 /* While the fsType flags can indicate that a font may be embedded, a */
3592 /* license with the font vendor may be separately required to use the */
3593 /* font in this way. */
3595 #define FT_FSTYPE_INSTALLABLE_EMBEDDING 0x0000
3596 #define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING 0x0002
3597 #define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING 0x0004
3598 #define FT_FSTYPE_EDITABLE_EMBEDDING 0x0008
3599 #define FT_FSTYPE_NO_SUBSETTING 0x0100
3600 #define FT_FSTYPE_BITMAP_EMBEDDING_ONLY 0x0200
3603 /*************************************************************************/
3606 /* FT_Get_FSType_Flags */
3609 /* Return the fsType flags for a font. */
3612 /* face :: A handle to the source face object. */
3615 /* The fsType flags, @FT_FSTYPE_XXX. */
3618 /* Use this function rather than directly reading the `fs_type' field */
3619 /* in the @PS_FontInfoRec structure, which is only guaranteed to */
3620 /* return the correct results for Type~1 fonts. */
3625 FT_EXPORT( FT_UShort
)
3626 FT_Get_FSType_Flags( FT_Face face
);
3629 /*************************************************************************/
3632 /* glyph_variants */
3635 /* Glyph Variants */
3638 /* The FreeType~2 interface to Unicode Ideographic Variation */
3639 /* Sequences (IVS), using the SFNT cmap format~14. */
3642 /* Many CJK characters have variant forms. They are a sort of grey */
3643 /* area somewhere between being totally irrelevant and semantically */
3644 /* distinct; for this reason, the Unicode consortium decided to */
3645 /* introduce Ideographic Variation Sequences (IVS), consisting of a */
3646 /* Unicode base character and one of 240 variant selectors */
3647 /* (U+E0100-U+E01EF), instead of further extending the already huge */
3648 /* code range for CJK characters. */
3650 /* An IVS is registered and unique; for further details please refer */
3651 /* to Unicode Technical Standard #37, the Ideographic Variation */
3654 /* http://www.unicode.org/reports/tr37/ */
3656 /* To date (November 2014), the character with the most variants is */
3657 /* U+9089, having 32 such IVS. */
3659 /* Adobe and MS decided to support IVS with a new cmap subtable */
3660 /* (format~14). It is an odd subtable because it is not a mapping of */
3661 /* input code points to glyphs, but contains lists of all variants */
3662 /* supported by the font. */
3664 /* A variant may be either `default' or `non-default'. A default */
3665 /* variant is the one you will get for that code point if you look it */
3666 /* up in the standard Unicode cmap. A non-default variant is a */
3667 /* different glyph. */
3669 /*************************************************************************/
3672 /*************************************************************************/
3675 /* FT_Face_GetCharVariantIndex */
3678 /* Return the glyph index of a given character code as modified by */
3679 /* the variation selector. */
3683 /* A handle to the source face object. */
3686 /* The character code point in Unicode. */
3688 /* variantSelector :: */
3689 /* The Unicode code point of the variation selector. */
3692 /* The glyph index. 0~means either `undefined character code', or */
3693 /* `undefined selector code', or `no variation selector cmap */
3694 /* subtable', or `current CharMap is not Unicode'. */
3697 /* If you use FreeType to manipulate the contents of font files */
3698 /* directly, be aware that the glyph index returned by this function */
3699 /* doesn't always correspond to the internal indices used within */
3700 /* the file. This is done to ensure that value~0 always corresponds */
3701 /* to the `missing glyph'. */
3703 /* This function is only meaningful if */
3704 /* a) the font has a variation selector cmap sub table, */
3706 /* b) the current charmap has a Unicode encoding. */
3711 FT_EXPORT( FT_UInt
)
3712 FT_Face_GetCharVariantIndex( FT_Face face
,
3714 FT_ULong variantSelector
);
3717 /*************************************************************************/
3720 /* FT_Face_GetCharVariantIsDefault */
3723 /* Check whether this variant of this Unicode character is the one to */
3724 /* be found in the `cmap'. */
3728 /* A handle to the source face object. */
3731 /* The character codepoint in Unicode. */
3733 /* variantSelector :: */
3734 /* The Unicode codepoint of the variation selector. */
3737 /* 1~if found in the standard (Unicode) cmap, 0~if found in the */
3738 /* variation selector cmap, or -1 if it is not a variant. */
3741 /* This function is only meaningful if the font has a variation */
3742 /* selector cmap subtable. */
3748 FT_Face_GetCharVariantIsDefault( FT_Face face
,
3750 FT_ULong variantSelector
);
3753 /*************************************************************************/
3756 /* FT_Face_GetVariantSelectors */
3759 /* Return a zero-terminated list of Unicode variant selectors found */
3764 /* A handle to the source face object. */
3767 /* A pointer to an array of selector code points, or NULL if there is */
3768 /* no valid variant selector cmap subtable. */
3771 /* The last item in the array is~0; the array is owned by the */
3772 /* @FT_Face object but can be overwritten or released on the next */
3773 /* call to a FreeType function. */
3778 FT_EXPORT( FT_UInt32
* )
3779 FT_Face_GetVariantSelectors( FT_Face face
);
3782 /*************************************************************************/
3785 /* FT_Face_GetVariantsOfChar */
3788 /* Return a zero-terminated list of Unicode variant selectors found */
3789 /* for the specified character code. */
3793 /* A handle to the source face object. */
3796 /* The character codepoint in Unicode. */
3799 /* A pointer to an array of variant selector code points that are */
3800 /* active for the given character, or NULL if the corresponding list */
3804 /* The last item in the array is~0; the array is owned by the */
3805 /* @FT_Face object but can be overwritten or released on the next */
3806 /* call to a FreeType function. */
3811 FT_EXPORT( FT_UInt32
* )
3812 FT_Face_GetVariantsOfChar( FT_Face face
,
3813 FT_ULong charcode
);
3816 /*************************************************************************/
3819 /* FT_Face_GetCharsOfVariant */
3822 /* Return a zero-terminated list of Unicode character codes found for */
3823 /* the specified variant selector. */
3827 /* A handle to the source face object. */
3829 /* variantSelector :: */
3830 /* The variant selector code point in Unicode. */
3833 /* A list of all the code points that are specified by this selector */
3834 /* (both default and non-default codes are returned) or NULL if there */
3835 /* is no valid cmap or the variant selector is invalid. */
3838 /* The last item in the array is~0; the array is owned by the */
3839 /* @FT_Face object but can be overwritten or released on the next */
3840 /* call to a FreeType function. */
3845 FT_EXPORT( FT_UInt32
* )
3846 FT_Face_GetCharsOfVariant( FT_Face face
,
3847 FT_ULong variantSelector
);
3850 /*************************************************************************/
3859 /* Crunching fixed numbers and vectors. */
3862 /* This section contains various functions used to perform */
3863 /* computations on 16.16 fixed-float numbers or 2d vectors. */
3872 /* FT_Vector_Transform */
3873 /* FT_Matrix_Multiply */
3874 /* FT_Matrix_Invert */
3876 /*************************************************************************/
3879 /*************************************************************************/
3885 /* A very simple function used to perform the computation `(a*b)/c' */
3886 /* with maximum accuracy (it uses a 64-bit intermediate integer */
3887 /* whenever necessary). */
3889 /* This function isn't necessarily as fast as some processor specific */
3890 /* operations, but is at least completely portable. */
3893 /* a :: The first multiplier. */
3894 /* b :: The second multiplier. */
3895 /* c :: The divisor. */
3898 /* The result of `(a*b)/c'. This function never traps when trying to */
3899 /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
3900 /* on the signs of `a' and `b'. */
3902 FT_EXPORT( FT_Long
)
3903 FT_MulDiv( FT_Long a
,
3908 /*************************************************************************/
3914 /* A very simple function used to perform the computation */
3915 /* `(a*b)/0x10000' with maximum accuracy. Most of the time this is */
3916 /* used to multiply a given value by a 16.16 fixed-point factor. */
3919 /* a :: The first multiplier. */
3920 /* b :: The second multiplier. Use a 16.16 factor here whenever */
3921 /* possible (see note below). */
3924 /* The result of `(a*b)/0x10000'. */
3927 /* This function has been optimized for the case where the absolute */
3928 /* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */
3929 /* As this happens mainly when scaling from notional units to */
3930 /* fractional pixels in FreeType, it resulted in noticeable speed */
3931 /* improvements between versions 2.x and 1.x. */
3933 /* As a conclusion, always try to place a 16.16 factor as the */
3934 /* _second_ argument of this function; this can make a great */
3937 FT_EXPORT( FT_Long
)
3938 FT_MulFix( FT_Long a
,
3942 /*************************************************************************/
3948 /* A very simple function used to perform the computation */
3949 /* `(a*0x10000)/b' with maximum accuracy. Most of the time, this is */
3950 /* used to divide a given value by a 16.16 fixed-point factor. */
3953 /* a :: The numerator. */
3954 /* b :: The denominator. Use a 16.16 factor here. */
3957 /* The result of `(a*0x10000)/b'. */
3959 FT_EXPORT( FT_Long
)
3960 FT_DivFix( FT_Long a
,
3964 /*************************************************************************/
3970 /* A very simple function used to round a 16.16 fixed number. */
3973 /* a :: The number to be rounded. */
3976 /* `a' rounded to nearest 16.16 fixed integer, halfway cases away */
3979 FT_EXPORT( FT_Fixed
)
3980 FT_RoundFix( FT_Fixed a
);
3983 /*************************************************************************/
3989 /* A very simple function used to compute the ceiling function of a */
3990 /* 16.16 fixed number. */
3993 /* a :: The number for which the ceiling function is to be computed. */
3996 /* `a' rounded towards plus infinity. */
3998 FT_EXPORT( FT_Fixed
)
3999 FT_CeilFix( FT_Fixed a
);
4002 /*************************************************************************/
4008 /* A very simple function used to compute the floor function of a */
4009 /* 16.16 fixed number. */
4012 /* a :: The number for which the floor function is to be computed. */
4015 /* `a' rounded towards minus infinity. */
4017 FT_EXPORT( FT_Fixed
)
4018 FT_FloorFix( FT_Fixed a
);
4021 /*************************************************************************/
4024 /* FT_Vector_Transform */
4027 /* Transform a single vector through a 2x2 matrix. */
4030 /* vector :: The target vector to transform. */
4033 /* matrix :: A pointer to the source 2x2 matrix. */
4036 /* The result is undefined if either `vector' or `matrix' is invalid. */
4039 FT_Vector_Transform( FT_Vector
* vec
,
4040 const FT_Matrix
* matrix
);
4043 /*************************************************************************/
4049 /* FreeType Version */
4052 /* Functions and macros related to FreeType versions. */
4055 /* Note that those functions and macros are of limited use because */
4056 /* even a new release of FreeType with only documentation changes */
4057 /* increases the version number. */
4060 /* FT_Library_Version */
4062 /* FREETYPE_MAJOR */
4063 /* FREETYPE_MINOR */
4064 /* FREETYPE_PATCH */
4066 /* FT_Face_CheckTrueTypePatents */
4067 /* FT_Face_SetUnpatentedHinting */
4071 /*************************************************************************/
4074 /*************************************************************************
4080 * These three macros identify the FreeType source code version.
4081 * Use @FT_Library_Version to access them at runtime.
4084 * FREETYPE_MAJOR :: The major version number.
4085 * FREETYPE_MINOR :: The minor version number.
4086 * FREETYPE_PATCH :: The patch level.
4089 * The version number of FreeType if built as a dynamic link library
4090 * with the `libtool' package is _not_ controlled by these three
4094 #define FREETYPE_MAJOR 2
4095 #define FREETYPE_MINOR 6
4096 #define FREETYPE_PATCH 1
4099 /*************************************************************************/
4102 /* FT_Library_Version */
4105 /* Return the version of the FreeType library being used. This is */
4106 /* useful when dynamically linking to the library, since one cannot */
4107 /* use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and */
4108 /* @FREETYPE_PATCH. */
4111 /* library :: A source library handle. */
4114 /* amajor :: The major version number. */
4116 /* aminor :: The minor version number. */
4118 /* apatch :: The patch version number. */
4121 /* The reason why this function takes a `library' argument is because */
4122 /* certain programs implement library initialization in a custom way */
4123 /* that doesn't use @FT_Init_FreeType. */
4125 /* In such cases, the library version might not be available before */
4126 /* the library object has been created. */
4129 FT_Library_Version( FT_Library library
,
4135 /*************************************************************************/
4138 /* FT_Face_CheckTrueTypePatents */
4141 /* Parse all bytecode instructions of a TrueType font file to check */
4142 /* whether any of the patented opcodes are used. This is only useful */
4143 /* if you want to be able to use the unpatented hinter with */
4144 /* fonts that do *not* use these opcodes. */
4146 /* Note that this function parses *all* glyph instructions in the */
4147 /* font file, which may be slow. */
4150 /* face :: A face handle. */
4153 /* 1~if this is a TrueType font that uses one of the patented */
4154 /* opcodes, 0~otherwise. */
4157 /* Since May 2010, TrueType hinting is no longer patented. */
4162 FT_EXPORT( FT_Bool
)
4163 FT_Face_CheckTrueTypePatents( FT_Face face
);
4166 /*************************************************************************/
4169 /* FT_Face_SetUnpatentedHinting */
4172 /* Enable or disable the unpatented hinter for a given face. */
4173 /* Only enable it if you have determined that the face doesn't */
4174 /* use any patented opcodes (see @FT_Face_CheckTrueTypePatents). */
4177 /* face :: A face handle. */
4179 /* value :: New boolean setting. */
4182 /* The old setting value. This will always be false if this is not */
4183 /* an SFNT font, or if the unpatented hinter is not compiled in this */
4184 /* instance of the library. */
4187 /* Since May 2010, TrueType hinting is no longer patented. */
4192 FT_EXPORT( FT_Bool
)
4193 FT_Face_SetUnpatentedHinting( FT_Face face
,
4201 #endif /* __FREETYPE_H__ */