1 /***************************************************************************/
5 /* FreeType high-level API and common types (specification only). */
7 /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */
9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
11 /* This file is part of the FreeType project, and may only be used, */
12 /* modified, and distributed under the terms of the FreeType project */
13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
14 /* this file you indicate that you have read the license and */
15 /* understand and accept it fully. */
17 /***************************************************************************/
21 #error "`ft2build.h' hasn't been included yet!"
22 #error "Please always use macros to include FreeType header files."
24 #error " #include <ft2build.h>"
25 #error " #include FT_FREETYPE_H"
29 #ifndef __FREETYPE_H__
30 #define __FREETYPE_H__
34 #include FT_CONFIG_CONFIG_H
43 /*************************************************************************/
52 /* How client applications should allocate FreeType data structures. */
55 /* FreeType assumes that structures allocated by the user and passed */
56 /* as arguments are zeroed out except for the actual data. In other */
57 /* words, it is recommended to use `calloc' (or variants of it) */
58 /* instead of `malloc' for allocation. */
60 /*************************************************************************/
64 /*************************************************************************/
65 /*************************************************************************/
67 /* B A S I C T Y P E S */
69 /*************************************************************************/
70 /*************************************************************************/
73 /*************************************************************************/
82 /* The FreeType~2 base font interface. */
85 /* This section describes the public high-level API of FreeType~2. */
97 /* FT_FACE_FLAG_SCALABLE */
98 /* FT_FACE_FLAG_FIXED_SIZES */
99 /* FT_FACE_FLAG_FIXED_WIDTH */
100 /* FT_FACE_FLAG_HORIZONTAL */
101 /* FT_FACE_FLAG_VERTICAL */
102 /* FT_FACE_FLAG_SFNT */
103 /* FT_FACE_FLAG_KERNING */
104 /* FT_FACE_FLAG_MULTIPLE_MASTERS */
105 /* FT_FACE_FLAG_GLYPH_NAMES */
106 /* FT_FACE_FLAG_EXTERNAL_STREAM */
107 /* FT_FACE_FLAG_FAST_GLYPHS */
108 /* FT_FACE_FLAG_HINTER */
110 /* FT_STYLE_FLAG_BOLD */
111 /* FT_STYLE_FLAG_ITALIC */
114 /* FT_Size_Metrics */
116 /* FT_GlyphSlotRec */
117 /* FT_Glyph_Metrics */
122 /* FT_Init_FreeType */
123 /* FT_Done_FreeType */
127 /* FT_New_Memory_Face */
132 /* FT_Attach_Stream */
134 /* FT_Set_Char_Size */
135 /* FT_Set_Pixel_Sizes */
136 /* FT_Request_Size */
138 /* FT_Size_Request_Type */
139 /* FT_Size_Request */
140 /* FT_Set_Transform */
142 /* FT_Get_Char_Index */
143 /* FT_Get_Name_Index */
148 /* FT_OPEN_PATHNAME */
152 /* FT_LOAD_DEFAULT */
154 /* FT_LOAD_MONOCHROME */
155 /* FT_LOAD_LINEAR_DESIGN */
156 /* FT_LOAD_NO_SCALE */
157 /* FT_LOAD_NO_HINTING */
158 /* FT_LOAD_NO_BITMAP */
159 /* FT_LOAD_CROP_BITMAP */
161 /* FT_LOAD_VERTICAL_LAYOUT */
162 /* FT_LOAD_IGNORE_TRANSFORM */
163 /* FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */
164 /* FT_LOAD_FORCE_AUTOHINT */
165 /* FT_LOAD_NO_RECURSE */
166 /* FT_LOAD_PEDANTIC */
168 /* FT_LOAD_TARGET_NORMAL */
169 /* FT_LOAD_TARGET_LIGHT */
170 /* FT_LOAD_TARGET_MONO */
171 /* FT_LOAD_TARGET_LCD */
172 /* FT_LOAD_TARGET_LCD_V */
174 /* FT_Render_Glyph */
177 /* FT_Kerning_Mode */
178 /* FT_Get_Track_Kerning */
179 /* FT_Get_Glyph_Name */
180 /* FT_Get_Postscript_Name */
183 /* FT_Select_Charmap */
185 /* FT_Get_Charmap_Index */
187 /* FT_FSTYPE_INSTALLABLE_EMBEDDING */
188 /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING */
189 /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING */
190 /* FT_FSTYPE_EDITABLE_EMBEDDING */
191 /* FT_FSTYPE_NO_SUBSETTING */
192 /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY */
194 /* FT_Get_FSType_Flags */
196 /*************************************************************************/
199 /*************************************************************************/
202 /* FT_Glyph_Metrics */
205 /* A structure used to model the metrics of a single glyph. The */
206 /* values are expressed in 26.6 fractional pixel format; if the flag */
207 /* @FT_LOAD_NO_SCALE has been used while loading the glyph, values */
208 /* are expressed in font units instead. */
212 /* The glyph's width. */
215 /* The glyph's height. */
217 /* horiBearingX :: */
218 /* Left side bearing for horizontal layout. */
220 /* horiBearingY :: */
221 /* Top side bearing for horizontal layout. */
224 /* Advance width for horizontal layout. */
226 /* vertBearingX :: */
227 /* Left side bearing for vertical layout. */
229 /* vertBearingY :: */
230 /* Top side bearing for vertical layout. */
233 /* Advance height for vertical layout. */
236 /* If not disabled with @FT_LOAD_NO_HINTING, the values represent */
237 /* dimensions of the hinted glyph (in case hinting is applicable). */
239 typedef struct FT_Glyph_Metrics_
255 /*************************************************************************/
261 /* This structure models the metrics of a bitmap strike (i.e., a set */
262 /* of glyphs for a given point size and resolution) in a bitmap font. */
263 /* It is used for the `available_sizes' field of @FT_Face. */
266 /* height :: The vertical distance, in pixels, between two */
267 /* consecutive baselines. It is always positive. */
269 /* width :: The average width, in pixels, of all glyphs in the */
272 /* size :: The nominal size of the strike in 26.6 fractional */
273 /* points. This field is not very useful. */
275 /* x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional */
278 /* y_ppem :: The vertical ppem (nominal height) in 26.6 fractional */
283 /* The nominal size given in a FNT font is not reliable. Thus when */
284 /* the driver finds it incorrect, it sets `size' to some calculated */
285 /* values and sets `x_ppem' and `y_ppem' to the pixel width and */
286 /* height given in the font, respectively. */
288 /* TrueType embedded bitmaps: */
289 /* `size', `width', and `height' values are not contained in the */
290 /* bitmap strike itself. They are computed from the global font */
293 typedef struct FT_Bitmap_Size_
306 /*************************************************************************/
307 /*************************************************************************/
309 /* O B J E C T C L A S S E S */
311 /*************************************************************************/
312 /*************************************************************************/
314 /*************************************************************************/
320 /* A handle to a FreeType library instance. Each `library' is */
321 /* completely independent from the others; it is the `root' of a set */
322 /* of objects like fonts, faces, sizes, etc. */
324 /* It also embeds a memory manager (see @FT_Memory), as well as a */
325 /* scan-line converter object (see @FT_Raster). */
327 /* For multi-threading applications each thread should have its own */
328 /* FT_Library object. */
331 /* Library objects are normally created by @FT_Init_FreeType, and */
332 /* destroyed with @FT_Done_FreeType. */
334 typedef struct FT_LibraryRec_
*FT_Library
;
337 /*************************************************************************/
343 /* A handle to a given FreeType module object. Each module can be a */
344 /* font driver, a renderer, or anything else that provides services */
345 /* to the formers. */
347 typedef struct FT_ModuleRec_
* FT_Module
;
350 /*************************************************************************/
356 /* A handle to a given FreeType font driver object. Each font driver */
357 /* is a special module capable of creating faces from font files. */
359 typedef struct FT_DriverRec_
* FT_Driver
;
362 /*************************************************************************/
368 /* A handle to a given FreeType renderer. A renderer is a special */
369 /* module in charge of converting a glyph image to a bitmap, when */
370 /* necessary. Each renderer supports a given glyph image format, and */
371 /* one or more target surface depths. */
373 typedef struct FT_RendererRec_
* FT_Renderer
;
376 /*************************************************************************/
382 /* A handle to a given typographic face object. A face object models */
383 /* a given typeface, in a given style. */
386 /* Each face object also owns a single @FT_GlyphSlot object, as well */
387 /* as one or more @FT_Size objects. */
389 /* Use @FT_New_Face or @FT_Open_Face to create a new face object from */
390 /* a given filepathname or a custom input stream. */
392 /* Use @FT_Done_Face to destroy it (along with its slot and sizes). */
395 /* See @FT_FaceRec for the publicly accessible fields of a given face */
398 typedef struct FT_FaceRec_
* FT_Face
;
401 /*************************************************************************/
407 /* A handle to an object used to model a face scaled to a given */
408 /* character size. */
411 /* Each @FT_Face has an _active_ @FT_Size object that is used by */
412 /* functions like @FT_Load_Glyph to determine the scaling */
413 /* transformation which is used to load and hint glyphs and metrics. */
415 /* You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, */
416 /* @FT_Request_Size or even @FT_Select_Size to change the content */
417 /* (i.e., the scaling values) of the active @FT_Size. */
419 /* You can use @FT_New_Size to create additional size objects for a */
420 /* given @FT_Face, but they won't be used by other functions until */
421 /* you activate it through @FT_Activate_Size. Only one size can be */
422 /* activated at any given time per face. */
425 /* See @FT_SizeRec for the publicly accessible fields of a given size */
428 typedef struct FT_SizeRec_
* FT_Size
;
431 /*************************************************************************/
437 /* A handle to a given `glyph slot'. A slot is a container where it */
438 /* is possible to load any of the glyphs contained in its parent */
441 /* In other words, each time you call @FT_Load_Glyph or */
442 /* @FT_Load_Char, the slot's content is erased by the new glyph data, */
443 /* i.e., the glyph's metrics, its image (bitmap or outline), and */
444 /* other control information. */
447 /* See @FT_GlyphSlotRec for the publicly accessible glyph fields. */
449 typedef struct FT_GlyphSlotRec_
* FT_GlyphSlot
;
452 /*************************************************************************/
458 /* A handle to a given character map. A charmap is used to translate */
459 /* character codes in a given encoding into glyph indexes for its */
460 /* parent's face. Some font formats may provide several charmaps per */
463 /* Each face object owns zero or more charmaps, but only one of them */
464 /* can be `active' and used by @FT_Get_Char_Index or @FT_Load_Char. */
466 /* The list of available charmaps in a face is available through the */
467 /* `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec. */
469 /* The currently active charmap is available as `face->charmap'. */
470 /* You should call @FT_Set_Charmap to change it. */
473 /* When a new face is created (either through @FT_New_Face or */
474 /* @FT_Open_Face), the library looks for a Unicode charmap within */
475 /* the list and automatically activates it. */
478 /* See @FT_CharMapRec for the publicly accessible fields of a given */
481 typedef struct FT_CharMapRec_
* FT_CharMap
;
484 /*************************************************************************/
490 /* This macro converts four-letter tags into an unsigned long. It is */
491 /* used to define `encoding' identifiers (see @FT_Encoding). */
494 /* Since many 16-bit compilers don't like 32-bit enumerations, you */
495 /* should redefine this macro in case of problems to something like */
499 /* #define FT_ENC_TAG( value, a, b, c, d ) value */
502 /* to get a simple enumeration without assigning special numbers. */
506 #define FT_ENC_TAG( value, a, b, c, d ) \
507 value = ( ( (FT_UInt32)(a) << 24 ) | \
508 ( (FT_UInt32)(b) << 16 ) | \
509 ( (FT_UInt32)(c) << 8 ) | \
512 #endif /* FT_ENC_TAG */
515 /*************************************************************************/
521 /* An enumeration used to specify character sets supported by */
522 /* charmaps. Used in the @FT_Select_Charmap API function. */
525 /* Despite the name, this enumeration lists specific character */
526 /* repertories (i.e., charsets), and not text encoding methods (e.g., */
527 /* UTF-8, UTF-16, etc.). */
529 /* Other encodings might be defined in the future. */
532 /* FT_ENCODING_NONE :: */
533 /* The encoding value~0 is reserved. */
535 /* FT_ENCODING_UNICODE :: */
536 /* Corresponds to the Unicode character set. This value covers */
537 /* all versions of the Unicode repertoire, including ASCII and */
538 /* Latin-1. Most fonts include a Unicode charmap, but not all */
541 /* For example, if you want to access Unicode value U+1F028 (and */
542 /* the font contains it), use value 0x1F028 as the input value for */
543 /* @FT_Get_Char_Index. */
545 /* FT_ENCODING_MS_SYMBOL :: */
546 /* Corresponds to the Microsoft Symbol encoding, used to encode */
547 /* mathematical symbols in the 32..255 character code range. For */
548 /* more information, see `http://www.ceviz.net/symbol.htm'. */
550 /* FT_ENCODING_SJIS :: */
551 /* Corresponds to Japanese SJIS encoding. More info at */
552 /* at `http://langsupport.japanreference.com/encoding.shtml'. */
553 /* See note on multi-byte encodings below. */
555 /* FT_ENCODING_GB2312 :: */
556 /* Corresponds to an encoding system for Simplified Chinese as used */
557 /* used in mainland China. */
559 /* FT_ENCODING_BIG5 :: */
560 /* Corresponds to an encoding system for Traditional Chinese as */
561 /* used in Taiwan and Hong Kong. */
563 /* FT_ENCODING_WANSUNG :: */
564 /* Corresponds to the Korean encoding system known as Wansung. */
565 /* For more information see */
566 /* `http://www.microsoft.com/typography/unicode/949.txt'. */
568 /* FT_ENCODING_JOHAB :: */
569 /* The Korean standard character set (KS~C 5601-1992), which */
570 /* corresponds to MS Windows code page 1361. This character set */
571 /* includes all possible Hangeul character combinations. */
573 /* FT_ENCODING_ADOBE_LATIN_1 :: */
574 /* Corresponds to a Latin-1 encoding as defined in a Type~1 */
575 /* PostScript font. It is limited to 256 character codes. */
577 /* FT_ENCODING_ADOBE_STANDARD :: */
578 /* Corresponds to the Adobe Standard encoding, as found in Type~1, */
579 /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
582 /* FT_ENCODING_ADOBE_EXPERT :: */
583 /* Corresponds to the Adobe Expert encoding, as found in Type~1, */
584 /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
587 /* FT_ENCODING_ADOBE_CUSTOM :: */
588 /* Corresponds to a custom encoding, as found in Type~1, CFF, and */
589 /* OpenType/CFF fonts. It is limited to 256 character codes. */
591 /* FT_ENCODING_APPLE_ROMAN :: */
592 /* Corresponds to the 8-bit Apple roman encoding. Many TrueType */
593 /* and OpenType fonts contain a charmap for this encoding, since */
594 /* older versions of Mac OS are able to use it. */
596 /* FT_ENCODING_OLD_LATIN_2 :: */
597 /* This value is deprecated and was never used nor reported by */
598 /* FreeType. Don't use or test for it. */
600 /* FT_ENCODING_MS_SJIS :: */
601 /* Same as FT_ENCODING_SJIS. Deprecated. */
603 /* FT_ENCODING_MS_GB2312 :: */
604 /* Same as FT_ENCODING_GB2312. Deprecated. */
606 /* FT_ENCODING_MS_BIG5 :: */
607 /* Same as FT_ENCODING_BIG5. Deprecated. */
609 /* FT_ENCODING_MS_WANSUNG :: */
610 /* Same as FT_ENCODING_WANSUNG. Deprecated. */
612 /* FT_ENCODING_MS_JOHAB :: */
613 /* Same as FT_ENCODING_JOHAB. Deprecated. */
616 /* By default, FreeType automatically synthesizes a Unicode charmap */
617 /* for PostScript fonts, using their glyph names dictionaries. */
618 /* However, it also reports the encodings defined explicitly in the */
619 /* font file, for the cases when they are needed, with the Adobe */
620 /* values as well. */
622 /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */
623 /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */
624 /* FT_ENCODING_UNICODE). Use @FT_Get_BDF_Charset_ID to find out */
625 /* which encoding is really present. If, for example, the */
626 /* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */
627 /* the font is encoded in KOI8-R. */
629 /* FT_ENCODING_NONE is always set (with a single exception) by the */
630 /* winfonts driver. Use @FT_Get_WinFNT_Header and examine the */
631 /* `charset' field of the @FT_WinFNT_HeaderRec structure to find out */
632 /* which encoding is really present. For example, */
633 /* @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for */
636 /* FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */
637 /* and `encoding_id' is not @TT_MAC_ID_ROMAN (otherwise it is set to */
638 /* FT_ENCODING_APPLE_ROMAN). */
640 /* If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function */
641 /* @FT_Get_CMap_Language_ID to query the Mac language ID which may */
642 /* be needed to be able to distinguish Apple encoding variants. See */
644 /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT */
646 /* to get an idea how to do that. Basically, if the language ID */
647 /* is~0, don't use it, otherwise subtract 1 from the language ID. */
648 /* Then examine `encoding_id'. If, for example, `encoding_id' is */
649 /* @TT_MAC_ID_ROMAN and the language ID (minus~1) is */
650 /* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */
651 /* @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi */
652 /* variant the Arabic encoding. */
654 typedef enum FT_Encoding_
656 FT_ENC_TAG( FT_ENCODING_NONE
, 0, 0, 0, 0 ),
658 FT_ENC_TAG( FT_ENCODING_MS_SYMBOL
, 's', 'y', 'm', 'b' ),
659 FT_ENC_TAG( FT_ENCODING_UNICODE
, 'u', 'n', 'i', 'c' ),
661 FT_ENC_TAG( FT_ENCODING_SJIS
, 's', 'j', 'i', 's' ),
662 FT_ENC_TAG( FT_ENCODING_GB2312
, 'g', 'b', ' ', ' ' ),
663 FT_ENC_TAG( FT_ENCODING_BIG5
, 'b', 'i', 'g', '5' ),
664 FT_ENC_TAG( FT_ENCODING_WANSUNG
, 'w', 'a', 'n', 's' ),
665 FT_ENC_TAG( FT_ENCODING_JOHAB
, 'j', 'o', 'h', 'a' ),
667 /* for backwards compatibility */
668 FT_ENCODING_MS_SJIS
= FT_ENCODING_SJIS
,
669 FT_ENCODING_MS_GB2312
= FT_ENCODING_GB2312
,
670 FT_ENCODING_MS_BIG5
= FT_ENCODING_BIG5
,
671 FT_ENCODING_MS_WANSUNG
= FT_ENCODING_WANSUNG
,
672 FT_ENCODING_MS_JOHAB
= FT_ENCODING_JOHAB
,
674 FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD
, 'A', 'D', 'O', 'B' ),
675 FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT
, 'A', 'D', 'B', 'E' ),
676 FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM
, 'A', 'D', 'B', 'C' ),
677 FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1
, 'l', 'a', 't', '1' ),
679 FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2
, 'l', 'a', 't', '2' ),
681 FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN
, 'a', 'r', 'm', 'n' )
686 /*************************************************************************/
689 /* ft_encoding_xxx */
692 /* These constants are deprecated; use the corresponding @FT_Encoding */
693 /* values instead. */
695 #define ft_encoding_none FT_ENCODING_NONE
696 #define ft_encoding_unicode FT_ENCODING_UNICODE
697 #define ft_encoding_symbol FT_ENCODING_MS_SYMBOL
698 #define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1
699 #define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2
700 #define ft_encoding_sjis FT_ENCODING_SJIS
701 #define ft_encoding_gb2312 FT_ENCODING_GB2312
702 #define ft_encoding_big5 FT_ENCODING_BIG5
703 #define ft_encoding_wansung FT_ENCODING_WANSUNG
704 #define ft_encoding_johab FT_ENCODING_JOHAB
706 #define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD
707 #define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT
708 #define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM
709 #define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN
712 /*************************************************************************/
718 /* The base charmap structure. */
721 /* face :: A handle to the parent face object. */
723 /* encoding :: An @FT_Encoding tag identifying the charmap. Use */
724 /* this with @FT_Select_Charmap. */
726 /* platform_id :: An ID number describing the platform for the */
727 /* following encoding ID. This comes directly from */
728 /* the TrueType specification and should be emulated */
729 /* for other formats. */
731 /* encoding_id :: A platform specific encoding number. This also */
732 /* comes from the TrueType specification and should be */
733 /* emulated similarly. */
735 typedef struct FT_CharMapRec_
738 FT_Encoding encoding
;
739 FT_UShort platform_id
;
740 FT_UShort encoding_id
;
745 /*************************************************************************/
746 /*************************************************************************/
748 /* B A S E O B J E C T C L A S S E S */
750 /*************************************************************************/
751 /*************************************************************************/
754 /*************************************************************************/
757 /* FT_Face_Internal */
760 /* An opaque handle to an `FT_Face_InternalRec' structure, used to */
761 /* model private data of a given @FT_Face object. */
763 /* This structure might change between releases of FreeType~2 and is */
764 /* not generally available to client applications. */
766 typedef struct FT_Face_InternalRec_
* FT_Face_Internal
;
769 /*************************************************************************/
775 /* FreeType root face class structure. A face object models a */
776 /* typeface in a font file. */
779 /* num_faces :: The number of faces in the font file. Some */
780 /* font formats can have multiple faces in */
783 /* face_index :: The index of the face in the font file. It */
784 /* is set to~0 if there is only one face in */
787 /* face_flags :: A set of bit flags that give important */
788 /* information about the face; see */
789 /* @FT_FACE_FLAG_XXX for the details. */
791 /* style_flags :: A set of bit flags indicating the style of */
792 /* the face; see @FT_STYLE_FLAG_XXX for the */
795 /* num_glyphs :: The number of glyphs in the face. If the */
796 /* face is scalable and has sbits (see */
797 /* `num_fixed_sizes'), it is set to the number */
798 /* of outline glyphs. */
800 /* For CID-keyed fonts, this value gives the */
801 /* highest CID used in the font. */
803 /* family_name :: The face's family name. This is an ASCII */
804 /* string, usually in English, which describes */
805 /* the typeface's family (like `Times New */
806 /* Roman', `Bodoni', `Garamond', etc). This */
807 /* is a least common denominator used to list */
808 /* fonts. Some formats (TrueType & OpenType) */
809 /* provide localized and Unicode versions of */
810 /* this string. Applications should use the */
811 /* format specific interface to access them. */
812 /* Can be NULL (e.g., in fonts embedded in a */
815 /* style_name :: The face's style name. This is an ASCII */
816 /* string, usually in English, which describes */
817 /* the typeface's style (like `Italic', */
818 /* `Bold', `Condensed', etc). Not all font */
819 /* formats provide a style name, so this field */
820 /* is optional, and can be set to NULL. As */
821 /* for `family_name', some formats provide */
822 /* localized and Unicode versions of this */
823 /* string. Applications should use the format */
824 /* specific interface to access them. */
826 /* num_fixed_sizes :: The number of bitmap strikes in the face. */
827 /* Even if the face is scalable, there might */
828 /* still be bitmap strikes, which are called */
829 /* `sbits' in that case. */
831 /* available_sizes :: An array of @FT_Bitmap_Size for all bitmap */
832 /* strikes in the face. It is set to NULL if */
833 /* there is no bitmap strike. */
835 /* num_charmaps :: The number of charmaps in the face. */
837 /* charmaps :: An array of the charmaps of the face. */
839 /* generic :: A field reserved for client uses. See the */
840 /* @FT_Generic type description. */
842 /* bbox :: The font bounding box. Coordinates are */
843 /* expressed in font units (see */
844 /* `units_per_EM'). The box is large enough */
845 /* to contain any glyph from the font. Thus, */
846 /* `bbox.yMax' can be seen as the `maximal */
847 /* ascender', and `bbox.yMin' as the `minimal */
848 /* descender'. Only relevant for scalable */
851 /* Note that the bounding box might be off by */
852 /* (at least) one pixel for hinted fonts. See */
853 /* @FT_Size_Metrics for further discussion. */
855 /* units_per_EM :: The number of font units per EM square for */
856 /* this face. This is typically 2048 for */
857 /* TrueType fonts, and 1000 for Type~1 fonts. */
858 /* Only relevant for scalable formats. */
860 /* ascender :: The typographic ascender of the face, */
861 /* expressed in font units. For font formats */
862 /* not having this information, it is set to */
863 /* `bbox.yMax'. Only relevant for scalable */
866 /* descender :: The typographic descender of the face, */
867 /* expressed in font units. For font formats */
868 /* not having this information, it is set to */
869 /* `bbox.yMin'. Note that this field is */
870 /* usually negative. Only relevant for */
871 /* scalable formats. */
873 /* height :: The height is the vertical distance */
874 /* between two consecutive baselines, */
875 /* expressed in font units. It is always */
876 /* positive. Only relevant for scalable */
879 /* max_advance_width :: The maximal advance width, in font units, */
880 /* for all glyphs in this face. This can be */
881 /* used to make word wrapping computations */
882 /* faster. Only relevant for scalable */
885 /* max_advance_height :: The maximal advance height, in font units, */
886 /* for all glyphs in this face. This is only */
887 /* relevant for vertical layouts, and is set */
888 /* to `height' for fonts that do not provide */
889 /* vertical metrics. Only relevant for */
890 /* scalable formats. */
892 /* underline_position :: The position, in font units, of the */
893 /* underline line for this face. It is the */
894 /* center of the underlining stem. Only */
895 /* relevant for scalable formats. */
897 /* underline_thickness :: The thickness, in font units, of the */
898 /* underline for this face. Only relevant for */
899 /* scalable formats. */
901 /* glyph :: The face's associated glyph slot(s). */
903 /* size :: The current active size for this face. */
905 /* charmap :: The current active charmap for this face. */
908 /* Fields may be changed after a call to @FT_Attach_File or */
909 /* @FT_Attach_Stream. */
911 typedef struct FT_FaceRec_
921 FT_String
* family_name
;
922 FT_String
* style_name
;
924 FT_Int num_fixed_sizes
;
925 FT_Bitmap_Size
* available_sizes
;
928 FT_CharMap
* charmaps
;
932 /*# The following member variables (down to `underline_thickness') */
933 /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */
934 /*# for bitmap fonts. */
937 FT_UShort units_per_EM
;
942 FT_Short max_advance_width
;
943 FT_Short max_advance_height
;
945 FT_Short underline_position
;
946 FT_Short underline_thickness
;
958 FT_ListRec sizes_list
;
963 FT_Face_Internal internal
;
970 /*************************************************************************/
973 /* FT_FACE_FLAG_XXX */
976 /* A list of bit flags used in the `face_flags' field of the */
977 /* @FT_FaceRec structure. They inform client applications of */
978 /* properties of the corresponding face. */
981 /* FT_FACE_FLAG_SCALABLE :: */
982 /* Indicates that the face contains outline glyphs. This doesn't */
983 /* prevent bitmap strikes, i.e., a face can have both this and */
984 /* and @FT_FACE_FLAG_FIXED_SIZES set. */
986 /* FT_FACE_FLAG_FIXED_SIZES :: */
987 /* Indicates that the face contains bitmap strikes. See also the */
988 /* `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec. */
990 /* FT_FACE_FLAG_FIXED_WIDTH :: */
991 /* Indicates that the face contains fixed-width characters (like */
992 /* Courier, Lucido, MonoType, etc.). */
994 /* FT_FACE_FLAG_SFNT :: */
995 /* Indicates that the face uses the `sfnt' storage scheme. For */
996 /* now, this means TrueType and OpenType. */
998 /* FT_FACE_FLAG_HORIZONTAL :: */
999 /* Indicates that the face contains horizontal glyph metrics. This */
1000 /* should be set for all common formats. */
1002 /* FT_FACE_FLAG_VERTICAL :: */
1003 /* Indicates that the face contains vertical glyph metrics. This */
1004 /* is only available in some formats, not all of them. */
1006 /* FT_FACE_FLAG_KERNING :: */
1007 /* Indicates that the face contains kerning information. If set, */
1008 /* the kerning distance can be retrieved through the function */
1009 /* @FT_Get_Kerning. Otherwise the function always return the */
1010 /* vector (0,0). Note that FreeType doesn't handle kerning data */
1011 /* from the `GPOS' table (as present in some OpenType fonts). */
1013 /* FT_FACE_FLAG_FAST_GLYPHS :: */
1014 /* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */
1016 /* FT_FACE_FLAG_MULTIPLE_MASTERS :: */
1017 /* Indicates that the font contains multiple masters and is capable */
1018 /* of interpolating between them. See the multiple-masters */
1019 /* specific API for details. */
1021 /* FT_FACE_FLAG_GLYPH_NAMES :: */
1022 /* Indicates that the font contains glyph names that can be */
1023 /* retrieved through @FT_Get_Glyph_Name. Note that some TrueType */
1024 /* fonts contain broken glyph name tables. Use the function */
1025 /* @FT_Has_PS_Glyph_Names when needed. */
1027 /* FT_FACE_FLAG_EXTERNAL_STREAM :: */
1028 /* Used internally by FreeType to indicate that a face's stream was */
1029 /* provided by the client application and should not be destroyed */
1030 /* when @FT_Done_Face is called. Don't read or test this flag. */
1032 /* FT_FACE_FLAG_HINTER :: */
1033 /* Set if the font driver has a hinting machine of its own. For */
1034 /* example, with TrueType fonts, it makes sense to use data from */
1035 /* the SFNT `gasp' table only if the native TrueType hinting engine */
1036 /* (with the bytecode interpreter) is available and active. */
1038 /* FT_FACE_FLAG_CID_KEYED :: */
1039 /* Set if the font is CID-keyed. In that case, the font is not */
1040 /* accessed by glyph indices but by CID values. For subsetted */
1041 /* CID-keyed fonts this has the consequence that not all index */
1042 /* values are a valid argument to FT_Load_Glyph. Only the CID */
1043 /* values for which corresponding glyphs in the subsetted font */
1044 /* exist make FT_Load_Glyph return successfully; in all other cases */
1045 /* you get an `FT_Err_Invalid_Argument' error. */
1047 /* Note that CID-keyed fonts which are in an SFNT wrapper don't */
1048 /* have this flag set since the glyphs are accessed in the normal */
1049 /* way (using contiguous indices); the `CID-ness' isn't visible to */
1050 /* the application. */
1052 /* FT_FACE_FLAG_TRICKY :: */
1053 /* Set if the font is `tricky', this is, it always needs the */
1054 /* font format's native hinting engine to get a reasonable result. */
1055 /* A typical example is the Chinese font `mingli.ttf' which uses */
1056 /* TrueType bytecode instructions to move and scale all of its */
1059 /* It is not possible to autohint such fonts using */
1060 /* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */
1061 /* @FT_LOAD_NO_HINTING. You have to set both FT_LOAD_NO_HINTING */
1062 /* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */
1063 /* probably never want this except for demonstration purposes. */
1065 /* Currently, there are six TrueType fonts in the list of tricky */
1066 /* fonts; they are hard-coded in file `ttobjs.c'. */
1068 #define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
1069 #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
1070 #define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )
1071 #define FT_FACE_FLAG_SFNT ( 1L << 3 )
1072 #define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 )
1073 #define FT_FACE_FLAG_VERTICAL ( 1L << 5 )
1074 #define FT_FACE_FLAG_KERNING ( 1L << 6 )
1075 #define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 )
1076 #define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 )
1077 #define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 )
1078 #define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )
1079 #define FT_FACE_FLAG_HINTER ( 1L << 11 )
1080 #define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )
1081 #define FT_FACE_FLAG_TRICKY ( 1L << 13 )
1084 /*************************************************************************
1087 * FT_HAS_HORIZONTAL( face )
1090 * A macro that returns true whenever a face object contains
1091 * horizontal metrics (this is true for all font formats though).
1094 * @FT_HAS_VERTICAL can be used to check for vertical metrics.
1097 #define FT_HAS_HORIZONTAL( face ) \
1098 ( face->face_flags & FT_FACE_FLAG_HORIZONTAL )
1101 /*************************************************************************
1104 * FT_HAS_VERTICAL( face )
1107 * A macro that returns true whenever a face object contains vertical
1111 #define FT_HAS_VERTICAL( face ) \
1112 ( face->face_flags & FT_FACE_FLAG_VERTICAL )
1115 /*************************************************************************
1118 * FT_HAS_KERNING( face )
1121 * A macro that returns true whenever a face object contains kerning
1122 * data that can be accessed with @FT_Get_Kerning.
1125 #define FT_HAS_KERNING( face ) \
1126 ( face->face_flags & FT_FACE_FLAG_KERNING )
1129 /*************************************************************************
1132 * FT_IS_SCALABLE( face )
1135 * A macro that returns true whenever a face object contains a scalable
1136 * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF,
1137 * and PFR font formats.
1140 #define FT_IS_SCALABLE( face ) \
1141 ( face->face_flags & FT_FACE_FLAG_SCALABLE )
1144 /*************************************************************************
1147 * FT_IS_SFNT( face )
1150 * A macro that returns true whenever a face object contains a font
1151 * whose format is based on the SFNT storage scheme. This usually
1152 * means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded
1155 * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and
1156 * @FT_TRUETYPE_TABLES_H are available.
1159 #define FT_IS_SFNT( face ) \
1160 ( face->face_flags & FT_FACE_FLAG_SFNT )
1163 /*************************************************************************
1166 * FT_IS_FIXED_WIDTH( face )
1169 * A macro that returns true whenever a face object contains a font face
1170 * that contains fixed-width (or `monospace', `fixed-pitch', etc.)
1174 #define FT_IS_FIXED_WIDTH( face ) \
1175 ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
1178 /*************************************************************************
1181 * FT_HAS_FIXED_SIZES( face )
1184 * A macro that returns true whenever a face object contains some
1185 * embedded bitmaps. See the `available_sizes' field of the
1186 * @FT_FaceRec structure.
1189 #define FT_HAS_FIXED_SIZES( face ) \
1190 ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
1193 /*************************************************************************
1196 * FT_HAS_FAST_GLYPHS( face )
1202 #define FT_HAS_FAST_GLYPHS( face ) 0
1205 /*************************************************************************
1208 * FT_HAS_GLYPH_NAMES( face )
1211 * A macro that returns true whenever a face object contains some glyph
1212 * names that can be accessed through @FT_Get_Glyph_Name.
1215 #define FT_HAS_GLYPH_NAMES( face ) \
1216 ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
1219 /*************************************************************************
1222 * FT_HAS_MULTIPLE_MASTERS( face )
1225 * A macro that returns true whenever a face object contains some
1226 * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H
1227 * are then available to choose the exact design you want.
1230 #define FT_HAS_MULTIPLE_MASTERS( face ) \
1231 ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
1234 /*************************************************************************
1237 * FT_IS_CID_KEYED( face )
1240 * A macro that returns true whenever a face object contains a CID-keyed
1241 * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more
1244 * If this macro is true, all functions defined in @FT_CID_H are
1248 #define FT_IS_CID_KEYED( face ) \
1249 ( face->face_flags & FT_FACE_FLAG_CID_KEYED )
1252 /*************************************************************************
1255 * FT_IS_TRICKY( face )
1258 * A macro that returns true whenever a face represents a `tricky' font.
1259 * See the discussion of @FT_FACE_FLAG_TRICKY for more details.
1262 #define FT_IS_TRICKY( face ) \
1263 ( face->face_flags & FT_FACE_FLAG_TRICKY )
1266 /*************************************************************************/
1269 /* FT_STYLE_FLAG_XXX */
1272 /* A list of bit-flags used to indicate the style of a given face. */
1273 /* These are used in the `style_flags' field of @FT_FaceRec. */
1276 /* FT_STYLE_FLAG_ITALIC :: */
1277 /* Indicates that a given face style is italic or oblique. */
1279 /* FT_STYLE_FLAG_BOLD :: */
1280 /* Indicates that a given face is bold. */
1283 /* The style information as provided by FreeType is very basic. More */
1284 /* details are beyond the scope and should be done on a higher level */
1285 /* (for example, by analyzing various fields of the `OS/2' table in */
1286 /* SFNT based fonts). */
1288 #define FT_STYLE_FLAG_ITALIC ( 1 << 0 )
1289 #define FT_STYLE_FLAG_BOLD ( 1 << 1 )
1292 /*************************************************************************/
1295 /* FT_Size_Internal */
1298 /* An opaque handle to an `FT_Size_InternalRec' structure, used to */
1299 /* model private data of a given @FT_Size object. */
1301 typedef struct FT_Size_InternalRec_
* FT_Size_Internal
;
1304 /*************************************************************************/
1307 /* FT_Size_Metrics */
1310 /* The size metrics structure gives the metrics of a size object. */
1313 /* x_ppem :: The width of the scaled EM square in pixels, hence */
1314 /* the term `ppem' (pixels per EM). It is also */
1315 /* referred to as `nominal width'. */
1317 /* y_ppem :: The height of the scaled EM square in pixels, */
1318 /* hence the term `ppem' (pixels per EM). It is also */
1319 /* referred to as `nominal height'. */
1321 /* x_scale :: A 16.16 fractional scaling value used to convert */
1322 /* horizontal metrics from font units to 26.6 */
1323 /* fractional pixels. Only relevant for scalable */
1326 /* y_scale :: A 16.16 fractional scaling value used to convert */
1327 /* vertical metrics from font units to 26.6 */
1328 /* fractional pixels. Only relevant for scalable */
1331 /* ascender :: The ascender in 26.6 fractional pixels. See */
1332 /* @FT_FaceRec for the details. */
1334 /* descender :: The descender in 26.6 fractional pixels. See */
1335 /* @FT_FaceRec for the details. */
1337 /* height :: The height in 26.6 fractional pixels. See */
1338 /* @FT_FaceRec for the details. */
1340 /* max_advance :: The maximal advance width in 26.6 fractional */
1341 /* pixels. See @FT_FaceRec for the details. */
1344 /* The scaling values, if relevant, are determined first during a */
1345 /* size changing operation. The remaining fields are then set by the */
1346 /* driver. For scalable formats, they are usually set to scaled */
1347 /* values of the corresponding fields in @FT_FaceRec. */
1349 /* Note that due to glyph hinting, these values might not be exact */
1350 /* for certain fonts. Thus they must be treated as unreliable */
1351 /* with an error margin of at least one pixel! */
1353 /* Indeed, the only way to get the exact metrics is to render _all_ */
1354 /* glyphs. As this would be a definite performance hit, it is up to */
1355 /* client applications to perform such computations. */
1357 /* The FT_Size_Metrics structure is valid for bitmap fonts also. */
1359 typedef struct FT_Size_Metrics_
1361 FT_UShort x_ppem
; /* horizontal pixels per EM */
1362 FT_UShort y_ppem
; /* vertical pixels per EM */
1364 FT_Fixed x_scale
; /* scaling values used to convert font */
1365 FT_Fixed y_scale
; /* units to 26.6 fractional pixels */
1367 FT_Pos ascender
; /* ascender in 26.6 frac. pixels */
1368 FT_Pos descender
; /* descender in 26.6 frac. pixels */
1369 FT_Pos height
; /* text height in 26.6 frac. pixels */
1370 FT_Pos max_advance
; /* max horizontal advance, in 26.6 pixels */
1375 /*************************************************************************/
1381 /* FreeType root size class structure. A size object models a face */
1382 /* object at a given size. */
1385 /* face :: Handle to the parent face object. */
1387 /* generic :: A typeless pointer, which is unused by the FreeType */
1388 /* library or any of its drivers. It can be used by */
1389 /* client applications to link their own data to each size */
1392 /* metrics :: Metrics for this size object. This field is read-only. */
1394 typedef struct FT_SizeRec_
1396 FT_Face face
; /* parent face object */
1397 FT_Generic generic
; /* generic pointer for client uses */
1398 FT_Size_Metrics metrics
; /* size metrics */
1399 FT_Size_Internal internal
;
1404 /*************************************************************************/
1410 /* The subglyph structure is an internal object used to describe */
1411 /* subglyphs (for example, in the case of composites). */
1414 /* The subglyph implementation is not part of the high-level API, */
1415 /* hence the forward structure declaration. */
1417 /* You can however retrieve subglyph information with */
1418 /* @FT_Get_SubGlyph_Info. */
1420 typedef struct FT_SubGlyphRec_
* FT_SubGlyph
;
1423 /*************************************************************************/
1426 /* FT_Slot_Internal */
1429 /* An opaque handle to an `FT_Slot_InternalRec' structure, used to */
1430 /* model private data of a given @FT_GlyphSlot object. */
1432 typedef struct FT_Slot_InternalRec_
* FT_Slot_Internal
;
1435 /*************************************************************************/
1438 /* FT_GlyphSlotRec */
1441 /* FreeType root glyph slot class structure. A glyph slot is a */
1442 /* container where individual glyphs can be loaded, be they in */
1443 /* outline or bitmap format. */
1446 /* library :: A handle to the FreeType library instance */
1447 /* this slot belongs to. */
1449 /* face :: A handle to the parent face object. */
1451 /* next :: In some cases (like some font tools), several */
1452 /* glyph slots per face object can be a good */
1453 /* thing. As this is rare, the glyph slots are */
1454 /* listed through a direct, single-linked list */
1455 /* using its `next' field. */
1457 /* generic :: A typeless pointer which is unused by the */
1458 /* FreeType library or any of its drivers. It */
1459 /* can be used by client applications to link */
1460 /* their own data to each glyph slot object. */
1462 /* metrics :: The metrics of the last loaded glyph in the */
1463 /* slot. The returned values depend on the last */
1464 /* load flags (see the @FT_Load_Glyph API */
1465 /* function) and can be expressed either in 26.6 */
1466 /* fractional pixels or font units. */
1468 /* Note that even when the glyph image is */
1469 /* transformed, the metrics are not. */
1471 /* linearHoriAdvance :: The advance width of the unhinted glyph. */
1472 /* Its value is expressed in 16.16 fractional */
1473 /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
1474 /* when loading the glyph. This field can be */
1475 /* important to perform correct WYSIWYG layout. */
1476 /* Only relevant for outline glyphs. */
1478 /* linearVertAdvance :: The advance height of the unhinted glyph. */
1479 /* Its value is expressed in 16.16 fractional */
1480 /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
1481 /* when loading the glyph. This field can be */
1482 /* important to perform correct WYSIWYG layout. */
1483 /* Only relevant for outline glyphs. */
1485 /* advance :: This shorthand is, depending on */
1486 /* @FT_LOAD_IGNORE_TRANSFORM, the transformed */
1487 /* advance width for the glyph (in 26.6 */
1488 /* fractional pixel format). As specified with */
1489 /* @FT_LOAD_VERTICAL_LAYOUT, it uses either the */
1490 /* `horiAdvance' or the `vertAdvance' value of */
1491 /* `metrics' field. */
1493 /* format :: This field indicates the format of the image */
1494 /* contained in the glyph slot. Typically */
1495 /* @FT_GLYPH_FORMAT_BITMAP, */
1496 /* @FT_GLYPH_FORMAT_OUTLINE, or */
1497 /* @FT_GLYPH_FORMAT_COMPOSITE, but others are */
1500 /* bitmap :: This field is used as a bitmap descriptor */
1501 /* when the slot format is */
1502 /* @FT_GLYPH_FORMAT_BITMAP. Note that the */
1503 /* address and content of the bitmap buffer can */
1504 /* change between calls of @FT_Load_Glyph and a */
1505 /* few other functions. */
1507 /* bitmap_left :: This is the bitmap's left bearing expressed */
1508 /* in integer pixels. Of course, this is only */
1509 /* valid if the format is */
1510 /* @FT_GLYPH_FORMAT_BITMAP. */
1512 /* bitmap_top :: This is the bitmap's top bearing expressed in */
1513 /* integer pixels. Remember that this is the */
1514 /* distance from the baseline to the top-most */
1515 /* glyph scanline, upwards y~coordinates being */
1518 /* outline :: The outline descriptor for the current glyph */
1519 /* image if its format is */
1520 /* @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is */
1521 /* loaded, `outline' can be transformed, */
1522 /* distorted, embolded, etc. However, it must */
1525 /* num_subglyphs :: The number of subglyphs in a composite glyph. */
1526 /* This field is only valid for the composite */
1527 /* glyph format that should normally only be */
1528 /* loaded with the @FT_LOAD_NO_RECURSE flag. */
1529 /* For now this is internal to FreeType. */
1531 /* subglyphs :: An array of subglyph descriptors for */
1532 /* composite glyphs. There are `num_subglyphs' */
1533 /* elements in there. Currently internal to */
1536 /* control_data :: Certain font drivers can also return the */
1537 /* control data for a given glyph image (e.g. */
1538 /* TrueType bytecode, Type~1 charstrings, etc.). */
1539 /* This field is a pointer to such data. */
1541 /* control_len :: This is the length in bytes of the control */
1544 /* other :: Really wicked formats can use this pointer to */
1545 /* present their own glyph image to client */
1546 /* applications. Note that the application */
1547 /* needs to know about the image format. */
1549 /* lsb_delta :: The difference between hinted and unhinted */
1550 /* left side bearing while autohinting is */
1551 /* active. Zero otherwise. */
1553 /* rsb_delta :: The difference between hinted and unhinted */
1554 /* right side bearing while autohinting is */
1555 /* active. Zero otherwise. */
1558 /* If @FT_Load_Glyph is called with default flags (see */
1559 /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */
1560 /* its native format (e.g., an outline glyph for TrueType and Type~1 */
1563 /* This image can later be converted into a bitmap by calling */
1564 /* @FT_Render_Glyph. This function finds the current renderer for */
1565 /* the native image's format, then invokes it. */
1567 /* The renderer is in charge of transforming the native image through */
1568 /* the slot's face transformation fields, then converting it into a */
1569 /* bitmap that is returned in `slot->bitmap'. */
1571 /* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */
1572 /* to specify the position of the bitmap relative to the current pen */
1573 /* position (e.g., coordinates (0,0) on the baseline). Of course, */
1574 /* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */
1577 /* Here a small pseudo code fragment which shows how to use */
1578 /* `lsb_delta' and `rsb_delta': */
1581 /* FT_Pos origin_x = 0; */
1582 /* FT_Pos prev_rsb_delta = 0; */
1585 /* for all glyphs do */
1586 /* <compute kern between current and previous glyph and add it to */
1589 /* <load glyph with `FT_Load_Glyph'> */
1591 /* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */
1592 /* origin_x -= 64; */
1593 /* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */
1594 /* origin_x += 64; */
1596 /* prev_rsb_delta = face->glyph->rsb_delta; */
1598 /* <save glyph image, or render glyph, or ...> */
1600 /* origin_x += face->glyph->advance.x; */
1604 typedef struct FT_GlyphSlotRec_
1609 FT_UInt reserved
; /* retained for binary compatibility */
1612 FT_Glyph_Metrics metrics
;
1613 FT_Fixed linearHoriAdvance
;
1614 FT_Fixed linearVertAdvance
;
1617 FT_Glyph_Format format
;
1625 FT_UInt num_subglyphs
;
1626 FT_SubGlyph subglyphs
;
1636 FT_Slot_Internal internal
;
1641 /*************************************************************************/
1642 /*************************************************************************/
1644 /* F U N C T I O N S */
1646 /*************************************************************************/
1647 /*************************************************************************/
1650 /*************************************************************************/
1653 /* FT_Init_FreeType */
1656 /* Initialize a new FreeType library object. The set of modules */
1657 /* that are registered by this function is determined at build time. */
1660 /* alibrary :: A handle to a new library object. */
1663 /* FreeType error code. 0~means success. */
1666 /* In case you want to provide your own memory allocating routines, */
1667 /* use @FT_New_Library instead, followed by a call to */
1668 /* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module). */
1670 FT_EXPORT( FT_Error
)
1671 FT_Init_FreeType( FT_Library
*alibrary
);
1674 /*************************************************************************/
1677 /* FT_Done_FreeType */
1680 /* Destroy a given FreeType library object and all of its children, */
1681 /* including resources, drivers, faces, sizes, etc. */
1684 /* library :: A handle to the target library object. */
1687 /* FreeType error code. 0~means success. */
1689 FT_EXPORT( FT_Error
)
1690 FT_Done_FreeType( FT_Library library
);
1693 /*************************************************************************/
1699 /* A list of bit-field constants used within the `flags' field of the */
1700 /* @FT_Open_Args structure. */
1703 /* FT_OPEN_MEMORY :: This is a memory-based stream. */
1705 /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */
1707 /* FT_OPEN_PATHNAME :: Create a new input stream from a C~path */
1710 /* FT_OPEN_DRIVER :: Use the `driver' field. */
1712 /* FT_OPEN_PARAMS :: Use the `num_params' and `params' fields. */
1714 /* ft_open_memory :: Deprecated; use @FT_OPEN_MEMORY instead. */
1716 /* ft_open_stream :: Deprecated; use @FT_OPEN_STREAM instead. */
1718 /* ft_open_pathname :: Deprecated; use @FT_OPEN_PATHNAME instead. */
1720 /* ft_open_driver :: Deprecated; use @FT_OPEN_DRIVER instead. */
1722 /* ft_open_params :: Deprecated; use @FT_OPEN_PARAMS instead. */
1725 /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */
1726 /* flags are mutually exclusive. */
1728 #define FT_OPEN_MEMORY 0x1
1729 #define FT_OPEN_STREAM 0x2
1730 #define FT_OPEN_PATHNAME 0x4
1731 #define FT_OPEN_DRIVER 0x8
1732 #define FT_OPEN_PARAMS 0x10
1734 #define ft_open_memory FT_OPEN_MEMORY /* deprecated */
1735 #define ft_open_stream FT_OPEN_STREAM /* deprecated */
1736 #define ft_open_pathname FT_OPEN_PATHNAME /* deprecated */
1737 #define ft_open_driver FT_OPEN_DRIVER /* deprecated */
1738 #define ft_open_params FT_OPEN_PARAMS /* deprecated */
1741 /*************************************************************************/
1747 /* A simple structure used to pass more or less generic parameters to */
1748 /* @FT_Open_Face. */
1751 /* tag :: A four-byte identification tag. */
1753 /* data :: A pointer to the parameter data. */
1756 /* The ID and function of parameters are driver-specific. See the */
1757 /* various FT_PARAM_TAG_XXX flags for more information. */
1759 typedef struct FT_Parameter_
1767 /*************************************************************************/
1773 /* A structure used to indicate how to open a new font file or */
1774 /* stream. A pointer to such a structure can be used as a parameter */
1775 /* for the functions @FT_Open_Face and @FT_Attach_Stream. */
1778 /* flags :: A set of bit flags indicating how to use the */
1781 /* memory_base :: The first byte of the file in memory. */
1783 /* memory_size :: The size in bytes of the file in memory. */
1785 /* pathname :: A pointer to an 8-bit file pathname. */
1787 /* stream :: A handle to a source stream object. */
1789 /* driver :: This field is exclusively used by @FT_Open_Face; */
1790 /* it simply specifies the font driver to use to open */
1791 /* the face. If set to~0, FreeType tries to load the */
1792 /* face with each one of the drivers in its list. */
1794 /* num_params :: The number of extra parameters. */
1796 /* params :: Extra parameters passed to the font driver when */
1797 /* opening a new face. */
1800 /* The stream type is determined by the contents of `flags' which */
1801 /* are tested in the following order by @FT_Open_Face: */
1803 /* If the `FT_OPEN_MEMORY' bit is set, assume that this is a */
1804 /* memory file of `memory_size' bytes, located at `memory_address'. */
1805 /* The data are are not copied, and the client is responsible for */
1806 /* releasing and destroying them _after_ the corresponding call to */
1807 /* @FT_Done_Face. */
1809 /* Otherwise, if the `FT_OPEN_STREAM' bit is set, assume that a */
1810 /* custom input stream `stream' is used. */
1812 /* Otherwise, if the `FT_OPEN_PATHNAME' bit is set, assume that this */
1813 /* is a normal file and use `pathname' to open it. */
1815 /* If the `FT_OPEN_DRIVER' bit is set, @FT_Open_Face only tries to */
1816 /* open the file with the driver whose handler is in `driver'. */
1818 /* If the `FT_OPEN_PARAMS' bit is set, the parameters given by */
1819 /* `num_params' and `params' is used. They are ignored otherwise. */
1821 /* Ideally, both the `pathname' and `params' fields should be tagged */
1822 /* as `const'; this is missing for API backwards compatibility. In */
1823 /* other words, applications should treat them as read-only. */
1825 typedef struct FT_Open_Args_
1828 const FT_Byte
* memory_base
;
1829 FT_Long memory_size
;
1830 FT_String
* pathname
;
1834 FT_Parameter
* params
;
1839 /*************************************************************************/
1845 /* This function calls @FT_Open_Face to open a font by its pathname. */
1848 /* library :: A handle to the library resource. */
1851 /* pathname :: A path to the font file. */
1853 /* face_index :: The index of the face within the font. The first */
1854 /* face has index~0. */
1857 /* aface :: A handle to a new face object. If `face_index' is */
1858 /* greater than or equal to zero, it must be non-NULL. */
1859 /* See @FT_Open_Face for more details. */
1862 /* FreeType error code. 0~means success. */
1864 FT_EXPORT( FT_Error
)
1865 FT_New_Face( FT_Library library
,
1866 const char* filepathname
,
1871 /*************************************************************************/
1874 /* FT_New_Memory_Face */
1877 /* This function calls @FT_Open_Face to open a font which has been */
1878 /* loaded into memory. */
1881 /* library :: A handle to the library resource. */
1884 /* file_base :: A pointer to the beginning of the font data. */
1886 /* file_size :: The size of the memory chunk used by the font data. */
1888 /* face_index :: The index of the face within the font. The first */
1889 /* face has index~0. */
1892 /* aface :: A handle to a new face object. If `face_index' is */
1893 /* greater than or equal to zero, it must be non-NULL. */
1894 /* See @FT_Open_Face for more details. */
1897 /* FreeType error code. 0~means success. */
1900 /* You must not deallocate the memory before calling @FT_Done_Face. */
1902 FT_EXPORT( FT_Error
)
1903 FT_New_Memory_Face( FT_Library library
,
1904 const FT_Byte
* file_base
,
1910 /*************************************************************************/
1916 /* Create a face object from a given resource described by */
1917 /* @FT_Open_Args. */
1920 /* library :: A handle to the library resource. */
1923 /* args :: A pointer to an `FT_Open_Args' structure which must */
1924 /* be filled by the caller. */
1926 /* face_index :: The index of the face within the font. The first */
1927 /* face has index~0. */
1930 /* aface :: A handle to a new face object. If `face_index' is */
1931 /* greater than or equal to zero, it must be non-NULL. */
1932 /* See note below. */
1935 /* FreeType error code. 0~means success. */
1938 /* Unlike FreeType 1.x, this function automatically creates a glyph */
1939 /* slot for the face object which can be accessed directly through */
1940 /* `face->glyph'. */
1942 /* FT_Open_Face can be used to quickly check whether the font */
1943 /* format of a given font resource is supported by FreeType. If the */
1944 /* `face_index' field is negative, the function's return value is~0 */
1945 /* if the font format is recognized, or non-zero otherwise; */
1946 /* the function returns a more or less empty face handle in `*aface' */
1947 /* (if `aface' isn't NULL). The only useful field in this special */
1948 /* case is `face->num_faces' which gives the number of faces within */
1949 /* the font file. After examination, the returned @FT_Face structure */
1950 /* should be deallocated with a call to @FT_Done_Face. */
1952 /* Each new face object created with this function also owns a */
1953 /* default @FT_Size object, accessible as `face->size'. */
1955 FT_EXPORT( FT_Error
)
1956 FT_Open_Face( FT_Library library
,
1957 const FT_Open_Args
* args
,
1962 /*************************************************************************/
1965 /* FT_Attach_File */
1968 /* This function calls @FT_Attach_Stream to attach a file. */
1971 /* face :: The target face object. */
1974 /* filepathname :: The pathname. */
1977 /* FreeType error code. 0~means success. */
1979 FT_EXPORT( FT_Error
)
1980 FT_Attach_File( FT_Face face
,
1981 const char* filepathname
);
1984 /*************************************************************************/
1987 /* FT_Attach_Stream */
1990 /* `Attach' data to a face object. Normally, this is used to read */
1991 /* additional information for the face object. For example, you can */
1992 /* attach an AFM file that comes with a Type~1 font to get the */
1993 /* kerning values and other metrics. */
1996 /* face :: The target face object. */
1999 /* parameters :: A pointer to @FT_Open_Args which must be filled by */
2003 /* FreeType error code. 0~means success. */
2006 /* The meaning of the `attach' (i.e., what really happens when the */
2007 /* new file is read) is not fixed by FreeType itself. It really */
2008 /* depends on the font format (and thus the font driver). */
2010 /* Client applications are expected to know what they are doing */
2011 /* when invoking this function. Most drivers simply do not implement */
2012 /* file attachments. */
2014 FT_EXPORT( FT_Error
)
2015 FT_Attach_Stream( FT_Face face
,
2016 FT_Open_Args
* parameters
);
2019 /*************************************************************************/
2025 /* Discard a given face object, as well as all of its child slots and */
2029 /* face :: A handle to a target face object. */
2032 /* FreeType error code. 0~means success. */
2034 FT_EXPORT( FT_Error
)
2035 FT_Done_Face( FT_Face face
);
2038 /*************************************************************************/
2041 /* FT_Select_Size */
2044 /* Select a bitmap strike. */
2047 /* face :: A handle to a target face object. */
2050 /* strike_index :: The index of the bitmap strike in the */
2051 /* `available_sizes' field of @FT_FaceRec structure. */
2054 /* FreeType error code. 0~means success. */
2056 FT_EXPORT( FT_Error
)
2057 FT_Select_Size( FT_Face face
,
2058 FT_Int strike_index
);
2061 /*************************************************************************/
2064 /* FT_Size_Request_Type */
2067 /* An enumeration type that lists the supported size request types. */
2070 /* FT_SIZE_REQUEST_TYPE_NOMINAL :: */
2071 /* The nominal size. The `units_per_EM' field of @FT_FaceRec is */
2072 /* used to determine both scaling values. */
2074 /* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */
2075 /* The real dimension. The sum of the the `Ascender' and (minus */
2076 /* of) the `Descender' fields of @FT_FaceRec are used to determine */
2077 /* both scaling values. */
2079 /* FT_SIZE_REQUEST_TYPE_BBOX :: */
2080 /* The font bounding box. The width and height of the `bbox' field */
2081 /* of @FT_FaceRec are used to determine the horizontal and vertical */
2082 /* scaling value, respectively. */
2084 /* FT_SIZE_REQUEST_TYPE_CELL :: */
2085 /* The `max_advance_width' field of @FT_FaceRec is used to */
2086 /* determine the horizontal scaling value; the vertical scaling */
2087 /* value is determined the same way as */
2088 /* @FT_SIZE_REQUEST_TYPE_REAL_DIM does. Finally, both scaling */
2089 /* values are set to the smaller one. This type is useful if you */
2090 /* want to specify the font size for, say, a window of a given */
2091 /* dimension and 80x24 cells. */
2093 /* FT_SIZE_REQUEST_TYPE_SCALES :: */
2094 /* Specify the scaling values directly. */
2097 /* The above descriptions only apply to scalable formats. For bitmap */
2098 /* formats, the behaviour is up to the driver. */
2100 /* See the note section of @FT_Size_Metrics if you wonder how size */
2101 /* requesting relates to scaling values. */
2103 typedef enum FT_Size_Request_Type_
2105 FT_SIZE_REQUEST_TYPE_NOMINAL
,
2106 FT_SIZE_REQUEST_TYPE_REAL_DIM
,
2107 FT_SIZE_REQUEST_TYPE_BBOX
,
2108 FT_SIZE_REQUEST_TYPE_CELL
,
2109 FT_SIZE_REQUEST_TYPE_SCALES
,
2111 FT_SIZE_REQUEST_TYPE_MAX
2113 } FT_Size_Request_Type
;
2116 /*************************************************************************/
2119 /* FT_Size_RequestRec */
2122 /* A structure used to model a size request. */
2125 /* type :: See @FT_Size_Request_Type. */
2127 /* width :: The desired width. */
2129 /* height :: The desired height. */
2131 /* horiResolution :: The horizontal resolution. If set to zero, */
2132 /* `width' is treated as a 26.6 fractional pixel */
2135 /* vertResolution :: The vertical resolution. If set to zero, */
2136 /* `height' is treated as a 26.6 fractional pixel */
2140 /* If `width' is zero, then the horizontal scaling value is set equal */
2141 /* to the vertical scaling value, and vice versa. */
2143 typedef struct FT_Size_RequestRec_
2145 FT_Size_Request_Type type
;
2148 FT_UInt horiResolution
;
2149 FT_UInt vertResolution
;
2151 } FT_Size_RequestRec
;
2154 /*************************************************************************/
2157 /* FT_Size_Request */
2160 /* A handle to a size request structure. */
2162 typedef struct FT_Size_RequestRec_
*FT_Size_Request
;
2165 /*************************************************************************/
2168 /* FT_Request_Size */
2171 /* Resize the scale of the active @FT_Size object in a face. */
2174 /* face :: A handle to a target face object. */
2177 /* req :: A pointer to a @FT_Size_RequestRec. */
2180 /* FreeType error code. 0~means success. */
2183 /* Although drivers may select the bitmap strike matching the */
2184 /* request, you should not rely on this if you intend to select a */
2185 /* particular bitmap strike. Use @FT_Select_Size instead in that */
2188 FT_EXPORT( FT_Error
)
2189 FT_Request_Size( FT_Face face
,
2190 FT_Size_Request req
);
2193 /*************************************************************************/
2196 /* FT_Set_Char_Size */
2199 /* This function calls @FT_Request_Size to request the nominal size */
2203 /* face :: A handle to a target face object. */
2206 /* char_width :: The nominal width, in 26.6 fractional points. */
2208 /* char_height :: The nominal height, in 26.6 fractional points. */
2210 /* horz_resolution :: The horizontal resolution in dpi. */
2212 /* vert_resolution :: The vertical resolution in dpi. */
2215 /* FreeType error code. 0~means success. */
2218 /* If either the character width or height is zero, it is set equal */
2219 /* to the other value. */
2221 /* If either the horizontal or vertical resolution is zero, it is set */
2222 /* equal to the other value. */
2224 /* A character width or height smaller than 1pt is set to 1pt; if */
2225 /* both resolution values are zero, they are set to 72dpi. */
2227 /* Don't use this function if you are using the FreeType cache API. */
2229 FT_EXPORT( FT_Error
)
2230 FT_Set_Char_Size( FT_Face face
,
2231 FT_F26Dot6 char_width
,
2232 FT_F26Dot6 char_height
,
2233 FT_UInt horz_resolution
,
2234 FT_UInt vert_resolution
);
2237 /*************************************************************************/
2240 /* FT_Set_Pixel_Sizes */
2243 /* This function calls @FT_Request_Size to request the nominal size */
2247 /* face :: A handle to the target face object. */
2250 /* pixel_width :: The nominal width, in pixels. */
2252 /* pixel_height :: The nominal height, in pixels. */
2255 /* FreeType error code. 0~means success. */
2257 FT_EXPORT( FT_Error
)
2258 FT_Set_Pixel_Sizes( FT_Face face
,
2259 FT_UInt pixel_width
,
2260 FT_UInt pixel_height
);
2263 /*************************************************************************/
2269 /* A function used to load a single glyph into the glyph slot of a */
2273 /* face :: A handle to the target face object where the glyph */
2277 /* glyph_index :: The index of the glyph in the font file. For */
2278 /* CID-keyed fonts (either in PS or in CFF format) */
2279 /* this argument specifies the CID value. */
2281 /* load_flags :: A flag indicating what to load for this glyph. The */
2282 /* @FT_LOAD_XXX constants can be used to control the */
2283 /* glyph loading process (e.g., whether the outline */
2284 /* should be scaled, whether to load bitmaps or not, */
2285 /* whether to hint the outline, etc). */
2288 /* FreeType error code. 0~means success. */
2291 /* The loaded glyph may be transformed. See @FT_Set_Transform for */
2294 /* For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is */
2295 /* returned for invalid CID values (this is, for CID values which */
2296 /* don't have a corresponding glyph in the font). See the discussion */
2297 /* of the @FT_FACE_FLAG_CID_KEYED flag for more details. */
2299 FT_EXPORT( FT_Error
)
2300 FT_Load_Glyph( FT_Face face
,
2301 FT_UInt glyph_index
,
2302 FT_Int32 load_flags
);
2305 /*************************************************************************/
2311 /* A function used to load a single glyph into the glyph slot of a */
2312 /* face object, according to its character code. */
2315 /* face :: A handle to a target face object where the glyph */
2319 /* char_code :: The glyph's character code, according to the */
2320 /* current charmap used in the face. */
2322 /* load_flags :: A flag indicating what to load for this glyph. The */
2323 /* @FT_LOAD_XXX constants can be used to control the */
2324 /* glyph loading process (e.g., whether the outline */
2325 /* should be scaled, whether to load bitmaps or not, */
2326 /* whether to hint the outline, etc). */
2329 /* FreeType error code. 0~means success. */
2332 /* This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph. */
2334 FT_EXPORT( FT_Error
)
2335 FT_Load_Char( FT_Face face
,
2337 FT_Int32 load_flags
);
2340 /*************************************************************************
2346 * A list of bit-field constants used with @FT_Load_Glyph to indicate
2347 * what kind of operations to perform during glyph loading.
2350 * FT_LOAD_DEFAULT ::
2351 * Corresponding to~0, this value is used as the default glyph load
2352 * operation. In this case, the following happens:
2354 * 1. FreeType looks for a bitmap for the glyph corresponding to the
2355 * face's current size. If one is found, the function returns.
2356 * The bitmap data can be accessed from the glyph slot (see note
2359 * 2. If no embedded bitmap is searched or found, FreeType looks for a
2360 * scalable outline. If one is found, it is loaded from the font
2361 * file, scaled to device pixels, then `hinted' to the pixel grid
2362 * in order to optimize it. The outline data can be accessed from
2363 * the glyph slot (see note below).
2365 * Note that by default, the glyph loader doesn't render outlines into
2366 * bitmaps. The following flags are used to modify this default
2367 * behaviour to more specific and useful cases.
2369 * FT_LOAD_NO_SCALE ::
2370 * Don't scale the outline glyph loaded, but keep it in font units.
2372 * This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and
2373 * unsets @FT_LOAD_RENDER.
2375 * FT_LOAD_NO_HINTING ::
2376 * Disable hinting. This generally generates `blurrier' bitmap glyph
2377 * when the glyph is rendered in any of the anti-aliased modes. See
2378 * also the note below.
2380 * This flag is implied by @FT_LOAD_NO_SCALE.
2383 * Call @FT_Render_Glyph after the glyph is loaded. By default, the
2384 * glyph is rendered in @FT_RENDER_MODE_NORMAL mode. This can be
2385 * overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME.
2387 * This flag is unset by @FT_LOAD_NO_SCALE.
2389 * FT_LOAD_NO_BITMAP ::
2390 * Ignore bitmap strikes when loading. Bitmap-only fonts ignore this
2393 * @FT_LOAD_NO_SCALE always sets this flag.
2395 * FT_LOAD_VERTICAL_LAYOUT ::
2396 * Load the glyph for vertical text layout. _Don't_ use it as it is
2397 * problematic currently.
2399 * FT_LOAD_FORCE_AUTOHINT ::
2400 * Indicates that the auto-hinter is preferred over the font's native
2401 * hinter. See also the note below.
2403 * FT_LOAD_CROP_BITMAP ::
2404 * Indicates that the font driver should crop the loaded bitmap glyph
2405 * (i.e., remove all space around its black bits). Not all drivers
2408 * FT_LOAD_PEDANTIC ::
2409 * Indicates that the font driver should perform pedantic verifications
2410 * during glyph loading. This is mostly used to detect broken glyphs
2411 * in fonts. By default, FreeType tries to handle broken fonts also.
2413 * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ::
2414 * Indicates that the font driver should ignore the global advance
2415 * width defined in the font. By default, that value is used as the
2416 * advance width for all glyphs when the face has
2417 * @FT_FACE_FLAG_FIXED_WIDTH set.
2419 * This flag exists for historical reasons (to support buggy CJK
2422 * FT_LOAD_NO_RECURSE ::
2423 * This flag is only used internally. It merely indicates that the
2424 * font driver should not load composite glyphs recursively. Instead,
2425 * it should set the `num_subglyph' and `subglyphs' values of the
2426 * glyph slot accordingly, and set `glyph->format' to
2427 * @FT_GLYPH_FORMAT_COMPOSITE.
2429 * The description of sub-glyphs is not available to client
2430 * applications for now.
2432 * This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM.
2434 * FT_LOAD_IGNORE_TRANSFORM ::
2435 * Indicates that the transform matrix set by @FT_Set_Transform should
2438 * FT_LOAD_MONOCHROME ::
2439 * This flag is used with @FT_LOAD_RENDER to indicate that you want to
2440 * render an outline glyph to a 1-bit monochrome bitmap glyph, with
2441 * 8~pixels packed into each byte of the bitmap data.
2443 * Note that this has no effect on the hinting algorithm used. You
2444 * should rather use @FT_LOAD_TARGET_MONO so that the
2445 * monochrome-optimized hinting algorithm is used.
2447 * FT_LOAD_LINEAR_DESIGN ::
2448 * Indicates that the `linearHoriAdvance' and `linearVertAdvance'
2449 * fields of @FT_GlyphSlotRec should be kept in font units. See
2450 * @FT_GlyphSlotRec for details.
2452 * FT_LOAD_NO_AUTOHINT ::
2453 * Disable auto-hinter. See also the note below.
2456 * By default, hinting is enabled and the font's native hinter (see
2457 * @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can
2458 * disable hinting by setting @FT_LOAD_NO_HINTING or change the
2459 * precedence by setting @FT_LOAD_FORCE_AUTOHINT. You can also set
2460 * @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be
2463 * See the description of @FT_FACE_FLAG_TRICKY for a special exception
2464 * (affecting only a handful of Asian fonts).
2466 * Besides deciding which hinter to use, you can also decide which
2467 * hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details.
2470 #define FT_LOAD_DEFAULT 0x0
2471 #define FT_LOAD_NO_SCALE 0x1
2472 #define FT_LOAD_NO_HINTING 0x2
2473 #define FT_LOAD_RENDER 0x4
2474 #define FT_LOAD_NO_BITMAP 0x8
2475 #define FT_LOAD_VERTICAL_LAYOUT 0x10
2476 #define FT_LOAD_FORCE_AUTOHINT 0x20
2477 #define FT_LOAD_CROP_BITMAP 0x40
2478 #define FT_LOAD_PEDANTIC 0x80
2479 #define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH 0x200
2480 #define FT_LOAD_NO_RECURSE 0x400
2481 #define FT_LOAD_IGNORE_TRANSFORM 0x800
2482 #define FT_LOAD_MONOCHROME 0x1000
2483 #define FT_LOAD_LINEAR_DESIGN 0x2000
2484 #define FT_LOAD_NO_AUTOHINT 0x8000U
2488 /* used internally only by certain font drivers! */
2489 #define FT_LOAD_ADVANCE_ONLY 0x100
2490 #define FT_LOAD_SBITS_ONLY 0x4000
2493 /**************************************************************************
2496 * FT_LOAD_TARGET_XXX
2499 * A list of values that are used to select a specific hinting algorithm
2500 * to use by the hinter. You should OR one of these values to your
2501 * `load_flags' when calling @FT_Load_Glyph.
2503 * Note that font's native hinters may ignore the hinting algorithm you
2504 * have specified (e.g., the TrueType bytecode interpreter). You can set
2505 * @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used.
2507 * Also note that @FT_LOAD_TARGET_LIGHT is an exception, in that it
2508 * always implies @FT_LOAD_FORCE_AUTOHINT.
2511 * FT_LOAD_TARGET_NORMAL ::
2512 * This corresponds to the default hinting algorithm, optimized for
2513 * standard gray-level rendering. For monochrome output, use
2514 * @FT_LOAD_TARGET_MONO instead.
2516 * FT_LOAD_TARGET_LIGHT ::
2517 * A lighter hinting algorithm for non-monochrome modes. Many
2518 * generated glyphs are more fuzzy but better resemble its original
2519 * shape. A bit like rendering on Mac OS~X.
2521 * As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT.
2523 * FT_LOAD_TARGET_MONO ::
2524 * Strong hinting algorithm that should only be used for monochrome
2525 * output. The result is probably unpleasant if the glyph is rendered
2526 * in non-monochrome modes.
2528 * FT_LOAD_TARGET_LCD ::
2529 * A variant of @FT_LOAD_TARGET_NORMAL optimized for horizontally
2530 * decimated LCD displays.
2532 * FT_LOAD_TARGET_LCD_V ::
2533 * A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically
2534 * decimated LCD displays.
2537 * You should use only _one_ of the FT_LOAD_TARGET_XXX values in your
2538 * `load_flags'. They can't be ORed.
2540 * If @FT_LOAD_RENDER is also set, the glyph is rendered in the
2541 * corresponding mode (i.e., the mode which matches the used algorithm
2542 * best) unless @FT_LOAD_MONOCHROME is set.
2544 * You can use a hinting algorithm that doesn't correspond to the same
2545 * rendering mode. As an example, it is possible to use the `light'
2546 * hinting algorithm and have the results rendered in horizontal LCD
2547 * pixel mode, with code like
2550 * FT_Load_Glyph( face, glyph_index,
2551 * load_flags | FT_LOAD_TARGET_LIGHT );
2553 * FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD );
2557 #define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 )
2559 #define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
2560 #define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT )
2561 #define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO )
2562 #define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
2563 #define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
2566 /**************************************************************************
2569 * FT_LOAD_TARGET_MODE
2572 * Return the @FT_Render_Mode corresponding to a given
2573 * @FT_LOAD_TARGET_XXX value.
2576 #define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
2579 /*************************************************************************/
2582 /* FT_Set_Transform */
2585 /* A function used to set the transformation that is applied to glyph */
2586 /* images when they are loaded into a glyph slot through */
2587 /* @FT_Load_Glyph. */
2590 /* face :: A handle to the source face object. */
2593 /* matrix :: A pointer to the transformation's 2x2 matrix. Use~0 for */
2594 /* the identity matrix. */
2595 /* delta :: A pointer to the translation vector. Use~0 for the null */
2599 /* The transformation is only applied to scalable image formats after */
2600 /* the glyph has been loaded. It means that hinting is unaltered by */
2601 /* the transformation and is performed on the character size given in */
2602 /* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */
2604 /* Note that this also transforms the `face.glyph.advance' field, but */
2605 /* *not* the values in `face.glyph.metrics'. */
2608 FT_Set_Transform( FT_Face face
,
2613 /*************************************************************************/
2616 /* FT_Render_Mode */
2619 /* An enumeration type that lists the render modes supported by */
2620 /* FreeType~2. Each mode corresponds to a specific type of scanline */
2621 /* conversion performed on the outline. */
2623 /* For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode' */
2624 /* field in the @FT_GlyphSlotRec structure gives the format of the */
2625 /* returned bitmap. */
2627 /* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity. */
2630 /* FT_RENDER_MODE_NORMAL :: */
2631 /* This is the default render mode; it corresponds to 8-bit */
2632 /* anti-aliased bitmaps. */
2634 /* FT_RENDER_MODE_LIGHT :: */
2635 /* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */
2636 /* defined as a separate value because render modes are also used */
2637 /* indirectly to define hinting algorithm selectors. See */
2638 /* @FT_LOAD_TARGET_XXX for details. */
2640 /* FT_RENDER_MODE_MONO :: */
2641 /* This mode corresponds to 1-bit bitmaps (with 2~levels of */
2644 /* FT_RENDER_MODE_LCD :: */
2645 /* This mode corresponds to horizontal RGB and BGR sub-pixel */
2646 /* displays like LCD screens. It produces 8-bit bitmaps that are */
2647 /* 3~times the width of the original glyph outline in pixels, and */
2648 /* which use the @FT_PIXEL_MODE_LCD mode. */
2650 /* FT_RENDER_MODE_LCD_V :: */
2651 /* This mode corresponds to vertical RGB and BGR sub-pixel displays */
2652 /* (like PDA screens, rotated LCD displays, etc.). It produces */
2653 /* 8-bit bitmaps that are 3~times the height of the original */
2654 /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */
2657 /* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph can be */
2658 /* filtered to reduce color-fringes by using @FT_Library_SetLcdFilter */
2659 /* (not active in the default builds). It is up to the caller to */
2660 /* either call @FT_Library_SetLcdFilter (if available) or do the */
2661 /* filtering itself. */
2663 /* The selected render mode only affects vector glyphs of a font. */
2664 /* Embedded bitmaps often have a different pixel mode like */
2665 /* @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform */
2666 /* them into 8-bit pixmaps. */
2668 typedef enum FT_Render_Mode_
2670 FT_RENDER_MODE_NORMAL
= 0,
2671 FT_RENDER_MODE_LIGHT
,
2672 FT_RENDER_MODE_MONO
,
2674 FT_RENDER_MODE_LCD_V
,
2681 /*************************************************************************/
2684 /* ft_render_mode_xxx */
2687 /* These constants are deprecated. Use the corresponding */
2688 /* @FT_Render_Mode values instead. */
2691 /* ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL */
2692 /* ft_render_mode_mono :: see @FT_RENDER_MODE_MONO */
2694 #define ft_render_mode_normal FT_RENDER_MODE_NORMAL
2695 #define ft_render_mode_mono FT_RENDER_MODE_MONO
2698 /*************************************************************************/
2701 /* FT_Render_Glyph */
2704 /* Convert a given glyph image to a bitmap. It does so by inspecting */
2705 /* the glyph image format, finding the relevant renderer, and */
2709 /* slot :: A handle to the glyph slot containing the image to */
2713 /* render_mode :: This is the render mode used to render the glyph */
2714 /* image into a bitmap. See @FT_Render_Mode for a */
2715 /* list of possible values. */
2718 /* FreeType error code. 0~means success. */
2720 FT_EXPORT( FT_Error
)
2721 FT_Render_Glyph( FT_GlyphSlot slot
,
2722 FT_Render_Mode render_mode
);
2725 /*************************************************************************/
2728 /* FT_Kerning_Mode */
2731 /* An enumeration used to specify which kerning values to return in */
2732 /* @FT_Get_Kerning. */
2735 /* FT_KERNING_DEFAULT :: Return scaled and grid-fitted kerning */
2736 /* distances (value is~0). */
2738 /* FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning */
2741 /* FT_KERNING_UNSCALED :: Return the kerning vector in original font */
2744 typedef enum FT_Kerning_Mode_
2746 FT_KERNING_DEFAULT
= 0,
2747 FT_KERNING_UNFITTED
,
2753 /*************************************************************************/
2756 /* ft_kerning_default */
2759 /* This constant is deprecated. Please use @FT_KERNING_DEFAULT */
2762 #define ft_kerning_default FT_KERNING_DEFAULT
2765 /*************************************************************************/
2768 /* ft_kerning_unfitted */
2771 /* This constant is deprecated. Please use @FT_KERNING_UNFITTED */
2774 #define ft_kerning_unfitted FT_KERNING_UNFITTED
2777 /*************************************************************************/
2780 /* ft_kerning_unscaled */
2783 /* This constant is deprecated. Please use @FT_KERNING_UNSCALED */
2786 #define ft_kerning_unscaled FT_KERNING_UNSCALED
2789 /*************************************************************************/
2792 /* FT_Get_Kerning */
2795 /* Return the kerning vector between two glyphs of a same face. */
2798 /* face :: A handle to a source face object. */
2800 /* left_glyph :: The index of the left glyph in the kern pair. */
2802 /* right_glyph :: The index of the right glyph in the kern pair. */
2804 /* kern_mode :: See @FT_Kerning_Mode for more information. */
2805 /* Determines the scale and dimension of the returned */
2806 /* kerning vector. */
2809 /* akerning :: The kerning vector. This is either in font units */
2810 /* or in pixels (26.6 format) for scalable formats, */
2811 /* and in pixels for fixed-sizes formats. */
2814 /* FreeType error code. 0~means success. */
2817 /* Only horizontal layouts (left-to-right & right-to-left) are */
2818 /* supported by this method. Other layouts, or more sophisticated */
2819 /* kernings, are out of the scope of this API function -- they can be */
2820 /* implemented through format-specific interfaces. */
2822 FT_EXPORT( FT_Error
)
2823 FT_Get_Kerning( FT_Face face
,
2825 FT_UInt right_glyph
,
2827 FT_Vector
*akerning
);
2830 /*************************************************************************/
2833 /* FT_Get_Track_Kerning */
2836 /* Return the track kerning for a given face object at a given size. */
2839 /* face :: A handle to a source face object. */
2841 /* point_size :: The point size in 16.16 fractional points. */
2843 /* degree :: The degree of tightness. */
2846 /* akerning :: The kerning in 16.16 fractional points. */
2849 /* FreeType error code. 0~means success. */
2851 FT_EXPORT( FT_Error
)
2852 FT_Get_Track_Kerning( FT_Face face
,
2853 FT_Fixed point_size
,
2855 FT_Fixed
* akerning
);
2858 /*************************************************************************/
2861 /* FT_Get_Glyph_Name */
2864 /* Retrieve the ASCII name of a given glyph in a face. This only */
2865 /* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1. */
2868 /* face :: A handle to a source face object. */
2870 /* glyph_index :: The glyph index. */
2872 /* buffer_max :: The maximal number of bytes available in the */
2876 /* buffer :: A pointer to a target buffer where the name is */
2880 /* FreeType error code. 0~means success. */
2883 /* An error is returned if the face doesn't provide glyph names or if */
2884 /* the glyph index is invalid. In all cases of failure, the first */
2885 /* byte of `buffer' is set to~0 to indicate an empty name. */
2887 /* The glyph name is truncated to fit within the buffer if it is too */
2888 /* long. The returned string is always zero-terminated. */
2890 /* This function is not compiled within the library if the config */
2891 /* macro `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is defined in */
2892 /* `include/freetype/config/ftoptions.h'. */
2894 FT_EXPORT( FT_Error
)
2895 FT_Get_Glyph_Name( FT_Face face
,
2896 FT_UInt glyph_index
,
2898 FT_UInt buffer_max
);
2901 /*************************************************************************/
2904 /* FT_Get_Postscript_Name */
2907 /* Retrieve the ASCII PostScript name of a given face, if available. */
2908 /* This only works with PostScript and TrueType fonts. */
2911 /* face :: A handle to the source face object. */
2914 /* A pointer to the face's PostScript name. NULL if unavailable. */
2917 /* The returned pointer is owned by the face and is destroyed with */
2920 FT_EXPORT( const char* )
2921 FT_Get_Postscript_Name( FT_Face face
);
2924 /*************************************************************************/
2927 /* FT_Select_Charmap */
2930 /* Select a given charmap by its encoding tag (as listed in */
2931 /* `freetype.h'). */
2934 /* face :: A handle to the source face object. */
2937 /* encoding :: A handle to the selected encoding. */
2940 /* FreeType error code. 0~means success. */
2943 /* This function returns an error if no charmap in the face */
2944 /* corresponds to the encoding queried here. */
2946 /* Because many fonts contain more than a single cmap for Unicode */
2947 /* encoding, this function has some special code to select the one */
2948 /* which covers Unicode best (`best' in the sense that a UCS-4 cmap */
2949 /* is preferred to a UCS-2 cmap). It is thus preferable to */
2950 /* @FT_Set_Charmap in this case. */
2952 FT_EXPORT( FT_Error
)
2953 FT_Select_Charmap( FT_Face face
,
2954 FT_Encoding encoding
);
2957 /*************************************************************************/
2960 /* FT_Set_Charmap */
2963 /* Select a given charmap for character code to glyph index mapping. */
2966 /* face :: A handle to the source face object. */
2969 /* charmap :: A handle to the selected charmap. */
2972 /* FreeType error code. 0~means success. */
2975 /* This function returns an error if the charmap is not part of */
2976 /* the face (i.e., if it is not listed in the `face->charmaps' */
2979 /* It also fails if a type~14 charmap is selected. */
2981 FT_EXPORT( FT_Error
)
2982 FT_Set_Charmap( FT_Face face
,
2983 FT_CharMap charmap
);
2986 /*************************************************************************
2989 * FT_Get_Charmap_Index
2992 * Retrieve index of a given charmap.
2996 * A handle to a charmap.
2999 * The index into the array of character maps within the face to which
3000 * `charmap' belongs.
3004 FT_Get_Charmap_Index( FT_CharMap charmap
);
3007 /*************************************************************************/
3010 /* FT_Get_Char_Index */
3013 /* Return the glyph index of a given character code. This function */
3014 /* uses a charmap object to do the mapping. */
3017 /* face :: A handle to the source face object. */
3019 /* charcode :: The character code. */
3022 /* The glyph index. 0~means `undefined character code'. */
3025 /* If you use FreeType to manipulate the contents of font files */
3026 /* directly, be aware that the glyph index returned by this function */
3027 /* doesn't always correspond to the internal indices used within */
3028 /* the file. This is done to ensure that value~0 always corresponds */
3029 /* to the `missing glyph'. */
3031 FT_EXPORT( FT_UInt
)
3032 FT_Get_Char_Index( FT_Face face
,
3033 FT_ULong charcode
);
3036 /*************************************************************************/
3039 /* FT_Get_First_Char */
3042 /* This function is used to return the first character code in the */
3043 /* current charmap of a given face. It also returns the */
3044 /* corresponding glyph index. */
3047 /* face :: A handle to the source face object. */
3050 /* agindex :: Glyph index of first character code. 0~if charmap is */
3054 /* The charmap's first character code. */
3057 /* You should use this function with @FT_Get_Next_Char to be able to */
3058 /* parse all character codes available in a given charmap. The code */
3059 /* should look like this: */
3062 /* FT_ULong charcode; */
3063 /* FT_UInt gindex; */
3066 /* charcode = FT_Get_First_Char( face, &gindex ); */
3067 /* while ( gindex != 0 ) */
3069 /* ... do something with (charcode,gindex) pair ... */
3071 /* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */
3075 /* Note that `*agindex' is set to~0 if the charmap is empty. The */
3076 /* result itself can be~0 in two cases: if the charmap is empty or */
3077 /* if the value~0 is the first valid character code. */
3079 FT_EXPORT( FT_ULong
)
3080 FT_Get_First_Char( FT_Face face
,
3084 /*************************************************************************/
3087 /* FT_Get_Next_Char */
3090 /* This function is used to return the next character code in the */
3091 /* current charmap of a given face following the value `char_code', */
3092 /* as well as the corresponding glyph index. */
3095 /* face :: A handle to the source face object. */
3096 /* char_code :: The starting character code. */
3099 /* agindex :: Glyph index of next character code. 0~if charmap */
3103 /* The charmap's next character code. */
3106 /* You should use this function with @FT_Get_First_Char to walk */
3107 /* over all character codes available in a given charmap. See the */
3108 /* note for this function for a simple code example. */
3110 /* Note that `*agindex' is set to~0 when there are no more codes in */
3113 FT_EXPORT( FT_ULong
)
3114 FT_Get_Next_Char( FT_Face face
,
3119 /*************************************************************************/
3122 /* FT_Get_Name_Index */
3125 /* Return the glyph index of a given glyph name. This function uses */
3126 /* driver specific objects to do the translation. */
3129 /* face :: A handle to the source face object. */
3131 /* glyph_name :: The glyph name. */
3134 /* The glyph index. 0~means `undefined character code'. */
3136 FT_EXPORT( FT_UInt
)
3137 FT_Get_Name_Index( FT_Face face
,
3138 FT_String
* glyph_name
);
3141 /*************************************************************************
3144 * FT_SUBGLYPH_FLAG_XXX
3147 * A list of constants used to describe subglyphs. Please refer to the
3148 * TrueType specification for the meaning of the various flags.
3151 * FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ::
3152 * FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ::
3153 * FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID ::
3154 * FT_SUBGLYPH_FLAG_SCALE ::
3155 * FT_SUBGLYPH_FLAG_XY_SCALE ::
3156 * FT_SUBGLYPH_FLAG_2X2 ::
3157 * FT_SUBGLYPH_FLAG_USE_MY_METRICS ::
3160 #define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1
3161 #define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2
3162 #define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4
3163 #define FT_SUBGLYPH_FLAG_SCALE 8
3164 #define FT_SUBGLYPH_FLAG_XY_SCALE 0x40
3165 #define FT_SUBGLYPH_FLAG_2X2 0x80
3166 #define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
3169 /*************************************************************************
3172 * FT_Get_SubGlyph_Info
3175 * Retrieve a description of a given subglyph. Only use it if
3176 * `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is
3177 * returned otherwise.
3181 * The source glyph slot.
3184 * The index of the subglyph. Must be less than
3185 * `glyph->num_subglyphs'.
3189 * The glyph index of the subglyph.
3192 * The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX.
3195 * The subglyph's first argument (if any).
3198 * The subglyph's second argument (if any).
3201 * The subglyph transformation (if any).
3204 * FreeType error code. 0~means success.
3207 * The values of `*p_arg1', `*p_arg2', and `*p_transform' must be
3208 * interpreted depending on the flags returned in `*p_flags'. See the
3209 * TrueType specification for details.
3212 FT_EXPORT( FT_Error
)
3213 FT_Get_SubGlyph_Info( FT_GlyphSlot glyph
,
3219 FT_Matrix
*p_transform
);
3222 /*************************************************************************/
3228 /* A list of bit flags used in the `fsType' field of the OS/2 table */
3229 /* in a TrueType or OpenType font and the `FSType' entry in a */
3230 /* PostScript font. These bit flags are returned by */
3231 /* @FT_Get_FSType_Flags; they inform client applications of embedding */
3232 /* and subsetting restrictions associated with a font. */
3234 /* See http://www.adobe.com/devnet/acrobat/pdfs/FontPolicies.pdf for */
3238 /* FT_FSTYPE_INSTALLABLE_EMBEDDING :: */
3239 /* Fonts with no fsType bit set may be embedded and permanently */
3240 /* installed on the remote system by an application. */
3242 /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING :: */
3243 /* Fonts that have only this bit set must not be modified, embedded */
3244 /* or exchanged in any manner without first obtaining permission of */
3245 /* the font software copyright owner. */
3247 /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING :: */
3248 /* If this bit is set, the font may be embedded and temporarily */
3249 /* loaded on the remote system. Documents containing Preview & */
3250 /* Print fonts must be opened `read-only'; no edits can be applied */
3251 /* to the document. */
3253 /* FT_FSTYPE_EDITABLE_EMBEDDING :: */
3254 /* If this bit is set, the font may be embedded but must only be */
3255 /* installed temporarily on other systems. In contrast to Preview */
3256 /* & Print fonts, documents containing editable fonts may be opened */
3257 /* for reading, editing is permitted, and changes may be saved. */
3259 /* FT_FSTYPE_NO_SUBSETTING :: */
3260 /* If this bit is set, the font may not be subsetted prior to */
3263 /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY :: */
3264 /* If this bit is set, only bitmaps contained in the font may be */
3265 /* embedded; no outline data may be embedded. If there are no */
3266 /* bitmaps available in the font, then the font is unembeddable. */
3269 /* While the fsType flags can indicate that a font may be embedded, a */
3270 /* license with the font vendor may be separately required to use the */
3271 /* font in this way. */
3273 #define FT_FSTYPE_INSTALLABLE_EMBEDDING 0x0000
3274 #define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING 0x0002
3275 #define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING 0x0004
3276 #define FT_FSTYPE_EDITABLE_EMBEDDING 0x0008
3277 #define FT_FSTYPE_NO_SUBSETTING 0x0100
3278 #define FT_FSTYPE_BITMAP_EMBEDDING_ONLY 0x0200
3281 /*************************************************************************/
3284 /* FT_Get_FSType_Flags */
3287 /* Return the fsType flags for a font. */
3290 /* face :: A handle to the source face object. */
3293 /* The fsType flags, @FT_FSTYPE_XXX. */
3296 /* Use this function rather than directly reading the `fs_type' field */
3297 /* in the @PS_FontInfoRec structure which is only guaranteed to */
3298 /* return the correct results for Type~1 fonts. */
3300 FT_EXPORT( FT_UShort
)
3301 FT_Get_FSType_Flags( FT_Face face
);
3304 /*************************************************************************/
3307 /* glyph_variants */
3310 /* Glyph Variants */
3313 /* The FreeType~2 interface to Unicode Ideographic Variation */
3314 /* Sequences (IVS), using the SFNT cmap format~14. */
3317 /* Many CJK characters have variant forms. They are a sort of grey */
3318 /* area somewhere between being totally irrelevant and semantically */
3319 /* distinct; for this reason, the Unicode consortium decided to */
3320 /* introduce Ideographic Variation Sequences (IVS), consisting of a */
3321 /* Unicode base character and one of 240 variant selectors */
3322 /* (U+E0100-U+E01EF), instead of further extending the already huge */
3323 /* code range for CJK characters. */
3325 /* An IVS is registered and unique; for further details please refer */
3326 /* to Unicode Technical Report #37, the Ideographic Variation */
3327 /* Database. To date (October 2007), the character with the most */
3328 /* variants is U+908A, having 8~such IVS. */
3330 /* Adobe and MS decided to support IVS with a new cmap subtable */
3331 /* (format~14). It is an odd subtable because it is not a mapping of */
3332 /* input code points to glyphs, but contains lists of all variants */
3333 /* supported by the font. */
3335 /* A variant may be either `default' or `non-default'. A default */
3336 /* variant is the one you will get for that code point if you look it */
3337 /* up in the standard Unicode cmap. A non-default variant is a */
3338 /* different glyph. */
3340 /*************************************************************************/
3343 /*************************************************************************/
3346 /* FT_Face_GetCharVariantIndex */
3349 /* Return the glyph index of a given character code as modified by */
3350 /* the variation selector. */
3354 /* A handle to the source face object. */
3357 /* The character code point in Unicode. */
3359 /* variantSelector :: */
3360 /* The Unicode code point of the variation selector. */
3363 /* The glyph index. 0~means either `undefined character code', or */
3364 /* `undefined selector code', or `no variation selector cmap */
3365 /* subtable', or `current CharMap is not Unicode'. */
3368 /* If you use FreeType to manipulate the contents of font files */
3369 /* directly, be aware that the glyph index returned by this function */
3370 /* doesn't always correspond to the internal indices used within */
3371 /* the file. This is done to ensure that value~0 always corresponds */
3372 /* to the `missing glyph'. */
3374 /* This function is only meaningful if */
3375 /* a) the font has a variation selector cmap sub table, */
3377 /* b) the current charmap has a Unicode encoding. */
3382 FT_EXPORT( FT_UInt
)
3383 FT_Face_GetCharVariantIndex( FT_Face face
,
3385 FT_ULong variantSelector
);
3388 /*************************************************************************/
3391 /* FT_Face_GetCharVariantIsDefault */
3394 /* Check whether this variant of this Unicode character is the one to */
3395 /* be found in the `cmap'. */
3399 /* A handle to the source face object. */
3402 /* The character codepoint in Unicode. */
3404 /* variantSelector :: */
3405 /* The Unicode codepoint of the variation selector. */
3408 /* 1~if found in the standard (Unicode) cmap, 0~if found in the */
3409 /* variation selector cmap, or -1 if it is not a variant. */
3412 /* This function is only meaningful if the font has a variation */
3413 /* selector cmap subtable. */
3419 FT_Face_GetCharVariantIsDefault( FT_Face face
,
3421 FT_ULong variantSelector
);
3424 /*************************************************************************/
3427 /* FT_Face_GetVariantSelectors */
3430 /* Return a zero-terminated list of Unicode variant selectors found */
3435 /* A handle to the source face object. */
3438 /* A pointer to an array of selector code points, or NULL if there is */
3439 /* no valid variant selector cmap subtable. */
3442 /* The last item in the array is~0; the array is owned by the */
3443 /* @FT_Face object but can be overwritten or released on the next */
3444 /* call to a FreeType function. */
3449 FT_EXPORT( FT_UInt32
* )
3450 FT_Face_GetVariantSelectors( FT_Face face
);
3453 /*************************************************************************/
3456 /* FT_Face_GetVariantsOfChar */
3459 /* Return a zero-terminated list of Unicode variant selectors found */
3460 /* for the specified character code. */
3464 /* A handle to the source face object. */
3467 /* The character codepoint in Unicode. */
3470 /* A pointer to an array of variant selector code points which are */
3471 /* active for the given character, or NULL if the corresponding list */
3475 /* The last item in the array is~0; the array is owned by the */
3476 /* @FT_Face object but can be overwritten or released on the next */
3477 /* call to a FreeType function. */
3482 FT_EXPORT( FT_UInt32
* )
3483 FT_Face_GetVariantsOfChar( FT_Face face
,
3484 FT_ULong charcode
);
3487 /*************************************************************************/
3490 /* FT_Face_GetCharsOfVariant */
3493 /* Return a zero-terminated list of Unicode character codes found for */
3494 /* the specified variant selector. */
3498 /* A handle to the source face object. */
3500 /* variantSelector :: */
3501 /* The variant selector code point in Unicode. */
3504 /* A list of all the code points which are specified by this selector */
3505 /* (both default and non-default codes are returned) or NULL if there */
3506 /* is no valid cmap or the variant selector is invalid. */
3509 /* The last item in the array is~0; the array is owned by the */
3510 /* @FT_Face object but can be overwritten or released on the next */
3511 /* call to a FreeType function. */
3516 FT_EXPORT( FT_UInt32
* )
3517 FT_Face_GetCharsOfVariant( FT_Face face
,
3518 FT_ULong variantSelector
);
3521 /*************************************************************************/
3530 /* Crunching fixed numbers and vectors. */
3533 /* This section contains various functions used to perform */
3534 /* computations on 16.16 fixed-float numbers or 2d vectors. */
3543 /* FT_Vector_Transform */
3544 /* FT_Matrix_Multiply */
3545 /* FT_Matrix_Invert */
3547 /*************************************************************************/
3550 /*************************************************************************/
3556 /* A very simple function used to perform the computation `(a*b)/c' */
3557 /* with maximal accuracy (it uses a 64-bit intermediate integer */
3558 /* whenever necessary). */
3560 /* This function isn't necessarily as fast as some processor specific */
3561 /* operations, but is at least completely portable. */
3564 /* a :: The first multiplier. */
3565 /* b :: The second multiplier. */
3566 /* c :: The divisor. */
3569 /* The result of `(a*b)/c'. This function never traps when trying to */
3570 /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
3571 /* on the signs of `a' and `b'. */
3573 FT_EXPORT( FT_Long
)
3574 FT_MulDiv( FT_Long a
,
3581 /* The following #if 0 ... #endif is for the documentation formatter, */
3582 /* hiding the internal `FT_MULFIX_INLINED' macro. */
3585 /*************************************************************************/
3591 /* A very simple function used to perform the computation */
3592 /* `(a*b)/0x10000' with maximal accuracy. Most of the time this is */
3593 /* used to multiply a given value by a 16.16 fixed float factor. */
3596 /* a :: The first multiplier. */
3597 /* b :: The second multiplier. Use a 16.16 factor here whenever */
3598 /* possible (see note below). */
3601 /* The result of `(a*b)/0x10000'. */
3604 /* This function has been optimized for the case where the absolute */
3605 /* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */
3606 /* As this happens mainly when scaling from notional units to */
3607 /* fractional pixels in FreeType, it resulted in noticeable speed */
3608 /* improvements between versions 2.x and 1.x. */
3610 /* As a conclusion, always try to place a 16.16 factor as the */
3611 /* _second_ argument of this function; this can make a great */
3614 FT_EXPORT( FT_Long
)
3615 FT_MulFix( FT_Long a
,
3621 #ifdef FT_MULFIX_INLINED
3622 #define FT_MulFix( a, b ) FT_MULFIX_INLINED( a, b )
3624 FT_EXPORT( FT_Long
)
3625 FT_MulFix( FT_Long a
,
3630 /*************************************************************************/
3636 /* A very simple function used to perform the computation */
3637 /* `(a*0x10000)/b' with maximal accuracy. Most of the time, this is */
3638 /* used to divide a given value by a 16.16 fixed float factor. */
3641 /* a :: The first multiplier. */
3642 /* b :: The second multiplier. Use a 16.16 factor here whenever */
3643 /* possible (see note below). */
3646 /* The result of `(a*0x10000)/b'. */
3649 /* The optimization for FT_DivFix() is simple: If (a~<<~16) fits in */
3650 /* 32~bits, then the division is computed directly. Otherwise, we */
3651 /* use a specialized version of @FT_MulDiv. */
3653 FT_EXPORT( FT_Long
)
3654 FT_DivFix( FT_Long a
,
3658 /*************************************************************************/
3664 /* A very simple function used to round a 16.16 fixed number. */
3667 /* a :: The number to be rounded. */
3670 /* The result of `(a + 0x8000) & -0x10000'. */
3672 FT_EXPORT( FT_Fixed
)
3673 FT_RoundFix( FT_Fixed a
);
3676 /*************************************************************************/
3682 /* A very simple function used to compute the ceiling function of a */
3683 /* 16.16 fixed number. */
3686 /* a :: The number for which the ceiling function is to be computed. */
3689 /* The result of `(a + 0x10000 - 1) & -0x10000'. */
3691 FT_EXPORT( FT_Fixed
)
3692 FT_CeilFix( FT_Fixed a
);
3695 /*************************************************************************/
3701 /* A very simple function used to compute the floor function of a */
3702 /* 16.16 fixed number. */
3705 /* a :: The number for which the floor function is to be computed. */
3708 /* The result of `a & -0x10000'. */
3710 FT_EXPORT( FT_Fixed
)
3711 FT_FloorFix( FT_Fixed a
);
3714 /*************************************************************************/
3717 /* FT_Vector_Transform */
3720 /* Transform a single vector through a 2x2 matrix. */
3723 /* vector :: The target vector to transform. */
3726 /* matrix :: A pointer to the source 2x2 matrix. */
3729 /* The result is undefined if either `vector' or `matrix' is invalid. */
3732 FT_Vector_Transform( FT_Vector
* vec
,
3733 const FT_Matrix
* matrix
);
3736 /*************************************************************************/
3742 /* FreeType Version */
3745 /* Functions and macros related to FreeType versions. */
3748 /* Note that those functions and macros are of limited use because */
3749 /* even a new release of FreeType with only documentation changes */
3750 /* increases the version number. */
3752 /*************************************************************************/
3755 /*************************************************************************
3761 * These three macros identify the FreeType source code version.
3762 * Use @FT_Library_Version to access them at runtime.
3765 * FREETYPE_MAJOR :: The major version number.
3766 * FREETYPE_MINOR :: The minor version number.
3767 * FREETYPE_PATCH :: The patch level.
3770 * The version number of FreeType if built as a dynamic link library
3771 * with the `libtool' package is _not_ controlled by these three
3775 #define FREETYPE_MAJOR 2
3776 #define FREETYPE_MINOR 3
3777 #define FREETYPE_PATCH 12
3780 /*************************************************************************/
3783 /* FT_Library_Version */
3786 /* Return the version of the FreeType library being used. This is */
3787 /* useful when dynamically linking to the library, since one cannot */
3788 /* use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and */
3789 /* @FREETYPE_PATCH. */
3792 /* library :: A source library handle. */
3795 /* amajor :: The major version number. */
3797 /* aminor :: The minor version number. */
3799 /* apatch :: The patch version number. */
3802 /* The reason why this function takes a `library' argument is because */
3803 /* certain programs implement library initialization in a custom way */
3804 /* that doesn't use @FT_Init_FreeType. */
3806 /* In such cases, the library version might not be available before */
3807 /* the library object has been created. */
3810 FT_Library_Version( FT_Library library
,
3816 /*************************************************************************/
3819 /* FT_Face_CheckTrueTypePatents */
3822 /* Parse all bytecode instructions of a TrueType font file to check */
3823 /* whether any of the patented opcodes are used. This is only useful */
3824 /* if you want to be able to use the unpatented hinter with */
3825 /* fonts that do *not* use these opcodes. */
3827 /* Note that this function parses *all* glyph instructions in the */
3828 /* font file, which may be slow. */
3831 /* face :: A face handle. */
3834 /* 1~if this is a TrueType font that uses one of the patented */
3835 /* opcodes, 0~otherwise. */
3840 FT_EXPORT( FT_Bool
)
3841 FT_Face_CheckTrueTypePatents( FT_Face face
);
3844 /*************************************************************************/
3847 /* FT_Face_SetUnpatentedHinting */
3850 /* Enable or disable the unpatented hinter for a given face. */
3851 /* Only enable it if you have determined that the face doesn't */
3852 /* use any patented opcodes (see @FT_Face_CheckTrueTypePatents). */
3855 /* face :: A face handle. */
3857 /* value :: New boolean setting. */
3860 /* The old setting value. This will always be false if this is not */
3861 /* an SFNT font, or if the unpatented hinter is not compiled in this */
3862 /* instance of the library. */
3867 FT_EXPORT( FT_Bool
)
3868 FT_Face_SetUnpatentedHinting( FT_Face face
,
3876 #endif /* __FREETYPE_H__ */