1
/***************************************************************************/
5
/* FreeType high-level API and common types (specification only). */
7
/* Copyright 1996-2001, 2002, 2003, 2004 by */
8
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
10
/* This file is part of the FreeType project, and may only be used, */
11
/* modified, and distributed under the terms of the FreeType project */
12
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13
/* this file you indicate that you have read the license and */
14
/* understand and accept it fully. */
16
/***************************************************************************/
20
#error "`ft2build.h' hasn't been included yet!"
21
#error "Please always use macros to include FreeType header files."
23
#error " #include <ft2build.h>"
24
#error " #include FT_FREETYPE_H"
28
#ifndef __FREETYPE_H__
29
#define __FREETYPE_H__
32
/*************************************************************************/
34
/* The `raster' component duplicates some of the declarations in */
35
/* freetype.h for stand-alone use if _FREETYPE_ isn't defined. */
39
/*************************************************************************/
41
/* The FREETYPE_MAJOR and FREETYPE_MINOR macros are used to version the */
42
/* new FreeType design, which is able to host several kinds of font */
43
/* drivers. It starts at 2.0. */
45
#define FREETYPE_MAJOR 2
46
#define FREETYPE_MINOR 1
47
#define FREETYPE_PATCH 9
51
#include FT_CONFIG_CONFIG_H
59
/*************************************************************************/
60
/*************************************************************************/
62
/* B A S I C T Y P E S */
64
/*************************************************************************/
65
/*************************************************************************/
68
/*************************************************************************/
77
/* The FreeType 2 base font interface. */
80
/* This section describes the public high-level API of FreeType 2. */
92
/* FT_FACE_FLAG_SCALABLE */
93
/* FT_FACE_FLAG_FIXED_SIZES */
94
/* FT_FACE_FLAG_FIXED_WIDTH */
95
/* FT_FACE_FLAG_HORIZONTAL */
96
/* FT_FACE_FLAG_VERTICAL */
97
/* FT_FACE_FLAG_SFNT */
98
/* FT_FACE_FLAG_KERNING */
99
/* FT_FACE_FLAG_MULTIPLE_MASTERS */
100
/* FT_FACE_FLAG_GLYPH_NAMES */
101
/* FT_FACE_FLAG_EXTERNAL_STREAM */
102
/* FT_FACE_FLAG_FAST_GLYPHS */
104
/* FT_STYLE_FLAG_BOLD */
105
/* FT_STYLE_FLAG_ITALIC */
108
/* FT_Size_Metrics */
110
/* FT_GlyphSlotRec */
111
/* FT_Glyph_Metrics */
116
/* FT_Init_FreeType */
117
/* FT_Done_FreeType */
118
/* FT_Library_Version */
122
/* FT_New_Memory_Face */
127
/* FT_Attach_Stream */
129
/* FT_Set_Char_Size */
130
/* FT_Set_Pixel_Sizes */
131
/* FT_Set_Transform */
133
/* FT_Get_Char_Index */
134
/* FT_Get_Name_Index */
139
/* FT_OPEN_PATHNAME */
143
/* FT_LOAD_DEFAULT */
145
/* FT_LOAD_MONOCHROME */
146
/* FT_LOAD_LINEAR_DESIGN */
147
/* FT_LOAD_NO_SCALE */
148
/* FT_LOAD_NO_HINTING */
149
/* FT_LOAD_NO_BITMAP */
150
/* FT_LOAD_CROP_BITMAP */
152
/* FT_LOAD_VERTICAL_LAYOUT */
153
/* FT_LOAD_IGNORE_TRANSFORM */
154
/* FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */
155
/* FT_LOAD_FORCE_AUTOHINT */
156
/* FT_LOAD_NO_RECURSE */
157
/* FT_LOAD_PEDANTIC */
159
/* FT_LOAD_TARGET_NORMAL */
160
/* FT_LOAD_TARGET_LIGHT */
161
/* FT_LOAD_TARGET_MONO */
162
/* FT_LOAD_TARGET_LCD */
163
/* FT_LOAD_TARGET_LCD_V */
165
/* FT_Render_Glyph */
168
/* FT_Kerning_Mode */
169
/* FT_Get_Glyph_Name */
170
/* FT_Get_Postscript_Name */
173
/* FT_Select_Charmap */
175
/* FT_Get_Charmap_Index */
177
/*************************************************************************/
180
/*************************************************************************/
183
/* FT_Glyph_Metrics */
186
/* A structure used to model the metrics of a single glyph. The */
187
/* values are expressed in 26.6 fractional pixel format; if the flag */
188
/* FT_LOAD_NO_SCALE is used, values are returned in font units */
193
/* The glyph's width. */
196
/* The glyph's height. */
198
/* horiBearingX :: */
199
/* Left side bearing for horizontal layout. */
201
/* horiBearingY :: */
202
/* Top side bearing for horizontal layout. */
205
/* Advance width for horizontal layout. */
207
/* vertBearingX :: */
208
/* Left side bearing for vertical layout. */
210
/* vertBearingY :: */
211
/* Top side bearing for vertical layout. */
214
/* Advance height for vertical layout. */
216
typedef struct FT_Glyph_Metrics_
232
/*************************************************************************/
238
/* This structure models the size of a bitmap strike (i.e., a bitmap */
239
/* instance of the font for a given resolution) in a fixed-size font */
240
/* face. It is used for the `available_sizes' field of the */
241
/* @FT_FaceRec structure. */
244
/* height :: The (vertical) baseline-to-baseline distance in pixels. */
245
/* It makes most sense to define the height of a bitmap */
246
/* font in this way. */
248
/* width :: The average width of the font (in pixels). Since the */
249
/* algorithms to compute this value are different for the */
250
/* various bitmap formats, it can only give an additional */
251
/* hint if the `height' value isn't sufficient to select */
252
/* the proper font. For monospaced fonts the average width */
253
/* is the same as the maximum width. */
255
/* size :: The point size in 26.6 fractional format this font shall */
256
/* represent (for a given vertical resolution). */
258
/* x_ppem :: The horizontal ppem value (in 26.6 fractional format). */
260
/* y_ppem :: The vertical ppem value (in 26.6 fractional format). */
261
/* Usually, this is the `nominal' pixel height of the font. */
264
/* The values in this structure are taken from the bitmap font. If */
265
/* the font doesn't provide a parameter it is set to zero to indicate */
266
/* that the information is not available. */
268
/* The following formula converts from dpi to ppem: */
270
/* ppem = size * dpi / 72 */
272
/* where `size' is in points. */
275
/* The `size' parameter is not reliable: There exist fonts (e.g., */
276
/* app850.fon) which have a wrong size for some subfonts; x_ppem */
277
/* and y_ppem are thus set equal to pixel width and height given in */
278
/* in the Windows FNT header. */
280
/* TrueType embedded bitmaps: */
281
/* `size', `width', and `height' values are not contained in the */
282
/* bitmap strike itself. They are computed from the global font */
285
typedef struct FT_Bitmap_Size_
298
/*************************************************************************/
299
/*************************************************************************/
301
/* O B J E C T C L A S S E S */
303
/*************************************************************************/
304
/*************************************************************************/
306
/*************************************************************************/
312
/* A handle to a FreeType library instance. Each `library' is */
313
/* completely independent from the others; it is the `root' of a set */
314
/* of objects like fonts, faces, sizes, etc. */
316
/* It also embeds a memory manager (see @FT_Memory), as well as a */
317
/* scan-line converter object (see @FT_Raster). */
320
/* Library objects are normally created by @FT_Init_FreeType, and */
321
/* destroyed with @FT_Done_FreeType. */
323
typedef struct FT_LibraryRec_ *FT_Library;
326
/*************************************************************************/
332
/* A handle to a given FreeType module object. Each module can be a */
333
/* font driver, a renderer, or anything else that provides services */
334
/* to the formers. */
336
typedef struct FT_ModuleRec_* FT_Module;
339
/*************************************************************************/
345
/* A handle to a given FreeType font driver object. Each font driver */
346
/* is a special module capable of creating faces from font files. */
348
typedef struct FT_DriverRec_* FT_Driver;
351
/*************************************************************************/
357
/* A handle to a given FreeType renderer. A renderer is a special */
358
/* module in charge of converting a glyph image to a bitmap, when */
359
/* necessary. Each renderer supports a given glyph image format, and */
360
/* one or more target surface depths. */
362
typedef struct FT_RendererRec_* FT_Renderer;
365
/*************************************************************************/
371
/* A handle to a given typographic face object. A face object models */
372
/* a given typeface, in a given style. */
375
/* Each face object also owns a single @FT_GlyphSlot object, as well */
376
/* as one or more @FT_Size objects. */
378
/* Use @FT_New_Face or @FT_Open_Face to create a new face object from */
379
/* a given filepathname or a custom input stream. */
381
/* Use @FT_Done_Face to destroy it (along with its slot and sizes). */
384
/* The @FT_FaceRec details the publicly accessible fields of a given */
387
typedef struct FT_FaceRec_* FT_Face;
390
/*************************************************************************/
396
/* A handle to a given size object. Such an object models the data */
397
/* that depends on the current _resolution_ and _character size_ in a */
398
/* given @FT_Face. */
401
/* Each face object owns one or more sizes. There is however a */
402
/* single _active_ size for the face at any time that will be used by */
403
/* functions like @FT_Load_Glyph, @FT_Get_Kerning, etc. */
405
/* You can use the @FT_Activate_Size API to change the current */
406
/* active size of any given face. */
409
/* The @FT_SizeRec structure details the publicly accessible fields */
410
/* of a given face object. */
412
typedef struct FT_SizeRec_* FT_Size;
415
/*************************************************************************/
421
/* A handle to a given `glyph slot'. A slot is a container where it */
422
/* is possible to load any one of the glyphs contained in its parent */
425
/* In other words, each time you call @FT_Load_Glyph or */
426
/* @FT_Load_Char, the slot's content is erased by the new glyph data, */
427
/* i.e. the glyph's metrics, its image (bitmap or outline), and */
428
/* other control information. */
431
/* @FT_GlyphSlotRec details the publicly accessible glyph fields. */
433
typedef struct FT_GlyphSlotRec_* FT_GlyphSlot;
436
/*************************************************************************/
442
/* A handle to a given character map. A charmap is used to translate */
443
/* character codes in a given encoding into glyph indexes for its */
444
/* parent's face. Some font formats may provide several charmaps per */
447
/* Each face object owns zero or more charmaps, but only one of them */
448
/* can be "active" and used by @FT_Get_Char_Index or @FT_Load_Char. */
450
/* The list of available charmaps in a face is available through the */
451
/* "face->num_charmaps" and "face->charmaps" fields of @FT_FaceRec. */
453
/* The currently active charmap is available as "face->charmap". */
454
/* You should call @FT_Set_Charmap to change it. */
457
/* When a new face is created (either through @FT_New_Face or */
458
/* @FT_Open_Face), the library looks for a Unicode charmap within */
459
/* the list and automatically activates it. */
462
/* The @FT_CharMapRec details the publicly accessible fields of a */
463
/* given character map. */
465
typedef struct FT_CharMapRec_* FT_CharMap;
468
/*************************************************************************/
474
/* This macro converts four letter tags into an unsigned long. It is */
475
/* used to define "encoding" identifiers (see @FT_Encoding). */
478
/* Since many 16bit compilers don't like 32bit enumerations, you */
479
/* should redefine this macro in case of problems to something like */
482
/* #define FT_ENC_TAG( value, a, b, c, d ) value */
484
/* to get a simple enumeration without assigning special numbers. */
488
#define FT_ENC_TAG( value, a, b, c, d ) \
489
value = ( ( (FT_UInt32)(a) << 24 ) | \
490
( (FT_UInt32)(b) << 16 ) | \
491
( (FT_UInt32)(c) << 8 ) | \
494
#endif /* FT_ENC_TAG */
497
/*************************************************************************/
503
/* An enumeration used to specify encodings supported by charmaps. */
504
/* Used in the @FT_Select_Charmap API function. */
507
/* Because of 32-bit charcodes defined in Unicode (i.e., surrogates), */
508
/* all character codes must be expressed as FT_Longs. */
510
/* The values of this type correspond to specific character */
511
/* repertories (i.e. charsets), and not to text encoding methods */
512
/* (like UTF-8, UTF-16, GB2312_EUC, etc.). */
514
/* Other encodings might be defined in the future. */
517
/* FT_ENCODING_NONE :: */
518
/* The encoding value 0 is reserved. */
520
/* FT_ENCODING_UNICODE :: */
521
/* Corresponds to the Unicode character set. This value covers */
522
/* all versions of the Unicode repertoire, including ASCII and */
523
/* Latin-1. Most fonts include a Unicode charmap, but not all */
526
/* FT_ENCODING_MS_SYMBOL :: */
527
/* Corresponds to the Microsoft Symbol encoding, used to encode */
528
/* mathematical symbols in the 32..255 character code range. For */
529
/* more information, see `http://www.ceviz.net/symbol.htm'. */
531
/* FT_ENCODING_SJIS :: */
532
/* Corresponds to Japanese SJIS encoding. More info at */
533
/* at `http://langsupport.japanreference.com/encoding.shtml'. */
534
/* See note on multi-byte encodings below. */
536
/* FT_ENCODING_GB2312 :: */
537
/* Corresponds to an encoding system for Simplified Chinese as used */
538
/* used in mainland China. */
540
/* FT_ENCODING_BIG5 :: */
541
/* Corresponds to an encoding system for Traditional Chinese as used */
542
/* in Taiwan and Hong Kong. */
544
/* FT_ENCODING_WANSUNG :: */
545
/* Corresponds to the Korean encoding system known as Wansung. */
546
/* For more information see */
547
/* `http://www.microsoft.com/typography/unicode/949.txt'. */
549
/* FT_ENCODING_JOHAB :: */
550
/* The Korean standard character set (KS C-5601-1992), which */
551
/* corresponds to MS Windows code page 1361. This character set */
552
/* includes all possible Hangeul character combinations. */
554
/* FT_ENCODING_ADOBE_LATIN_1 :: */
555
/* Corresponds to a Latin-1 encoding as defined in a Type 1 */
556
/* Postscript font. It is limited to 256 character codes. */
558
/* FT_ENCODING_ADOBE_STANDARD :: */
559
/* Corresponds to the Adobe Standard encoding, as found in Type 1, */
560
/* CFF, and OpenType/CFF fonts. It is limited to 256 character */
563
/* FT_ENCODING_ADOBE_EXPERT :: */
564
/* Corresponds to the Adobe Expert encoding, as found in Type 1, */
565
/* CFF, and OpenType/CFF fonts. It is limited to 256 character */
568
/* FT_ENCODING_ADOBE_CUSTOM :: */
569
/* Corresponds to a custom encoding, as found in Type 1, CFF, and */
570
/* OpenType/CFF fonts. It is limited to 256 character codes. */
572
/* FT_ENCODING_APPLE_ROMAN :: */
573
/* Corresponds to the 8-bit Apple roman encoding. Many TrueType and */
574
/* OpenType fonts contain a charmap for this encoding, since older */
575
/* versions of Mac OS are able to use it. */
577
/* FT_ENCODING_OLD_LATIN_2 :: */
578
/* This value is deprecated and was never used nor reported by */
579
/* FreeType. Don't use or test for it. */
581
/* FT_ENCODING_MS_SJIS :: */
582
/* Same as FT_ENCODING_SJIS. Deprecated. */
584
/* FT_ENCODING_MS_GB2312 :: */
585
/* Same as FT_ENCODING_GB2312. Deprecated. */
587
/* FT_ENCODING_MS_BIG5 :: */
588
/* Same as FT_ENCODING_BIG5. Deprecated. */
590
/* FT_ENCODING_MS_WANSUNG :: */
591
/* Same as FT_ENCODING_WANSUNG. Deprecated. */
593
/* FT_ENCODING_MS_JOHAB :: */
594
/* Same as FT_ENCODING_JOHAB. Deprecated. */
597
/* By default, FreeType automatically synthetizes a Unicode charmap */
598
/* for Postscript fonts, using their glyph names dictionaries. */
599
/* However, it will also report the encodings defined explicitly in */
600
/* the font file, for the cases when they are needed, with the Adobe */
601
/* values as well. */
603
/* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */
604
/* is neither Unicode nor ISO-8859-1 (otherwise it is set to */
605
/* FT_ENCODING_UNICODE). Use `FT_Get_BDF_Charset_ID' to find out */
606
/* which encoding is really present. If, for example, the */
607
/* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */
608
/* the font is encoded in KOI8-R. */
610
/* FT_ENCODING_NONE is always set (with a single exception) by the */
611
/* winfonts driver. Use `FT_Get_WinFNT_Header' and examine the */
612
/* `charset' field of the `FT_WinFNT_HeaderRec' structure to find out */
613
/* which encoding is really present. For example, FT_WinFNT_ID_CP1251 */
614
/* (204) means Windows code page 1251 (for Russian). */
616
/* FT_ENCODING_NONE is set if `platform_id' is `TT_PLATFORM_MACINTOSH' */
617
/* and `encoding_id' is not `TT_MAC_ID_ROMAN' (otherwise it is set to */
618
/* FT_ENCODING_APPLE_ROMAN). */
620
/* If `platform_id' is `TT_PLATFORM_MACINTOSH', use the function */
621
/* `FT_Get_CMap_Language_ID' to query the Mac language ID which may be */
622
/* needed to be able to distinguish Apple encoding variants. See */
624
/* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT */
626
/* to get an idea how to do that. Basically, if the language ID is 0, */
627
/* dont use it, otherwise subtract 1 from the language ID. Then */
628
/* examine `encoding_id'. If, for example, `encoding_id' is */
629
/* `TT_MAC_ID_ROMAN' and the language ID (minus 1) is */
630
/* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */
631
/* `TT_MAC_ID_ARABIC' with `TT_MAC_LANGID_FARSI' means the Farsi */
632
/* variant the Arabic encoding. */
634
typedef enum FT_Encoding_
636
FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),
638
FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),
639
FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ),
641
FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ),
642
FT_ENC_TAG( FT_ENCODING_GB2312, 'g', 'b', ' ', ' ' ),
643
FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ),
644
FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),
645
FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ),
647
/* for backwards compatibility */
648
FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS,
649
FT_ENCODING_MS_GB2312 = FT_ENCODING_GB2312,
650
FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5,
651
FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
652
FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB,
654
FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),
655
FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ),
656
FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ),
657
FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ),
659
FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),
661
FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )
666
/*************************************************************************/
669
/* ft_encoding_xxx */
672
/* These constants are deprecated; use the corresponding @FT_Encoding */
673
/* values instead. */
676
/* ft_encoding_none :: see @FT_ENCODING_NONE */
677
/* ft_encoding_unicode :: see @FT_ENCODING_UNICODE */
678
/* ft_encoding_latin_2 :: see @FT_ENCODING_OLD_LATIN_2 */
679
/* ft_encoding_symbol :: see @FT_ENCODING_MS_SYMBOL */
680
/* ft_encoding_sjis :: see @FT_ENCODING_SJIS */
681
/* ft_encoding_gb2312 :: see @FT_ENCODING_GB2312 */
682
/* ft_encoding_big5 :: see @FT_ENCODING_BIG5 */
683
/* ft_encoding_wansung :: see @FT_ENCODING_WANSUNG */
684
/* ft_encoding_johab :: see @FT_ENCODING_JOHAB */
686
/* ft_encoding_adobe_standard :: see @FT_ENCODING_ADOBE_STANDARD */
687
/* ft_encoding_adobe_expert :: see @FT_ENCODING_ADOBE_EXPERT */
688
/* ft_encoding_adobe_custom :: see @FT_ENCODING_ADOBE_CUSTOM */
689
/* ft_encoding_latin_1 :: see @FT_ENCODING_ADOBE_LATIN_1 */
691
/* ft_encoding_apple_roman :: see @FT_ENCODING_APPLE_ROMAN */
693
#define ft_encoding_none FT_ENCODING_NONE
694
#define ft_encoding_unicode FT_ENCODING_UNICODE
695
#define ft_encoding_symbol FT_ENCODING_MS_SYMBOL
696
#define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1
697
#define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2
698
#define ft_encoding_sjis FT_ENCODING_SJIS
699
#define ft_encoding_gb2312 FT_ENCODING_GB2312
700
#define ft_encoding_big5 FT_ENCODING_BIG5
701
#define ft_encoding_wansung FT_ENCODING_WANSUNG
702
#define ft_encoding_johab FT_ENCODING_JOHAB
704
#define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD
705
#define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT
706
#define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM
707
#define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN
710
/*************************************************************************/
716
/* The base charmap structure. */
719
/* face :: A handle to the parent face object. */
721
/* encoding :: An @FT_Encoding tag identifying the charmap. Use */
722
/* this with @FT_Select_Charmap. */
724
/* platform_id :: An ID number describing the platform for the */
725
/* following encoding ID. This comes directly from */
726
/* the TrueType specification and should be emulated */
727
/* for other formats. */
729
/* encoding_id :: A platform specific encoding number. This also */
730
/* comes from the TrueType specification and should be */
731
/* emulated similarly. */
733
typedef struct FT_CharMapRec_
736
FT_Encoding encoding;
737
FT_UShort platform_id;
738
FT_UShort encoding_id;
743
/*************************************************************************/
744
/*************************************************************************/
746
/* B A S E O B J E C T C L A S S E S */
748
/*************************************************************************/
749
/*************************************************************************/
752
/*************************************************************************/
755
/* FT_Face_Internal */
758
/* An opaque handle to an FT_Face_InternalRec structure, used to */
759
/* model private data of a given @FT_Face object. */
761
/* This structure might change between releases of FreeType 2 and is */
762
/* not generally available to client applications. */
764
typedef struct FT_Face_InternalRec_* FT_Face_Internal;
767
/*************************************************************************/
773
/* FreeType root face class structure. A face object models the */
774
/* resolution and point-size independent data found in a font file. */
777
/* num_faces :: In the case where the face is located in a */
778
/* collection (i.e., a file which embeds */
779
/* several faces), this is the total number of */
780
/* faces found in the resource. 1 by default. */
781
/* Accessing non-existent face indices causes */
784
/* face_index :: The index of the face in its font file. */
785
/* Usually, this is 0 for all normal font */
786
/* formats. It can be > 0 in the case of */
787
/* collections (which embed several fonts in a */
788
/* single resource/file). */
790
/* face_flags :: A set of bit flags that give important */
791
/* information about the face; see the */
792
/* @FT_FACE_FLAG_XXX constants for details. */
794
/* style_flags :: A set of bit flags indicating the style of */
795
/* the face (i.e., italic, bold, underline, */
796
/* etc). See the @FT_STYLE_FLAG_XXX */
799
/* num_glyphs :: The total number of glyphs in the face. */
801
/* family_name :: The face's family name. This is an ASCII */
802
/* string, usually in English, which describes */
803
/* the typeface's family (like `Times New */
804
/* Roman', `Bodoni', `Garamond', etc). This */
805
/* is a least common denominator used to list */
806
/* fonts. Some formats (TrueType & OpenType) */
807
/* provide localized and Unicode versions of */
808
/* this string. Applications should use the */
809
/* format specific interface to access them. */
811
/* style_name :: The face's style name. This is an ASCII */
812
/* string, usually in English, which describes */
813
/* the typeface's style (like `Italic', */
814
/* `Bold', `Condensed', etc). Not all font */
815
/* formats provide a style name, so this field */
816
/* is optional, and can be set to NULL. As */
817
/* for `family_name', some formats provide */
818
/* localized/Unicode versions of this string. */
819
/* Applications should use the format specific */
820
/* interface to access them. */
822
/* num_fixed_sizes :: The number of fixed sizes available in this */
823
/* face. This should be set to 0 for scalable */
824
/* fonts, unless its face includes a set of */
825
/* glyphs (called a `strike') for the */
826
/* specified sizes. */
828
/* available_sizes :: An array of sizes specifying the available */
829
/* bitmap/graymap sizes that are contained in */
830
/* in the font face. Should be set to NULL if */
831
/* the field `num_fixed_sizes' is set to 0. */
833
/* num_charmaps :: The total number of character maps in the */
836
/* charmaps :: A table of pointers to the face's charmaps. */
837
/* Used to scan the list of available charmaps */
838
/* -- this table might change after a call to */
839
/* @FT_Attach_File or @FT_Attach_Stream (e.g. */
840
/* if used to hook an additional encoding or */
841
/* CMap to the face object). */
843
/* generic :: A field reserved for client uses. See the */
844
/* @FT_Generic type description. */
846
/* bbox :: The font bounding box. Coordinates are */
847
/* expressed in font units (see units_per_EM). */
848
/* The box is large enough to contain any */
849
/* glyph from the font. Thus, bbox.yMax can */
850
/* be seen as the `maximal ascender', */
851
/* bbox.yMin as the `minimal descender', and */
852
/* the maximal glyph width is given by */
853
/* `bbox.xMax-bbox.xMin' (not to be confused */
854
/* with the maximal _advance_width_). Only */
855
/* relevant for scalable formats. */
857
/* units_per_EM :: The number of font units per EM square for */
858
/* this face. This is typically 2048 for */
859
/* TrueType fonts, 1000 for Type1 fonts, and */
860
/* should be set to the (unrealistic) value 1 */
861
/* for fixed-sizes fonts. Only relevant for */
862
/* scalable formats. */
864
/* ascender :: The face's ascender is the vertical */
865
/* distance from the baseline to the topmost */
866
/* point of any glyph in the face. This */
867
/* field's value is positive, expressed in */
868
/* font units. Some font designs use a value */
869
/* different from `bbox.yMax'. Only relevant */
870
/* for scalable formats. */
872
/* descender :: The face's descender is the vertical */
873
/* distance from the baseline to the */
874
/* bottommost point of any glyph in the face. */
875
/* This field's value is *negative* for values */
876
/* below the baseline. It is expressed in */
877
/* font units. Some font designs use a value */
878
/* different from `bbox.yMin'. Only relevant */
879
/* for scalable formats. */
881
/* height :: The face's height is the vertical distance */
882
/* from one baseline to the next when writing */
883
/* several lines of text. Its value is always */
884
/* positive, expressed in font units. The */
885
/* value can be computed as */
886
/* `ascender+descender+line_gap' where the */
887
/* value of `line_gap' is also called */
888
/* `external leading'. Only relevant for */
889
/* scalable formats. */
891
/* max_advance_width :: The maximal advance width, in font units, */
892
/* for all glyphs in this face. This can be */
893
/* used to make word wrapping computations */
894
/* faster. Only relevant for scalable */
897
/* max_advance_height :: The maximal advance height, in font units, */
898
/* for all glyphs in this face. This is only */
899
/* relevant for vertical layouts, and should */
900
/* be set to the `height' for fonts that do */
901
/* not provide vertical metrics. Only */
902
/* relevant for scalable formats. */
904
/* underline_position :: The position, in font units, of the */
905
/* underline line for this face. It's the */
906
/* center of the underlining stem. Only */
907
/* relevant for scalable formats. */
909
/* underline_thickness :: The thickness, in font units, of the */
910
/* underline for this face. Only relevant for */
911
/* scalable formats. */
913
/* glyph :: The face's associated glyph slot(s). This */
914
/* object is created automatically with a new */
915
/* face object. However, certain kinds of */
916
/* applications (mainly tools like converters) */
917
/* can need more than one slot to ease their */
920
/* size :: The current active size for this face. */
922
/* charmap :: The current active charmap for this face. */
924
typedef struct FT_FaceRec_
934
FT_String* family_name;
935
FT_String* style_name;
937
FT_Int num_fixed_sizes;
938
FT_Bitmap_Size* available_sizes;
941
FT_CharMap* charmaps;
945
/*# the following are only relevant to scalable outlines */
948
FT_UShort units_per_EM;
953
FT_Short max_advance_width;
954
FT_Short max_advance_height;
956
FT_Short underline_position;
957
FT_Short underline_thickness;
969
FT_ListRec sizes_list;
974
FT_Face_Internal internal;
981
/*************************************************************************/
984
/* FT_FACE_FLAG_XXX */
987
/* A list of bit flags used in the `face_flags' field of the */
988
/* @FT_FaceRec structure. They inform client applications of */
989
/* properties of the corresponding face. */
992
/* FT_FACE_FLAG_SCALABLE :: */
993
/* Indicates that the face provides vectorial outlines. This */
994
/* doesn't prevent embedded bitmaps, i.e., a face can have both */
995
/* this bit and @FT_FACE_FLAG_FIXED_SIZES set. */
997
/* FT_FACE_FLAG_FIXED_SIZES :: */
998
/* Indicates that the face contains `fixed sizes', i.e., bitmap */
999
/* strikes for some given pixel sizes. See the `num_fixed_sizes' */
1000
/* and `available_sizes' fields of @FT_FaceRec. */
1002
/* FT_FACE_FLAG_FIXED_WIDTH :: */
1003
/* Indicates that the face contains fixed-width characters (like */
1004
/* Courier, Lucido, MonoType, etc.). */
1006
/* FT_FACE_FLAG_SFNT :: */
1007
/* Indicates that the face uses the `sfnt' storage scheme. For */
1008
/* now, this means TrueType and OpenType. */
1010
/* FT_FACE_FLAG_HORIZONTAL :: */
1011
/* Indicates that the face contains horizontal glyph metrics. This */
1012
/* should be set for all common formats. */
1014
/* FT_FACE_FLAG_VERTICAL :: */
1015
/* Indicates that the face contains vertical glyph metrics. This */
1016
/* is only available in some formats, not all of them. */
1018
/* FT_FACE_FLAG_KERNING :: */
1019
/* Indicates that the face contains kerning information. If set, */
1020
/* the kerning distance can be retrieved through the function */
1021
/* @FT_Get_Kerning. Note that if unset, this function will always */
1022
/* return the vector (0,0). */
1024
/* FT_FACE_FLAG_FAST_GLYPHS :: */
1025
/* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */
1027
/* FT_FACE_FLAG_MULTIPLE_MASTERS :: */
1028
/* Indicates that the font contains multiple masters and is capable */
1029
/* of interpolating between them. See the multiple-masters */
1030
/* specific API for details. */
1032
/* FT_FACE_FLAG_GLYPH_NAMES :: */
1033
/* Indicates that the font contains glyph names that can be */
1034
/* retrieved through @FT_Get_Glyph_Name. Note that some TrueType */
1035
/* fonts contain broken glyph name tables. Use the function */
1036
/* @FT_Has_PS_Glyph_Names when needed. */
1038
/* FT_FACE_FLAG_EXTERNAL_STREAM :: */
1039
/* Used internally by FreeType to indicate that a face's stream was */
1040
/* provided by the client application and should not be destroyed */
1041
/* when @FT_Done_Face is called. Don't read or test this flag. */
1043
#define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
1044
#define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
1045
#define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )
1046
#define FT_FACE_FLAG_SFNT ( 1L << 3 )
1047
#define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 )
1048
#define FT_FACE_FLAG_VERTICAL ( 1L << 5 )
1049
#define FT_FACE_FLAG_KERNING ( 1L << 6 )
1050
#define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 )
1051
#define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 )
1052
#define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 )
1053
#define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )
1058
/*************************************************************************/
1061
/* FT_HAS_HORIZONTAL( face ) */
1064
/* A macro that returns true whenever a face object contains */
1065
/* horizontal metrics (this is true for all font formats though). */
1068
/* @FT_HAS_VERTICAL can be used to check for vertical metrics. */
1070
#define FT_HAS_HORIZONTAL( face ) \
1071
( face->face_flags & FT_FACE_FLAG_HORIZONTAL )
1074
/*************************************************************************/
1077
/* FT_HAS_VERTICAL( face ) */
1080
/* A macro that returns true whenever a face object contains vertical */
1083
#define FT_HAS_VERTICAL( face ) \
1084
( face->face_flags & FT_FACE_FLAG_VERTICAL )
1087
/*************************************************************************/
1090
/* FT_HAS_KERNING( face ) */
1093
/* A macro that returns true whenever a face object contains kerning */
1094
/* data that can be accessed with @FT_Get_Kerning. */
1096
#define FT_HAS_KERNING( face ) \
1097
( face->face_flags & FT_FACE_FLAG_KERNING )
1100
/*************************************************************************/
1103
/* FT_IS_SCALABLE( face ) */
1106
/* A macro that returns true whenever a face object contains a */
1107
/* scalable font face (true for TrueType, Type 1, CID, and */
1108
/* OpenType/CFF font formats. */
1110
#define FT_IS_SCALABLE( face ) \
1111
( face->face_flags & FT_FACE_FLAG_SCALABLE )
1114
/*************************************************************************/
1117
/* FT_IS_SFNT( face ) */
1120
/* A macro that returns true whenever a face object contains a font */
1121
/* whose format is based on the SFNT storage scheme. This usually */
1122
/* means: TrueType fonts, OpenType fonts, as well as SFNT-based */
1123
/* embedded bitmap fonts. */
1125
/* If this macro is true, all functions defined in @FT_SFNT_NAMES_H */
1126
/* and @FT_TRUETYPE_TABLES_H are available. */
1128
#define FT_IS_SFNT( face ) \
1129
( face->face_flags & FT_FACE_FLAG_SFNT )
1132
/*************************************************************************/
1135
/* FT_IS_FIXED_WIDTH( face ) */
1138
/* A macro that returns true whenever a face object contains a font */
1139
/* face that contains fixed-width (or "monospace", "fixed-pitch", */
1142
#define FT_IS_FIXED_WIDTH( face ) \
1143
( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
1146
/*************************************************************************/
1149
/* FT_HAS_FIXED_SIZES( face ) */
1152
/* A macro that returns true whenever a face object contains some */
1153
/* embedded bitmaps. See the `available_sizes' field of the */
1154
/* @FT_FaceRec structure. */
1156
#define FT_HAS_FIXED_SIZES( face ) \
1157
( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
1163
/*************************************************************************/
1166
/* FT_HAS_FAST_GLYPHS( face ) */
1169
/* Deprecated; indicates that the face contains so-called "fast" */
1170
/* glyph bitmaps. */
1172
#define FT_HAS_FAST_GLYPHS( face ) \
1173
( face->face_flags & FT_FACE_FLAG_FAST_GLYPHS )
1176
/*************************************************************************/
1179
/* FT_HAS_GLYPH_NAMES( face ) */
1182
/* A macro that returns true whenever a face object contains some */
1183
/* glyph names that can be accessed through @FT_Get_Glyph_Name. */
1185
#define FT_HAS_GLYPH_NAMES( face ) \
1186
( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
1189
/*************************************************************************/
1192
/* FT_HAS_MULTIPLE_MASTERS( face ) */
1195
/* A macro that returns true whenever a face object contains some */
1196
/* multiple masters. The functions provided by */
1197
/* @FT_MULTIPLE_MASTERS_H are then available to choose the exact */
1198
/* design you want. */
1200
#define FT_HAS_MULTIPLE_MASTERS( face ) \
1201
( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
1204
/*************************************************************************/
1207
/* FT_STYLE_FLAG_XXX */
1210
/* A list of bit-flags used to indicate the style of a given face. */
1211
/* These are used in the `style_flags' field of @FT_FaceRec. */
1214
/* FT_STYLE_FLAG_ITALIC :: */
1215
/* Indicates that a given face is italicized. */
1217
/* FT_STYLE_FLAG_BOLD :: */
1218
/* Indicates that a given face is bold. */
1220
#define FT_STYLE_FLAG_ITALIC ( 1 << 0 )
1221
#define FT_STYLE_FLAG_BOLD ( 1 << 1 )
1224
/*************************************************************************/
1227
/* FT_Size_Internal */
1230
/* An opaque handle to an FT_Size_InternalRec structure, used to */
1231
/* model private data of a given FT_Size object. */
1233
typedef struct FT_Size_InternalRec_* FT_Size_Internal;
1236
/*************************************************************************/
1239
/* FT_Size_Metrics */
1242
/* The size metrics structure returned scaled important distances for */
1243
/* a given size object. */
1246
/* x_ppem :: The character width, expressed in integer pixels. */
1247
/* This is the width of the EM square expressed in */
1248
/* pixels, hence the term `ppem' (pixels per EM). */
1250
/* y_ppem :: The character height, expressed in integer pixels. */
1251
/* This is the height of the EM square expressed in */
1252
/* pixels, hence the term `ppem' (pixels per EM). */
1254
/* x_scale :: A simple 16.16 fixed point format coefficient used */
1255
/* to scale horizontal distances expressed in font */
1256
/* units to fractional (26.6) pixel coordinates. */
1258
/* y_scale :: A simple 16.16 fixed point format coefficient used */
1259
/* to scale vertical distances expressed in font */
1260
/* units to fractional (26.6) pixel coordinates. */
1262
/* ascender :: The ascender, expressed in 26.6 fixed point */
1263
/* pixels. Positive for ascenders above the */
1266
/* descender :: The descender, expressed in 26.6 fixed point */
1267
/* pixels. Negative for descenders below the */
1270
/* height :: The text height, expressed in 26.6 fixed point */
1271
/* pixels. Always positive. */
1273
/* max_advance :: Maximum horizontal advance, expressed in 26.6 */
1274
/* fixed point pixels. Always positive. */
1277
/* For scalable fonts, the values of `ascender', `descender', and */
1278
/* `height' are scaled versions of `face->ascender', */
1279
/* `face->descender', and `face->height', respectively. */
1281
/* Unfortunately, due to glyph hinting, these values might not be */
1282
/* exact for certain fonts. They thus must be treated as unreliable */
1283
/* with an error margin of at least one pixel! */
1285
/* Indeed, the only way to get the exact pixel ascender and descender */
1286
/* is to render _all_ glyphs. As this would be a definite */
1287
/* performance hit, it is up to client applications to perform such */
1290
typedef struct FT_Size_Metrics_
1292
FT_UShort x_ppem; /* horizontal pixels per EM */
1293
FT_UShort y_ppem; /* vertical pixels per EM */
1295
FT_Fixed x_scale; /* two scales used to convert font units */
1296
FT_Fixed y_scale; /* to 26.6 frac. pixel coordinates */
1298
FT_Pos ascender; /* ascender in 26.6 frac. pixels */
1299
FT_Pos descender; /* descender in 26.6 frac. pixels */
1300
FT_Pos height; /* text height in 26.6 frac. pixels */
1301
FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */
1306
/*************************************************************************/
1312
/* FreeType root size class structure. A size object models the */
1313
/* resolution and pointsize dependent data of a given face. */
1316
/* face :: Handle to the parent face object. */
1318
/* generic :: A typeless pointer, which is unused by the FreeType */
1319
/* library or any of its drivers. It can be used by */
1320
/* client applications to link their own data to each size */
1323
/* metrics :: Metrics for this size object. This field is read-only. */
1325
typedef struct FT_SizeRec_
1327
FT_Face face; /* parent face object */
1328
FT_Generic generic; /* generic pointer for client uses */
1329
FT_Size_Metrics metrics; /* size metrics */
1330
FT_Size_Internal internal;
1335
/*************************************************************************/
1341
/* The subglyph structure is an internal object used to describe */
1342
/* subglyphs (for example, in the case of composites). */
1345
/* The subglyph implementation is not part of the high-level API, */
1346
/* hence the forward structure declaration. */
1348
typedef struct FT_SubGlyphRec_* FT_SubGlyph;
1351
/*************************************************************************/
1354
/* FT_Slot_Internal */
1357
/* An opaque handle to an FT_Slot_InternalRec structure, used to */
1358
/* model private data of a given FT_GlyphSlot object. */
1360
typedef struct FT_Slot_InternalRec_* FT_Slot_Internal;
1363
/*************************************************************************/
1366
/* FT_GlyphSlotRec */
1369
/* FreeType root glyph slot class structure. A glyph slot is a */
1370
/* container where individual glyphs can be loaded, be they */
1371
/* vectorial or bitmap/graymaps. */
1374
/* library :: A handle to the FreeType library instance */
1375
/* this slot belongs to. */
1377
/* face :: A handle to the parent face object. */
1379
/* next :: In some cases (like some font tools), several */
1380
/* glyph slots per face object can be a good */
1381
/* thing. As this is rare, the glyph slots are */
1382
/* listed through a direct, single-linked list */
1383
/* using its `next' field. */
1385
/* generic :: A typeless pointer which is unused by the */
1386
/* FreeType library or any of its drivers. It */
1387
/* can be used by client applications to link */
1388
/* their own data to each glyph slot object. */
1390
/* metrics :: The metrics of the last loaded glyph in the */
1391
/* slot. The returned values depend on the last */
1392
/* load flags (see the @FT_Load_Glyph API */
1393
/* function) and can be expressed either in 26.6 */
1394
/* fractional pixels or font units. */
1396
/* Note that even when the glyph image is */
1397
/* transformed, the metrics are not. */
1399
/* linearHoriAdvance :: For scalable formats only, this field holds */
1400
/* the linearly scaled horizontal advance width */
1401
/* for the glyph (i.e. the scaled and unhinted */
1402
/* value of the hori advance). This can be */
1403
/* important to perform correct WYSIWYG layout. */
1405
/* Note that this value is expressed by default */
1406
/* in 16.16 pixels. However, when the glyph is */
1407
/* loaded with the FT_LOAD_LINEAR_DESIGN flag, */
1408
/* this field contains simply the value of the */
1409
/* advance in original font units. */
1411
/* linearVertAdvance :: For scalable formats only, this field holds */
1412
/* the linearly scaled vertical advance height */
1413
/* for the glyph. See linearHoriAdvance for */
1416
/* advance :: This is the transformed advance width for the */
1419
/* format :: This field indicates the format of the image */
1420
/* contained in the glyph slot. Typically */
1421
/* FT_GLYPH_FORMAT_BITMAP, */
1422
/* FT_GLYPH_FORMAT_OUTLINE, and */
1423
/* FT_GLYPH_FORMAT_COMPOSITE, but others are */
1426
/* bitmap :: This field is used as a bitmap descriptor */
1427
/* when the slot format is */
1428
/* FT_GLYPH_FORMAT_BITMAP. Note that the */
1429
/* address and content of the bitmap buffer can */
1430
/* change between calls of @FT_Load_Glyph and a */
1431
/* few other functions. */
1433
/* bitmap_left :: This is the bitmap's left bearing expressed */
1434
/* in integer pixels. Of course, this is only */
1435
/* valid if the format is */
1436
/* FT_GLYPH_FORMAT_BITMAP. */
1438
/* bitmap_top :: This is the bitmap's top bearing expressed in */
1439
/* integer pixels. Remember that this is the */
1440
/* distance from the baseline to the top-most */
1441
/* glyph scanline, upwards y-coordinates being */
1444
/* outline :: The outline descriptor for the current glyph */
1445
/* image if its format is */
1446
/* FT_GLYPH_FORMAT_OUTLINE. */
1448
/* num_subglyphs :: The number of subglyphs in a composite glyph. */
1449
/* This field is only valid for the composite */
1450
/* glyph format that should normally only be */
1451
/* loaded with the @FT_LOAD_NO_RECURSE flag. */
1452
/* For now this is internal to FreeType. */
1454
/* subglyphs :: An array of subglyph descriptors for */
1455
/* composite glyphs. There are `num_subglyphs' */
1456
/* elements in there. Currently internal to */
1459
/* control_data :: Certain font drivers can also return the */
1460
/* control data for a given glyph image (e.g. */
1461
/* TrueType bytecode, Type 1 charstrings, etc.). */
1462
/* This field is a pointer to such data. */
1464
/* control_len :: This is the length in bytes of the control */
1467
/* other :: Really wicked formats can use this pointer to */
1468
/* present their own glyph image to client apps. */
1469
/* Note that the app will need to know about the */
1472
/* lsb_delta :: The difference between hinted and unhinted */
1473
/* left side bearing while autohinting is */
1474
/* active. Zero otherwise. */
1476
/* rsb_delta :: The difference between hinted and unhinted */
1477
/* right side bearing while autohinting is */
1478
/* active. Zero otherwise. */
1481
/* If @FT_Load_Glyph is called with default flags (see */
1482
/* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */
1483
/* its native format (e.g. a vectorial outline for TrueType and */
1484
/* Type 1 formats). */
1486
/* This image can later be converted into a bitmap by calling */
1487
/* @FT_Render_Glyph. This function finds the current renderer for */
1488
/* the native image's format then invokes it. */
1490
/* The renderer is in charge of transforming the native image through */
1491
/* the slot's face transformation fields, then convert it into a */
1492
/* bitmap that is returned in `slot->bitmap'. */
1494
/* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */
1495
/* to specify the position of the bitmap relative to the current pen */
1496
/* position (e.g. coordinates [0,0] on the baseline). Of course, */
1497
/* `slot->format' is also changed to `FT_GLYPH_FORMAT_BITMAP' . */
1500
/* Here a small pseudo code fragment which shows how to use */
1501
/* `lsb_delta' and `rsb_delta': */
1504
/* FT_Pos origin_x = 0; */
1505
/* FT_Pos prev_rsb_delta = 0; */
1508
/* for all glyphs do */
1509
/* <compute kern between current and previous glyph and add it to */
1512
/* <load glyph with `FT_Load_Glyph'> */
1514
/* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */
1515
/* origin_x -= 64; */
1516
/* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */
1517
/* origin_x += 64; */
1519
/* prev_rsb_delta = face->glyph->rsb_delta; */
1521
/* <save glyph image, or render glyph, or ...> */
1523
/* origin_x += face->glyph->advance.x; */
1527
typedef struct FT_GlyphSlotRec_
1532
FT_UInt reserved; /* retained for binary compatibility */
1535
FT_Glyph_Metrics metrics;
1536
FT_Fixed linearHoriAdvance;
1537
FT_Fixed linearVertAdvance;
1540
FT_Glyph_Format format;
1548
FT_UInt num_subglyphs;
1549
FT_SubGlyph subglyphs;
1559
FT_Slot_Internal internal;
1564
/*************************************************************************/
1565
/*************************************************************************/
1567
/* F U N C T I O N S */
1569
/*************************************************************************/
1570
/*************************************************************************/
1573
/*************************************************************************/
1576
/* FT_Init_FreeType */
1579
/* Initializes a new FreeType library object. The set of modules */
1580
/* that are registered by this function is determined at build time. */
1583
/* alibrary :: A handle to a new library object. */
1586
/* FreeType error code. 0 means success. */
1588
FT_EXPORT( FT_Error )
1589
FT_Init_FreeType( FT_Library *alibrary );
1592
/*************************************************************************/
1595
/* FT_Library_Version */
1598
/* Return the version of the FreeType library being used. This is */
1599
/* useful when dynamically linking to the library, since one cannot */
1600
/* use the macros FT_FREETYPE_MAJOR, FT_FREETYPE_MINOR, and */
1601
/* FT_FREETYPE_PATCH. */
1604
/* library :: A source library handle. */
1607
/* amajor :: The major version number. */
1609
/* aminor :: The minor version number. */
1611
/* apatch :: The patch version number. */
1614
/* The reason why this function takes a 'library' argument is because */
1615
/* certain programs implement library initialization in a custom way */
1616
/* that doesn't use `FT_Init_FreeType'. */
1618
/* In such cases, the library version might not be available before */
1619
/* the library object has been created. */
1622
FT_Library_Version( FT_Library library,
1628
/*************************************************************************/
1631
/* FT_Done_FreeType */
1634
/* Destroys a given FreeType library object and all of its childs, */
1635
/* including resources, drivers, faces, sizes, etc. */
1638
/* library :: A handle to the target library object. */
1641
/* FreeType error code. 0 means success. */
1643
FT_EXPORT( FT_Error )
1644
FT_Done_FreeType( FT_Library library );
1647
/*************************************************************************/
1653
/* A list of bit-field constants used within the `flags' field of the */
1654
/* @FT_Open_Args structure. */
1657
/* FT_OPEN_MEMORY :: This is a memory-based stream. */
1659
/* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */
1661
/* FT_OPEN_PATHNAME :: Create a new input stream from a C */
1664
/* FT_OPEN_DRIVER :: Use the `driver' field. */
1666
/* FT_OPEN_PARAMS :: Use the `num_params' & `params' field. */
1668
/* ft_open_memory :: Deprecated; use @FT_OPEN_MEMORY instead. */
1670
/* ft_open_stream :: Deprecated; use @FT_OPEN_STREAM instead. */
1672
/* ft_open_pathname :: Deprecated; use @FT_OPEN_PATHNAME instead. */
1674
/* ft_open_driver :: Deprecated; use @FT_OPEN_DRIVER instead. */
1676
/* ft_open_params :: Deprecated; use @FT_OPEN_PARAMS instead. */
1679
/* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */
1680
/* flags are mutually exclusive. */
1682
#define FT_OPEN_MEMORY 0x1
1683
#define FT_OPEN_STREAM 0x2
1684
#define FT_OPEN_PATHNAME 0x4
1685
#define FT_OPEN_DRIVER 0x8
1686
#define FT_OPEN_PARAMS 0x10
1688
#define ft_open_memory FT_OPEN_MEMORY /* deprecated */
1689
#define ft_open_stream FT_OPEN_STREAM /* deprecated */
1690
#define ft_open_pathname FT_OPEN_PATHNAME /* deprecated */
1691
#define ft_open_driver FT_OPEN_DRIVER /* deprecated */
1692
#define ft_open_params FT_OPEN_PARAMS /* deprecated */
1695
/*************************************************************************/
1701
/* A simple structure used to pass more or less generic parameters */
1702
/* to @FT_Open_Face. */
1705
/* tag :: A 4-byte identification tag. */
1707
/* data :: A pointer to the parameter data. */
1710
/* The id and function of parameters are driver-specific. */
1712
typedef struct FT_Parameter_
1720
/*************************************************************************/
1726
/* A structure used to indicate how to open a new font file/stream. */
1727
/* A pointer to such a structure can be used as a parameter for the */
1728
/* functions @FT_Open_Face and @FT_Attach_Stream. */
1731
/* flags :: A set of bit flags indicating how to use the */
1734
/* memory_base :: The first byte of the file in memory. */
1736
/* memory_size :: The size in bytes of the file in memory. */
1738
/* pathname :: A pointer to an 8-bit file pathname. */
1740
/* stream :: A handle to a source stream object. */
1742
/* driver :: This field is exclusively used by @FT_Open_Face; */
1743
/* it simply specifies the font driver to use to open */
1744
/* the face. If set to 0, FreeType will try to load */
1745
/* the face with each one of the drivers in its list. */
1747
/* num_params :: The number of extra parameters. */
1749
/* params :: Extra parameters passed to the font driver when */
1750
/* opening a new face. */
1753
/* The stream type is determined by the contents of `flags' which */
1754
/* are tested in the following order by @FT_Open_Face: */
1756
/* If the `FT_OPEN_MEMORY' bit is set, assume that this is a */
1757
/* memory file of `memory_size' bytes,located at `memory_address'. */
1759
/* Otherwise, if the `FT_OPEN_STREAM' bit is set, assume that a */
1760
/* custom input stream `stream' is used. */
1762
/* Otherwise, if the `FT_OPEN_PATHNAME' bit is set, assume that this */
1763
/* is a normal file and use `pathname' to open it. */
1765
/* If the `FT_OPEN_DRIVER' bit is set, @FT_Open_Face will only try to */
1766
/* open the file with the driver whose handler is in `driver'. */
1768
/* If the `FT_OPEN_PARAMS' bit is set, the parameters given by */
1769
/* `num_params' and `params' will be used. They are ignored */
1772
typedef struct FT_Open_Args_
1775
const FT_Byte* memory_base;
1776
FT_Long memory_size;
1777
FT_String* pathname;
1781
FT_Parameter* params;
1786
/*************************************************************************/
1792
/* Creates a new face object from a given resource and typeface index */
1793
/* using a pathname to the font file. */
1796
/* library :: A handle to the library resource. */
1799
/* pathname :: A path to the font file. */
1801
/* face_index :: The index of the face within the resource. The */
1802
/* first face has index 0. */
1805
/* aface :: A handle to a new face object. */
1808
/* FreeType error code. 0 means success. */
1811
/* Unlike FreeType 1.x, this function automatically creates a glyph */
1812
/* slot for the face object which can be accessed directly through */
1813
/* `face->glyph'. */
1815
/* @FT_New_Face can be used to determine and/or check the font format */
1816
/* of a given font resource. If the `face_index' field is negative, */
1817
/* the function will _not_ return any face handle in `aface'; the */
1818
/* return value is 0 if the font format is recognized, or non-zero */
1821
/* Each new face object created with this function also owns a */
1822
/* default @FT_Size object, accessible as `face->size'. */
1824
FT_EXPORT( FT_Error )
1825
FT_New_Face( FT_Library library,
1826
const char* filepathname,
1831
/*************************************************************************/
1834
/* FT_New_Memory_Face */
1837
/* Creates a new face object from a given resource and typeface index */
1838
/* using a font file already loaded into memory. */
1841
/* library :: A handle to the library resource. */
1844
/* file_base :: A pointer to the beginning of the font data. */
1846
/* file_size :: The size of the memory chunk used by the font data. */
1848
/* face_index :: The index of the face within the resource. The */
1849
/* first face has index 0. */
1852
/* aface :: A handle to a new face object. */
1855
/* FreeType error code. 0 means success. */
1858
/* The font data bytes are used _directly_ by the @FT_Face object. */
1859
/* This means that they are not copied, and that the client is */
1860
/* responsible for releasing/destroying them _after_ the */
1861
/* corresponding call to @FT_Done_Face . */
1863
/* Unlike FreeType 1.x, this function automatically creates a glyph */
1864
/* slot for the face object which can be accessed directly through */
1865
/* `face->glyph'. */
1867
/* @FT_New_Memory_Face can be used to determine and/or check the font */
1868
/* format of a given font resource. If the `face_index' field is */
1869
/* negative, the function will _not_ return any face handle in */
1870
/* `aface'; the return value is 0 if the font format is recognized, */
1871
/* or non-zero otherwise. */
1873
FT_EXPORT( FT_Error )
1874
FT_New_Memory_Face( FT_Library library,
1875
const FT_Byte* file_base,
1881
/*************************************************************************/
1887
/* Opens a face object from a given resource and typeface index using */
1888
/* an `FT_Open_Args' structure. If the face object doesn't exist, it */
1889
/* will be created. */
1892
/* library :: A handle to the library resource. */
1895
/* args :: A pointer to an `FT_Open_Args' structure which must */
1896
/* be filled by the caller. */
1898
/* face_index :: The index of the face within the resource. The */
1899
/* first face has index 0. */
1902
/* aface :: A handle to a new face object. */
1905
/* FreeType error code. 0 means success. */
1908
/* Unlike FreeType 1.x, this function automatically creates a glyph */
1909
/* slot for the face object which can be accessed directly through */
1910
/* `face->glyph'. */
1912
/* @FT_Open_Face can be used to determine and/or check the font */
1913
/* format of a given font resource. If the `face_index' field is */
1914
/* negative, the function will _not_ return any face handle in */
1915
/* `*face'; the return value is 0 if the font format is recognized, */
1916
/* or non-zero otherwise. */
1918
FT_EXPORT( FT_Error )
1919
FT_Open_Face( FT_Library library,
1920
const FT_Open_Args* args,
1925
/*************************************************************************/
1928
/* FT_Attach_File */
1931
/* `Attaches' a given font file to an existing face. This is usually */
1932
/* to read additional information for a single face object. For */
1933
/* example, it is used to read the AFM files that come with Type 1 */
1934
/* fonts in order to add kerning data and other metrics. */
1937
/* face :: The target face object. */
1940
/* filepathname :: An 8-bit pathname naming the `metrics' file. */
1943
/* FreeType error code. 0 means success. */
1946
/* If your font file is in memory, or if you want to provide your */
1947
/* own input stream object, use @FT_Attach_Stream. */
1949
/* The meaning of the `attach' action (i.e., what really happens when */
1950
/* the new file is read) is not fixed by FreeType itself. It really */
1951
/* depends on the font format (and thus the font driver). */
1953
/* Client applications are expected to know what they are doing */
1954
/* when invoking this function. Most drivers simply do not implement */
1955
/* file attachments. */
1957
FT_EXPORT( FT_Error )
1958
FT_Attach_File( FT_Face face,
1959
const char* filepathname );
1962
/*************************************************************************/
1965
/* FT_Attach_Stream */
1968
/* This function is similar to @FT_Attach_File with the exception */
1969
/* that it reads the attachment from an arbitrary stream. */
1972
/* face :: The target face object. */
1975
/* parameters :: A pointer to an FT_Open_Args structure used to */
1976
/* describe the input stream to FreeType. */
1978
/* FreeType error code. 0 means success. */
1981
/* The meaning of the `attach' (i.e. what really happens when the */
1982
/* new file is read) is not fixed by FreeType itself. It really */
1983
/* depends on the font format (and thus the font driver). */
1985
/* Client applications are expected to know what they are doing */
1986
/* when invoking this function. Most drivers simply do not implement */
1987
/* file attachments. */
1989
FT_EXPORT( FT_Error )
1990
FT_Attach_Stream( FT_Face face,
1991
FT_Open_Args* parameters );
1994
/*************************************************************************/
2000
/* Discards a given face object, as well as all of its child slots */
2004
/* face :: A handle to a target face object. */
2007
/* FreeType error code. 0 means success. */
2009
FT_EXPORT( FT_Error )
2010
FT_Done_Face( FT_Face face );
2013
/*************************************************************************/
2016
/* FT_Set_Char_Size */
2019
/* Sets the character dimensions of a given face object. The */
2020
/* `char_width' and `char_height' values are used for the width and */
2021
/* height, respectively, expressed in 26.6 fractional points. */
2023
/* If the horizontal or vertical resolution values are zero, a */
2024
/* default value of 72dpi is used. Similarly, if one of the */
2025
/* character dimensions is zero, its value is set equal to the other. */
2028
/* face :: A handle to a target face object. */
2031
/* char_width :: The character width, in 26.6 fractional points. */
2033
/* char_height :: The character height, in 26.6 fractional */
2036
/* horz_resolution :: The horizontal resolution. */
2038
/* vert_resolution :: The vertical resolution. */
2041
/* FreeType error code. 0 means success. */
2044
/* When dealing with fixed-size faces (i.e., non-scalable formats), */
2045
/* @FT_Set_Pixel_Sizes provides a more convenient interface. */
2047
FT_EXPORT( FT_Error )
2048
FT_Set_Char_Size( FT_Face face,
2049
FT_F26Dot6 char_width,
2050
FT_F26Dot6 char_height,
2051
FT_UInt horz_resolution,
2052
FT_UInt vert_resolution );
2055
/*************************************************************************/
2058
/* FT_Set_Pixel_Sizes */
2061
/* Sets the character dimensions of a given face object. The width */
2062
/* and height are expressed in integer pixels. */
2064
/* If one of the character dimensions is zero, its value is set equal */
2068
/* face :: A handle to the target face object. */
2071
/* pixel_width :: The character width, in integer pixels. */
2073
/* pixel_height :: The character height, in integer pixels. */
2076
/* FreeType error code. 0 means success. */
2079
/* The values of `pixel_width' and `pixel_height' correspond to the */
2080
/* pixel values of the _typographic_ character size, which are NOT */
2081
/* necessarily the same as the dimensions of the glyph `bitmap */
2084
/* The `character size' is really the size of an abstract square */
2085
/* called the `EM', used to design the font. However, depending */
2086
/* on the font design, glyphs will be smaller or greater than the */
2089
/* This means that setting the pixel size to, say, 8x8 doesn't */
2090
/* guarantee in any way that you will get glyph bitmaps that all fit */
2091
/* within an 8x8 cell (sometimes even far from it). */
2093
/* For bitmap fonts, `pixel_height' usually is a reliable value for */
2094
/* the height of the bitmap cell. Drivers for bitmap font formats */
2095
/* which contain a single bitmap strike only (BDF, PCF, FNT) ignore */
2096
/* `pixel_width'. */
2098
FT_EXPORT( FT_Error )
2099
FT_Set_Pixel_Sizes( FT_Face face,
2100
FT_UInt pixel_width,
2101
FT_UInt pixel_height );
2104
/*************************************************************************/
2110
/* A function used to load a single glyph within a given glyph slot, */
2111
/* for a given size. */
2114
/* face :: A handle to the target face object where the glyph */
2115
/* will be loaded. */
2118
/* glyph_index :: The index of the glyph in the font file. For */
2119
/* CID-keyed fonts (either in PS or in CFF format) */
2120
/* this argument specifies the CID value. */
2122
/* load_flags :: A flag indicating what to load for this glyph. The */
2123
/* @FT_LOAD_XXX constants can be used to control the */
2124
/* glyph loading process (e.g., whether the outline */
2125
/* should be scaled, whether to load bitmaps or not, */
2126
/* whether to hint the outline, etc). */
2129
/* FreeType error code. 0 means success. */
2132
/* If the glyph image is not a bitmap, and if the bit flag */
2133
/* FT_LOAD_IGNORE_TRANSFORM is unset, the glyph image will be */
2134
/* transformed with the information passed to a previous call to */
2135
/* @FT_Set_Transform. */
2137
/* Note that this also transforms the `face.glyph.advance' field, but */
2138
/* *not* the values in `face.glyph.metrics'. */
2140
FT_EXPORT( FT_Error )
2141
FT_Load_Glyph( FT_Face face,
2142
FT_UInt glyph_index,
2143
FT_Int32 load_flags );
2146
/*************************************************************************/
2152
/* A function used to load a single glyph within a given glyph slot, */
2153
/* for a given size, according to its character code. */
2156
/* face :: A handle to a target face object where the glyph */
2157
/* will be loaded. */
2160
/* char_code :: The glyph's character code, according to the */
2161
/* current charmap used in the face. */
2163
/* load_flags :: A flag indicating what to load for this glyph. The */
2164
/* @FT_LOAD_XXX constants can be used to control the */
2165
/* glyph loading process (e.g., whether the outline */
2166
/* should be scaled, whether to load bitmaps or not, */
2167
/* whether to hint the outline, etc). */
2170
/* FreeType error code. 0 means success. */
2173
/* If the face has no current charmap, or if the character code */
2174
/* is not defined in the charmap, this function will return an */
2177
/* If the glyph image is not a bitmap, and if the bit flag */
2178
/* FT_LOAD_IGNORE_TRANSFORM is unset, the glyph image will be */
2179
/* transformed with the information passed to a previous call to */
2180
/* @FT_Set_Transform. */
2182
/* Note that this also transforms the `face.glyph.advance' field, but */
2183
/* *not* the values in `face.glyph.metrics'. */
2185
FT_EXPORT( FT_Error )
2186
FT_Load_Char( FT_Face face,
2188
FT_Int32 load_flags );
2191
/***************************************************************************
2197
* A list of bit-field constants, used with @FT_Load_Glyph to indicate
2198
* what kind of operations to perform during glyph loading.
2201
* FT_LOAD_DEFAULT ::
2202
* Corresponding to 0, this value is used a default glyph load. In this
2203
* case, the following will happen:
2205
* 1. FreeType looks for a bitmap for the glyph corresponding to the
2206
* face's current size. If one is found, the function returns. The
2207
* bitmap data can be accessed from the glyph slot (see note below).
2209
* 2. If no embedded bitmap is searched or found, FreeType looks for a
2210
* scalable outline. If one is found, it is loaded from the font
2211
* file, scaled to device pixels, then "hinted" to the pixel grid in
2212
* order to optimize it. The outline data can be accessed from the
2213
* glyph slot (see note below).
2215
* Note that by default, the glyph loader doesn't render outlines into
2216
* bitmaps. The following flags are used to modify this default
2217
* behaviour to more specific and useful cases.
2219
* FT_LOAD_NO_SCALE ::
2220
* Don't scale the vector outline being loaded to 26.6 fractional
2221
* pixels, but kept in font units. Note that this also disables
2222
* hinting and the loading of embedded bitmaps. You should only use it
2223
* when you want to retrieve the original glyph outlines in font units.
2225
* FT_LOAD_NO_HINTING ::
2226
* Don't hint glyph outlines after their scaling to device pixels.
2227
* This generally generates "blurrier" glyphs in anti-aliased modes.
2229
* This flag is ignored if @FT_LOAD_NO_SCALE is set.
2232
* Render the glyph outline immediately into a bitmap before the glyph
2233
* loader returns. By default, the glyph is rendered for the
2234
* @FT_RENDER_MODE_NORMAL mode, which corresponds to 8-bit anti-aliased
2235
* bitmaps using 256 opacity levels. You can use either
2236
* @FT_LOAD_TARGET_MONO or @FT_LOAD_MONOCHROME to render 1-bit
2237
* monochrome bitmaps.
2239
* This flag is ignored if @FT_LOAD_NO_SCALE is set.
2241
* FT_LOAD_NO_BITMAP ::
2242
* Don't look for bitmaps when loading the glyph. Only scalable
2243
* outlines will be loaded when available, and scaled, hinted, or
2244
* rendered depending on other bit flags.
2246
* This does not prevent you from rendering outlines to bitmaps
2247
* with @FT_LOAD_RENDER, however.
2249
* FT_LOAD_VERTICAL_LAYOUT ::
2250
* Prepare the glyph image for vertical text layout. This basically
2251
* means that `face.glyph.advance' will correspond to the vertical
2252
* advance height (instead of the default horizontal advance width),
2253
* and that the glyph image will be translated to match the vertical
2254
* bearings positions.
2256
* FT_LOAD_FORCE_AUTOHINT ::
2257
* Force the use of the FreeType auto-hinter when a glyph outline is
2258
* loaded. You shouldn't need this in a typical application, since it
2259
* is mostly used to experiment with its algorithm.
2261
* FT_LOAD_CROP_BITMAP ::
2262
* Indicates that the glyph loader should try to crop the bitmap (i.e.,
2263
* remove all space around its black bits) when loading it. This is
2264
* only useful when loading embedded bitmaps in certain fonts, since
2265
* bitmaps rendered with @FT_LOAD_RENDER are always cropped by default.
2267
* FT_LOAD_PEDANTIC ::
2268
* Indicates that the glyph loader should perform pedantic
2269
* verifications during glyph loading, rejecting invalid fonts. This
2270
* is mostly used to detect broken glyphs in fonts. By default,
2271
* FreeType tries to handle broken fonts also.
2273
* FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ::
2274
* Indicates that the glyph loader should ignore the global advance
2275
* width defined in the font. As far as we know, this is only used by
2276
* the X-TrueType font server, in order to deal correctly with the
2277
* incorrect metrics contained in DynaLab's TrueType CJK fonts.
2279
* FT_LOAD_NO_RECURSE ::
2280
* This flag is only used internally. It merely indicates that the
2281
* glyph loader should not load composite glyphs recursively. Instead,
2282
* it should set the `num_subglyph' and `subglyphs' values of the glyph
2283
* slot accordingly, and set "glyph->format" to
2284
* @FT_GLYPH_FORMAT_COMPOSITE.
2286
* The description of sub-glyphs is not available to client
2287
* applications for now.
2289
* FT_LOAD_IGNORE_TRANSFORM ::
2290
* Indicates that the glyph loader should not try to transform the
2291
* loaded glyph image. This doesn't prevent scaling, hinting, or
2294
* FT_LOAD_MONOCHROME ::
2295
* This flag is used with @FT_LOAD_RENDER to indicate that you want
2296
* to render a 1-bit monochrome glyph bitmap from a vectorial outline.
2298
* Note that this has no effect on the hinting algorithm used by the
2299
* glyph loader. You should better use @FT_LOAD_TARGET_MONO if you
2300
* want to render monochrome-optimized glyph images instead.
2302
* FT_LOAD_LINEAR_DESIGN ::
2303
* Return the linearly scaled metrics expressed in original font units
2304
* instead of the default 16.16 pixel values.
2306
* FT_LOAD_NO_AUTOHINT ::
2307
* Indicates that the auto-hinter should never be used to hint glyph
2308
* outlines. This doesn't prevent native format-specific hinters from
2309
* being used. This can be important for certain fonts where unhinted
2310
* output is better than auto-hinted one.
2312
* FT_LOAD_TARGET_NORMAL ::
2313
* Use hinting for @FT_RENDER_MODE_NORMAL.
2315
* FT_LOAD_TARGET_LIGHT ::
2316
* Use hinting for @FT_RENDER_MODE_LIGHT.
2318
* FT_LOAD_TARGET_MONO ::
2319
* Use hinting for @FT_RENDER_MODE_MONO.
2321
* FT_LOAD_TARGET_LCD ::
2322
* Use hinting for @FT_RENDER_MODE_LCD.
2324
* FT_LOAD_TARGET_LCD_V ::
2325
* Use hinting for @FT_RENDER_MODE_LCD_V.
2327
#define FT_LOAD_DEFAULT 0x0
2328
#define FT_LOAD_NO_SCALE 0x1
2329
#define FT_LOAD_NO_HINTING 0x2
2330
#define FT_LOAD_RENDER 0x4
2331
#define FT_LOAD_NO_BITMAP 0x8
2332
#define FT_LOAD_VERTICAL_LAYOUT 0x10
2333
#define FT_LOAD_FORCE_AUTOHINT 0x20
2334
#define FT_LOAD_CROP_BITMAP 0x40
2335
#define FT_LOAD_PEDANTIC 0x80
2336
#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH 0x200
2337
#define FT_LOAD_NO_RECURSE 0x400
2338
#define FT_LOAD_IGNORE_TRANSFORM 0x800
2339
#define FT_LOAD_MONOCHROME 0x1000
2340
#define FT_LOAD_LINEAR_DESIGN 0x2000
2342
/* temporary hack! */
2343
#define FT_LOAD_SBITS_ONLY 0x4000
2344
#define FT_LOAD_NO_AUTOHINT 0x8000U
2348
#define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 )
2349
#define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
2351
#define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
2352
#define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT )
2353
#define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO )
2354
#define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
2355
#define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
2360
/*************************************************************************/
2363
/* FT_Set_Transform */
2366
/* A function used to set the transformation that is applied to glyph */
2367
/* images just before they are converted to bitmaps in a glyph slot */
2368
/* when @FT_Render_Glyph is called. */
2371
/* face :: A handle to the source face object. */
2374
/* matrix :: A pointer to the transformation's 2x2 matrix. Use 0 for */
2375
/* the identity matrix. */
2376
/* delta :: A pointer to the translation vector. Use 0 for the null */
2380
/* The transformation is only applied to scalable image formats after */
2381
/* the glyph has been loaded. It means that hinting is unaltered by */
2382
/* the transformation and is performed on the character size given in */
2383
/* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */
2386
FT_Set_Transform( FT_Face face,
2391
/*************************************************************************/
2394
/* FT_Render_Mode */
2397
/* An enumeration type that lists the render modes supported by */
2398
/* FreeType 2. Each mode corresponds to a specific type of scanline */
2399
/* conversion performed on the outline, as well as specific */
2400
/* hinting optimizations. */
2402
/* For bitmap fonts the `bitmap->pixel_mode' field in the */
2403
/* @FT_GlyphSlotRec structure gives the format of the returned */
2407
/* FT_RENDER_MODE_NORMAL :: */
2408
/* This is the default render mode; it corresponds to 8-bit */
2409
/* anti-aliased bitmaps, using 256 levels of opacity. */
2411
/* FT_RENDER_MODE_LIGHT :: */
2412
/* This is similar to @FT_RENDER_MODE_NORMAL -- you have to use */
2413
/* @FT_LOAD_TARGET_LIGHT in calls to @FT_Load_Glyph to get any */
2414
/* effect since the rendering process no longer influences the */
2415
/* positioning of glyph outlines. */
2417
/* The resulting glyph shapes are more similar to the original, */
2418
/* while being a bit more fuzzy (`better shapes' instead of `better */
2419
/* contrast', so to say. */
2421
/* FT_RENDER_MODE_MONO :: */
2422
/* This mode corresponds to 1-bit bitmaps. */
2424
/* FT_RENDER_MODE_LCD :: */
2425
/* This mode corresponds to horizontal RGB/BGR sub-pixel displays, */
2426
/* like LCD-screens. It produces 8-bit bitmaps that are 3 times */
2427
/* the width of the original glyph outline in pixels, and which use */
2428
/* the @FT_PIXEL_MODE_LCD mode. */
2430
/* FT_RENDER_MODE_LCD_V :: */
2431
/* This mode corresponds to vertical RGB/BGR sub-pixel displays */
2432
/* (like PDA screens, rotated LCD displays, etc.). It produces */
2433
/* 8-bit bitmaps that are 3 times the height of the original */
2434
/* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */
2437
/* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph are */
2438
/* _not filtered_ to reduce color-fringes. It is up to the caller to */
2439
/* perform this pass. */
2441
typedef enum FT_Render_Mode_
2443
FT_RENDER_MODE_NORMAL = 0,
2444
FT_RENDER_MODE_LIGHT,
2445
FT_RENDER_MODE_MONO,
2447
FT_RENDER_MODE_LCD_V,
2454
/*************************************************************************/
2457
/* ft_render_mode_xxx */
2460
/* These constats are deprecated. Use the corresponding */
2461
/* @FT_Render_Mode values instead. */
2464
/* ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL */
2465
/* ft_render_mode_mono :: see @FT_RENDER_MODE_MONO */
2467
#define ft_render_mode_normal FT_RENDER_MODE_NORMAL
2468
#define ft_render_mode_mono FT_RENDER_MODE_MONO
2471
/*************************************************************************/
2474
/* FT_Render_Glyph */
2477
/* Converts a given glyph image to a bitmap. It does so by */
2478
/* inspecting the glyph image format, find the relevant renderer, and */
2482
/* slot :: A handle to the glyph slot containing the image to */
2486
/* render_mode :: This is the render mode used to render the glyph */
2487
/* image into a bitmap. See FT_Render_Mode for a list */
2488
/* of possible values. */
2491
/* FreeType error code. 0 means success. */
2493
FT_EXPORT( FT_Error )
2494
FT_Render_Glyph( FT_GlyphSlot slot,
2495
FT_Render_Mode render_mode );
2498
/*************************************************************************/
2501
/* FT_Kerning_Mode */
2504
/* An enumeration used to specify which kerning values to return in */
2505
/* @FT_Get_Kerning. */
2508
/* FT_KERNING_DEFAULT :: Return scaled and grid-fitted kerning */
2509
/* distances (value is 0). */
2511
/* FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning */
2514
/* FT_KERNING_UNSCALED :: Return the kerning vector in original font */
2517
typedef enum FT_Kerning_Mode_
2519
FT_KERNING_DEFAULT = 0,
2520
FT_KERNING_UNFITTED,
2526
/*************************************************************************/
2529
/* ft_kerning_default */
2532
/* This constant is deprecated. Please use @FT_KERNING_DEFAULT */
2535
#define ft_kerning_default FT_KERNING_DEFAULT
2538
/*************************************************************************/
2541
/* ft_kerning_unfitted */
2544
/* This constant is deprecated. Please use @FT_KERNING_UNFITTED */
2547
#define ft_kerning_unfitted FT_KERNING_UNFITTED
2550
/*************************************************************************/
2553
/* ft_kerning_unscaled */
2556
/* This constant is deprecated. Please use @FT_KERNING_UNSCALED */
2559
#define ft_kerning_unscaled FT_KERNING_UNSCALED
2562
/*************************************************************************/
2565
/* FT_Get_Kerning */
2568
/* Returns the kerning vector between two glyphs of a same face. */
2571
/* face :: A handle to a source face object. */
2573
/* left_glyph :: The index of the left glyph in the kern pair. */
2575
/* right_glyph :: The index of the right glyph in the kern pair. */
2577
/* kern_mode :: See @FT_Kerning_Mode for more information. */
2578
/* Determines the scale/dimension of the returned */
2579
/* kerning vector. */
2582
/* akerning :: The kerning vector. This is in font units for */
2583
/* scalable formats, and in pixels for fixed-sizes */
2587
/* FreeType error code. 0 means success. */
2590
/* Only horizontal layouts (left-to-right & right-to-left) are */
2591
/* supported by this method. Other layouts, or more sophisticated */
2592
/* kernings, are out of the scope of this API function -- they can be */
2593
/* implemented through format-specific interfaces. */
2595
FT_EXPORT( FT_Error )
2596
FT_Get_Kerning( FT_Face face,
2598
FT_UInt right_glyph,
2600
FT_Vector *akerning );
2603
/*************************************************************************/
2606
/* FT_Get_Glyph_Name */
2609
/* Retrieves the ASCII name of a given glyph in a face. This only */
2610
/* works for those faces where FT_HAS_GLYPH_NAME(face) returns true. */
2613
/* face :: A handle to a source face object. */
2615
/* glyph_index :: The glyph index. */
2617
/* buffer_max :: The maximal number of bytes available in the */
2621
/* buffer :: A pointer to a target buffer where the name will be */
2625
/* FreeType error code. 0 means success. */
2628
/* An error is returned if the face doesn't provide glyph names or if */
2629
/* the glyph index is invalid. In all cases of failure, the first */
2630
/* byte of `buffer' will be set to 0 to indicate an empty name. */
2632
/* The glyph name is truncated to fit within the buffer if it is too */
2633
/* long. The returned string is always zero-terminated. */
2635
/* This function is not compiled within the library if the config */
2636
/* macro FT_CONFIG_OPTION_NO_GLYPH_NAMES is defined in */
2637
/* `include/freetype/config/ftoptions.h' */
2639
FT_EXPORT( FT_Error )
2640
FT_Get_Glyph_Name( FT_Face face,
2641
FT_UInt glyph_index,
2643
FT_UInt buffer_max );
2646
/*************************************************************************/
2649
/* FT_Get_Postscript_Name */
2652
/* Retrieves the ASCII Postscript name of a given face, if available. */
2653
/* This should only work with Postscript and TrueType fonts. */
2656
/* face :: A handle to the source face object. */
2659
/* A pointer to the face's Postscript name. NULL if un-available. */
2662
/* The returned pointer is owned by the face and will be destroyed */
2665
FT_EXPORT( const char* )
2666
FT_Get_Postscript_Name( FT_Face face );
2669
/*************************************************************************/
2672
/* FT_Select_Charmap */
2675
/* Selects a given charmap by its encoding tag (as listed in */
2676
/* `freetype.h'). */
2679
/* face :: A handle to the source face object. */
2682
/* encoding :: A handle to the selected charmap. */
2685
/* FreeType error code. 0 means success. */
2688
/* This function will return an error if no charmap in the face */
2689
/* corresponds to the encoding queried here. */
2691
FT_EXPORT( FT_Error )
2692
FT_Select_Charmap( FT_Face face,
2693
FT_Encoding encoding );
2696
/*************************************************************************/
2699
/* FT_Set_Charmap */
2702
/* Selects a given charmap for character code to glyph index */
2706
/* face :: A handle to the source face object. */
2709
/* charmap :: A handle to the selected charmap. */
2712
/* FreeType error code. 0 means success. */
2715
/* This function will return an error if the charmap is not part of */
2716
/* the face (i.e., if it is not listed in the face->charmaps[] */
2719
FT_EXPORT( FT_Error )
2720
FT_Set_Charmap( FT_Face face,
2721
FT_CharMap charmap );
2724
/*************************************************************************/
2727
/* FT_Get_Charmap_Index */
2730
/* Retrieve index of a given charmap. */
2733
/* charmap :: A handle to a charmap. */
2736
/* The index into the array of character maps within the face to */
2737
/* which `charmap' belongs. */
2740
FT_Get_Charmap_Index( FT_CharMap charmap );
2743
/*************************************************************************/
2746
/* FT_Get_Char_Index */
2749
/* Returns the glyph index of a given character code. This function */
2750
/* uses a charmap object to do the translation. */
2753
/* face :: A handle to the source face object. */
2755
/* charcode :: The character code. */
2758
/* The glyph index. 0 means `undefined character code'. */
2761
/* FreeType computes its own glyph indices which are not necessarily */
2762
/* the same as used in the font in case the font is based on glyph */
2763
/* indices. Reason for this behaviour is to assure that index 0 is */
2764
/* never used, representing the missing glyph. */
2766
FT_EXPORT( FT_UInt )
2767
FT_Get_Char_Index( FT_Face face,
2768
FT_ULong charcode );
2771
/*************************************************************************/
2774
/* FT_Get_First_Char */
2777
/* This function is used to return the first character code in the */
2778
/* current charmap of a given face. It will also return the */
2779
/* corresponding glyph index. */
2782
/* face :: A handle to the source face object. */
2785
/* agindex :: Glyph index of first character code. 0 if charmap is */
2789
/* The charmap's first character code. */
2792
/* You should use this function with @FT_Get_Next_Char to be able to */
2793
/* parse all character codes available in a given charmap. The code */
2794
/* should look like this: */
2797
/* FT_ULong charcode; */
2798
/* FT_UInt gindex; */
2801
/* charcode = FT_Get_First_Char( face, &gindex ); */
2802
/* while ( gindex != 0 ) */
2804
/* ... do something with (charcode,gindex) pair ... */
2806
/* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */
2810
/* Note that `*agindex' will be set to 0 if the charmap is empty. */
2811
/* The result itself can be 0 in two cases: if the charmap is empty */
2812
/* or when the value 0 is the first valid character code. */
2814
FT_EXPORT( FT_ULong )
2815
FT_Get_First_Char( FT_Face face,
2819
/*************************************************************************/
2822
/* FT_Get_Next_Char */
2825
/* This function is used to return the next character code in the */
2826
/* current charmap of a given face following the value 'char_code', */
2827
/* as well as the corresponding glyph index. */
2830
/* face :: A handle to the source face object. */
2831
/* char_code :: The starting character code. */
2834
/* agindex :: Glyph index of first character code. 0 if charmap */
2838
/* The charmap's next character code. */
2841
/* You should use this function with @FT_Get_First_Char to walk */
2842
/* through all character codes available in a given charmap. See */
2843
/* the note for this function for a simple code example. */
2845
/* Note that `*agindex' will be set to 0 when there are no more codes */
2846
/* in the charmap. */
2848
FT_EXPORT( FT_ULong )
2849
FT_Get_Next_Char( FT_Face face,
2854
/*************************************************************************/
2857
/* FT_Get_Name_Index */
2860
/* Returns the glyph index of a given glyph name. This function uses */
2861
/* driver specific objects to do the translation. */
2864
/* face :: A handle to the source face object. */
2866
/* glyph_name :: The glyph name. */
2869
/* The glyph index. 0 means `undefined character code'. */
2871
FT_EXPORT( FT_UInt )
2872
FT_Get_Name_Index( FT_Face face,
2873
FT_String* glyph_name );
2877
/*************************************************************************/
2886
/* Crunching fixed numbers and vectors */
2889
/* This section contains various functions used to perform */
2890
/* computations on 16.16 fixed-float numbers or 2d vectors. */
2899
/* FT_Vector_Transform */
2900
/* FT_Matrix_Multiply */
2901
/* FT_Matrix_Invert */
2903
/*************************************************************************/
2906
/*************************************************************************/
2912
/* A very simple function used to perform the computation `(a*b)/c' */
2913
/* with maximal accuracy (it uses a 64-bit intermediate integer */
2914
/* whenever necessary). */
2916
/* This function isn't necessarily as fast as some processor specific */
2917
/* operations, but is at least completely portable. */
2920
/* a :: The first multiplier. */
2921
/* b :: The second multiplier. */
2922
/* c :: The divisor. */
2925
/* The result of `(a*b)/c'. This function never traps when trying to */
2926
/* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
2927
/* on the signs of `a' and `b'. */
2929
FT_EXPORT( FT_Long )
2930
FT_MulDiv( FT_Long a,
2935
/*************************************************************************/
2941
/* A very simple function used to perform the computation */
2942
/* `(a*b)/0x10000' with maximal accuracy. Most of the time this is */
2943
/* used to multiply a given value by a 16.16 fixed float factor. */
2946
/* a :: The first multiplier. */
2947
/* b :: The second multiplier. Use a 16.16 factor here whenever */
2948
/* possible (see note below). */
2951
/* The result of `(a*b)/0x10000'. */
2954
/* This function has been optimized for the case where the absolute */
2955
/* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */
2956
/* As this happens mainly when scaling from notional units to */
2957
/* fractional pixels in FreeType, it resulted in noticeable speed */
2958
/* improvements between versions 2.x and 1.x. */
2960
/* As a conclusion, always try to place a 16.16 factor as the */
2961
/* _second_ argument of this function; this can make a great */
2964
FT_EXPORT( FT_Long )
2965
FT_MulFix( FT_Long a,
2969
/*************************************************************************/
2975
/* A very simple function used to perform the computation */
2976
/* `(a*0x10000)/b' with maximal accuracy. Most of the time, this is */
2977
/* used to divide a given value by a 16.16 fixed float factor. */
2980
/* a :: The first multiplier. */
2981
/* b :: The second multiplier. Use a 16.16 factor here whenever */
2982
/* possible (see note below). */
2985
/* The result of `(a*0x10000)/b'. */
2988
/* The optimization for FT_DivFix() is simple: If (a << 16) fits in */
2989
/* 32 bits, then the division is computed directly. Otherwise, we */
2990
/* use a specialized version of @FT_MulDiv. */
2992
FT_EXPORT( FT_Long )
2993
FT_DivFix( FT_Long a,
2997
/*************************************************************************/
3003
/* A very simple function used to round a 16.16 fixed number. */
3006
/* a :: The number to be rounded. */
3009
/* The result of `(a + 0x8000) & -0x10000'. */
3011
FT_EXPORT( FT_Fixed )
3012
FT_RoundFix( FT_Fixed a );
3015
/*************************************************************************/
3021
/* A very simple function used to compute the ceiling function of a */
3022
/* 16.16 fixed number. */
3025
/* a :: The number for which the ceiling function is to be computed. */
3028
/* The result of `(a + 0x10000 - 1) & -0x10000'. */
3030
FT_EXPORT( FT_Fixed )
3031
FT_CeilFix( FT_Fixed a );
3034
/*************************************************************************/
3040
/* A very simple function used to compute the floor function of a */
3041
/* 16.16 fixed number. */
3044
/* a :: The number for which the floor function is to be computed. */
3047
/* The result of `a & -0x10000'. */
3049
FT_EXPORT( FT_Fixed )
3050
FT_FloorFix( FT_Fixed a );
3053
/*************************************************************************/
3056
/* FT_Vector_Transform */
3059
/* Transforms a single vector through a 2x2 matrix. */
3062
/* vector :: The target vector to transform. */
3065
/* matrix :: A pointer to the source 2x2 matrix. */
3068
/* The result is undefined if either `vector' or `matrix' is invalid. */
3071
FT_Vector_Transform( FT_Vector* vec,
3072
FT_Matrix* matrix );
3080
#endif /* __FREETYPE_H__ */