📄 freetype.h
字号:
struct TT_Horizontal_Header_ { TT_Fixed Version; TT_FWord Ascender; TT_FWord Descender; TT_FWord Line_Gap; TT_UFWord advance_Width_Max; /* advance width maximum */ TT_FWord min_Left_Side_Bearing; /* minimum left-sb */ TT_FWord min_Right_Side_Bearing; /* minimum right-sb */ TT_FWord xMax_Extent; /* xmax extents */ TT_FWord caret_Slope_Rise; TT_FWord caret_Slope_Run; TT_Short Reserved0, Reserved1, Reserved2, Reserved3, Reserved4; TT_Short metric_Data_Format; TT_UShort number_Of_HMetrics; /* The following fields are not defined by the TrueType specification */ /* but they're used to connect the metrics header to the relevant */ /* `HMTX' or `VMTX' table. */ void* long_metrics; void* short_metrics; }; typedef struct TT_Horizontal_Header_ TT_Horizontal_Header; /*******************************************************/ /* This structure is the one defined by the TrueType */ /* specification. Note that it has exactly the same */ /* layout as the horizontal header (both are loaded */ /* by the same function). */ struct TT_Vertical_Header_ { TT_Fixed Version; TT_FWord Ascender; TT_FWord Descender; TT_FWord Line_Gap; TT_UFWord advance_Height_Max; /* advance height maximum */ TT_FWord min_Top_Side_Bearing; /* minimum left-sb or top-sb */ TT_FWord min_Bottom_Side_Bearing; /* minimum right-sb or bottom-sb */ TT_FWord yMax_Extent; /* xmax or ymax extents */ TT_FWord caret_Slope_Rise; TT_FWord caret_Slope_Run; TT_FWord caret_Offset; TT_Short Reserved1, Reserved2, Reserved3, Reserved4; TT_Short metric_Data_Format; TT_UShort number_Of_VMetrics; /* The following fields are not defined by the TrueType specification */ /* but they're used to connect the metrics header to the relevant */ /* `HMTX' or `VMTX' table. */ void* long_metrics; void* short_metrics; }; typedef struct TT_Vertical_Header_ TT_Vertical_Header; /* ------ The OS/2 table ------ */ /************************************************************************/ /* Note that since FreeType 1.3, we support Mac fonts which do not have */ /* an OS/2 table. In this case the `version' field will be set to */ /* 0xFFFF by the table loader; all other fields should be 0. */ struct TT_OS2_ { TT_UShort version; /* 0x0001 */ TT_FWord xAvgCharWidth; TT_UShort usWeightClass; TT_UShort usWidthClass; TT_Short fsType; TT_FWord ySubscriptXSize; TT_FWord ySubscriptYSize; TT_FWord ySubscriptXOffset; TT_FWord ySubscriptYOffset; TT_FWord ySuperscriptXSize; TT_FWord ySuperscriptYSize; TT_FWord ySuperscriptXOffset; TT_FWord ySuperscriptYOffset; TT_FWord yStrikeoutSize; TT_FWord yStrikeoutPosition; TT_Short sFamilyClass; TT_Byte panose[10]; TT_ULong ulUnicodeRange1; /* Bits 0-31 */ TT_ULong ulUnicodeRange2; /* Bits 32-63 */ TT_ULong ulUnicodeRange3; /* Bits 64-95 */ TT_ULong ulUnicodeRange4; /* Bits 96-127 */ TT_Char achVendID[4]; TT_UShort fsSelection; TT_UShort usFirstCharIndex; TT_UShort usLastCharIndex; TT_Short sTypoAscender; TT_Short sTypoDescender; TT_Short sTypoLineGap; TT_UShort usWinAscent; TT_UShort usWinDescent; /* only version 1 tables: */ TT_ULong ulCodePageRange1; /* Bits 0-31 */ TT_ULong ulCodePageRange2; /* Bits 32-63 */ }; typedef struct TT_OS2_ TT_OS2; /* ------ The PostScript table ------ */ struct TT_Postscript_ { TT_Fixed FormatType; TT_Fixed italicAngle; TT_FWord underlinePosition; TT_FWord underlineThickness; TT_ULong isFixedPitch; TT_ULong minMemType42; TT_ULong maxMemType42; TT_ULong minMemType1; TT_ULong maxMemType1; /* Glyph names follow in the file, but we don't */ /* load them by default. See the ftxpost.c extension. */ }; typedef struct TT_Postscript_ TT_Postscript; /* ------ The horizontal device metrics table (`hdmx') ------ */ struct TT_Hdmx_Record_ { TT_Byte ppem; TT_Byte max_width; TT_Byte* widths; }; typedef struct TT_Hdmx_Record_ TT_Hdmx_Record; struct TT_Hdmx_ { TT_UShort version; TT_Short num_records; TT_Hdmx_Record* records; }; typedef struct TT_Hdmx_ TT_Hdmx; /* A structure used to describe face properties. */ struct TT_Face_Properties_ { TT_UShort num_Glyphs; /* number of glyphs in face */ TT_UShort max_Points; /* maximum number of points in a glyph */ TT_UShort max_Contours; /* maximum number of contours in a glyph */ TT_UShort num_CharMaps; /* number of charmaps in the face */ TT_UShort num_Names; /* number of name records in the face */ TT_ULong num_Faces; /* 1 for normal TrueType files, and the */ /* number of embedded faces for TrueType */ /* collections */ TT_Header* header; /* TrueType header table */ TT_Horizontal_Header* horizontal; /* TrueType horizontal header */ TT_OS2* os2; /* TrueType OS/2 table */ TT_Postscript* postscript; /* TrueType Postscript table */ TT_Hdmx* hdmx; /* TrueType hor. dev. metr. table */ TT_Vertical_Header* vertical; /* TT Vertical header, if present */ }; typedef struct TT_Face_Properties_ TT_Face_Properties; /* Here are the definitions of the handle types used for FreeType's */ /* most common objects accessed by the client application. We use */ /* a simple trick: */ /* */ /* Each handle type is a structure that only contains one */ /* pointer. The advantage of structures is that they are */ /* mutually exclusive types. We could have defined the */ /* following types: */ /* */ /* typedef void* TT_Stream; */ /* typedef void* TT_Face; */ /* typedef void* TT_Instance; */ /* typedef void* TT_Glyph; */ /* typedef void* TT_CharMap; */ /* */ /* but these would have allowed lines like: */ /* */ /* stream = instance; */ /* */ /* in the client code this would be a severe bug, unnoticed */ /* by the compiler! */ /* */ /* Thus, we enforce type checking with a simple language */ /* trick... */ /* */ /* NOTE: Some macros are defined in tttypes.h to perform */ /* automatic type conversions for library hackers... */ struct TT_Engine_ { void* z; }; struct TT_Stream_ { void* z; }; struct TT_Face_ { void* z; }; struct TT_Instance_ { void* z; }; struct TT_Glyph_ { void* z; }; struct TT_CharMap_ { void* z; }; typedef struct TT_Engine_ TT_Engine; /* engine instance */ typedef struct TT_Stream_ TT_Stream; /* stream handle type */ typedef struct TT_Face_ TT_Face; /* face handle type */ typedef struct TT_Instance_ TT_Instance; /* instance handle type */ typedef struct TT_Glyph_ TT_Glyph; /* glyph handle type */ typedef struct TT_CharMap_ TT_CharMap; /* character map handle type */ /* Almost all functions return an error code of this type. */ typedef long TT_Error; /*******************************************************************/ /* */ /* FreeType API */ /* */ /* All these begin with a `TT_' prefix. */ /* */ /* Most of them are implemented in the `ttapi.c' source file. */ /* */ /*******************************************************************/ /* Get version information. */ EXPORT_DEF TT_Error TT_FreeType_Version( int *major, int *minor ); /* Initialize the engine. */ EXPORT_DEF TT_Error TT_Init_FreeType( TT_Engine* engine ); /* Finalize the engine, and release all allocated objects. */ EXPORT_DEF TT_Error TT_Done_FreeType( TT_Engine engine ); /* Set the gray level palette. This is an array of 5 bytes used */ /* to produce the font smoothed pixmaps. By convention: */ /* */ /* palette[0] = background (white) */ /* palette[1] = light */ /* palette[2] = medium */ /* palette[3] = dark */ /* palette[4] = foreground (black) */ /* */ EXPORT_DEF TT_Error TT_Set_Raster_Gray_Palette( TT_Engine engine, TT_Byte* palette ); /* ----------------------- face management ----------------------- */ /* Open a new TrueType font file, and returns a handle for */ /* it in variable '*face'. */ /* */ /* Note: The file can be either a TrueType file (*.ttf) or */ /* a TrueType collection (*.ttc, in this case, only */ /* the first face is opened). The number of faces in */ /* the same collection can be obtained in the face's */ /* properties, using TT_Get_Face_Properties() and the */ /* `max_Faces' field. */ EXPORT_DEF TT_Error TT_Open_Face( TT_Engine engine, const TT_Text* fontPathName, TT_Face* face ); /* Open a TrueType font file located inside a collection. */ /* The font is assigned by its index in `fontIndex'. */ EXPORT_DEF TT_Error TT_Open_Collection( TT_Engine engine, const TT_Text* collectionPathName, TT_ULong fontIndex, TT_Face* face ); /* Return face properties in the `properties' structure. */ /* */ /* Note that since version 1.3, we support font files with no */ /* OS/2 table (mainly old Mac fonts). In this case, the OS/2 */ /* `version' field will be set to 0xFFFF, and all other fields */ /* will be zeroed. */ EXPORT_DEF TT_Error TT_Get_Face_Properties( TT_Face face, TT_Face_Properties* properties ); /* Set a face object's generic pointer */ EXPORT_DEF TT_Error TT_Set_Face_Pointer( TT_Face face, void* data ); /* Get a face object's generic pointer */ EXPORT_DEF void* TT_Get_Face_Pointer( TT_Face face ); /* Close a face's file handle to save system resources. The file */ /* will be re-opened automatically on the next disk access. */ EXPORT_DEF TT_Error TT_Flush_Face( TT_Face face ); /* Get a face's glyph metrics expressed in font units. Returns any */ /* number of arrays. Set the fields to NULL if you are not interested */ /* by a given array. */ EXPORT_DEF TT_Error TT_Get_Face_Metrics( TT_Face face, TT_UShort firstGlyph, TT_UShort lastGlyph, TT_Short* leftBearings, TT_UShort* widths, TT_Short* topBearings, TT_UShort* heights ); /* Close a given font object, destroying all associated */ /* instances. */ EXPORT_DEF TT_Error TT_Close_Face( TT_Face face ); /* Get font or table data. */ EXPORT_DEF TT_Error TT_Get_Font_Data( TT_Face face, TT_ULong tag, TT_Long offset, void* buffer, TT_Long* length );/* A simple macro to build table tags from ASCII chars */#define MAKE_TT_TAG( _x1, _x2, _x3, _x4 ) \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -