📄 freetype.h
字号:
/******************************************************************* * * freetype.h * * High-level interface specification. * * Copyright 1996-1999 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project and may only be used, * modified, and distributed under the terms of the FreeType project * license, LICENSE.TXT. By continuing to use, modify, or distribute * this file you indicate that you have read the license and * understand and accept it fully. * * Note: * * This is the only file that should be included by client * application sources. All other types and functions defined * in the `tt*.h' files are library internals and should not be * included. * ******************************************************************/#ifndef FREETYPE_H#define FREETYPE_H#define TT_FREETYPE_MAJOR 1#define TT_FREETYPE_MINOR 3#include "fterrid.h"#include "ftnameid.h"/* To make freetype.h independent from configuration files we check *//* whether EXPORT_DEF has been defined already. */#ifndef EXPORT_DEF#define EXPORT_DEF extern#endif/* The same for TT_Text. If you define the HAVE_TT_TEXT macro, you *//* have to provide a typedef declaration for TT_Text before *//* including this file. */#ifndef HAVE_TT_TEXT#define HAVE_TT_TEXT typedef char TT_Text; /* The data type to represent */ /* file name string elements. */#endif#ifdef __cplusplus extern "C" {#endif /*******************************************************************/ /* */ /* FreeType types definitions. */ /* */ /* All these begin with a 'TT_' prefix. */ /* */ /*******************************************************************/ typedef int TT_Bool; typedef signed long TT_Fixed; /* signed fixed 16.16 float */ typedef signed short TT_FWord; /* distance in FUnits */ typedef unsigned short TT_UFWord; /* unsigned distance */ typedef char TT_String; typedef signed char TT_Char; typedef unsigned char TT_Byte; typedef signed short TT_Short; typedef unsigned short TT_UShort; typedef int TT_Int; typedef unsigned int TT_UInt; typedef signed long TT_Long; typedef unsigned long TT_ULong; typedef signed short TT_F2Dot14; /* Signed fixed float 2.14 used for */ /* unit vectors, with layout */ /* */ /* s : 1 -- sign bit */ /* m : 1 -- integer bit */ /* f : 14 -- unsigned fractional */ /* */ /* `s:m' is the 2-bit signed int */ /* value to which the positive */ /* fractional part should be added. */ typedef signed long TT_F26Dot6; /* 26.6 fixed float, used for */ /* glyph points pixel coordinates. */ typedef signed long TT_Pos; /* Point position, expressed either */ /* in fractional pixels or notional */ /* units, depending on context. */ /* For example, glyph coordinates */ /* returned by TT_Load_Glyph() are */ /* expressed in font units if */ /* scaling wasn't requested, and */ /* in 26.6 fractional pixels if it */ /* was. */ struct TT_UnitVector_ /* guess what... */ { TT_F2Dot14 x; TT_F2Dot14 y; }; typedef struct TT_UnitVector_ TT_UnitVector; struct TT_Vector_ /* simple vector type */ { TT_F26Dot6 x; TT_F26Dot6 y; }; typedef struct TT_Vector_ TT_Vector; /* A simple 2x2 matrix used for transformations. */ /* You should use 16.16 fixed floats. */ /* */ /* x' = xx*x + xy*y */ /* y' = yx*x + yy*y */ /* */ struct TT_Matrix_ { TT_Fixed xx, xy; TT_Fixed yx, yy; }; typedef struct TT_Matrix_ TT_Matrix; /* A structure used to describe the source glyph to the renderer. */ struct TT_Outline_ { TT_Short n_contours; /* number of contours in glyph */ TT_UShort n_points; /* number of points in the glyph */ TT_Vector* points; /* the outline's points */ TT_Byte* flags; /* the points flags */ TT_UShort* contours; /* the contour end points */ /* The following flag indicates that the outline owns the arrays it */ /* refers to. Typically, this is true of outlines created from the */ /* TT_New_Outline() API, while it isn't for those returned by */ /* TT_Get_Glyph_Outline(). */ TT_Bool owner; /* The outline owns the coordinates, */ /* flags and contours array it uses. */ /* The following flags are set automatically by */ /* TT_Get_Glyph_Outline(). Their meaning is the following: */ /* */ /* high_precision If true, the scan-line converter will use a */ /* higher precision to render bitmaps (i.e., a */ /* 1/1024 pixel precision). This is important for */ /* small ppem sizes. */ /* */ /* second_pass If true, the scan-line converter performs a */ /* second sweep phase dedicated to find vertical */ /* drop-outs. If false, only horizontal drop-outs */ /* will be checked during the first vertical */ /* sweep (yes, this is a bit confusing but it is */ /* really the way it should work). This is */ /* important for small ppems too. */ /* */ /* dropout_mode Specifies the TrueType drop-out mode to use for */ /* continuity checking. Valid values are 0 (no */ /* check), 1, 2, 4, and 5. */ /* */ /* Most of the engine's users will safely ignore these fields... */ TT_Bool high_precision; /* high precision rendering */ TT_Bool second_pass; /* two sweeps rendering */ TT_Char dropout_mode; /* dropout mode */ }; typedef struct TT_Outline_ TT_Outline; /* A structure used to describe a simple bounding box. */ struct TT_BBox_ { TT_Pos xMin; TT_Pos yMin; TT_Pos xMax; TT_Pos yMax; }; typedef struct TT_BBox_ TT_BBox; /* A structure used to return glyph metrics. */ /* */ /* The `bearingX' isn't called `left-side bearing' anymore because */ /* it has different meanings depending on the glyph's orientation. */ /* */ /* The same is true for `bearingY', which is the top-side bearing */ /* defined by the TT_Spec, i.e., the distance from the baseline to */ /* the top of the glyph's bbox. According to our current convention, */ /* this is always the same as `bbox.yMax' but we make it appear for */ /* consistency in its proper field. */ /* */ /* The `advance' field is the advance width for horizontal layout, */ /* and advance height for vertical layouts. */ struct TT_Glyph_Metrics_ { TT_BBox bbox; /* glyph bounding box */ TT_Pos bearingX; /* left-side bearing */ TT_Pos bearingY; /* top-side bearing, per se the TT spec */ TT_Pos advance; /* advance width (or height) */ }; typedef struct TT_Glyph_Metrics_ TT_Glyph_Metrics; /* A structure used to return horizontal _and_ vertical glyph */ /* metrics. */ /* */ /* A glyph can be used either in a horizontal or vertical layout. */ /* Its glyph metrics vary with orientation. The TT_Big_Glyph_Metrics */ /* structure is used to return _all_ metrics in one call. */ struct TT_Big_Glyph_Metrics_ { TT_BBox bbox; /* glyph bounding box */ TT_Pos horiBearingX; /* left side bearing in horizontal layouts */ TT_Pos horiBearingY; /* top side bearing in horizontal layouts */ TT_Pos vertBearingX; /* left side bearing in vertical layouts */ TT_Pos vertBearingY; /* top side bearing in vertical layouts */ TT_Pos horiAdvance; /* advance width for horizontal layout */ TT_Pos vertAdvance; /* advance height for vertical layout */ /* The following fields represent unhinted scaled metrics values. */ /* They can be useful for applications needing to do some device */ /* independent placement of glyphs. */ /* */ /* Applying these metrics to hinted glyphs will most surely ruin */ /* the grid fitting performed by the bytecode interpreter. These */ /* values are better used to compute accumulated positioning */ /* distances. */ TT_Pos linearHoriBearingX; /* linearly scaled horizontal lsb */ TT_Pos linearHoriAdvance; /* linearly scaled horizontal advance */ TT_Pos linearVertBearingY; /* linearly scaled vertical tsb */ TT_Pos linearVertAdvance; /* linearly scaled vertical advance */ }; typedef struct TT_Big_Glyph_Metrics_ TT_Big_Glyph_Metrics; /* A structure used to return instance metrics. */ struct TT_Instance_Metrics_ { TT_F26Dot6 pointSize; /* char. size in points (1pt = 1/72 inch) */ TT_UShort x_ppem; /* horizontal pixels per EM square */ TT_UShort y_ppem; /* vertical pixels per EM square */ TT_Fixed x_scale; /* 16.16 to convert from EM units to 26.6 pix */ TT_Fixed y_scale; /* 16.16 to convert from EM units to 26.6 pix */ TT_UShort x_resolution; /* device horizontal resolution in dpi */ TT_UShort y_resolution; /* device vertical resolution in dpi */ }; typedef struct TT_Instance_Metrics_ TT_Instance_Metrics; /* Flow constants: */ /* */ /* The flow of a bitmap refers to the way lines are oriented */ /* within the bitmap data, i.e., the orientation of the Y */ /* coordinate axis. */ /* */ /* For example, if the first bytes of the bitmap pertain to */ /* its top-most line, then the flow is `down'. If these bytes */ /* pertain to its lowest line, the the flow is `up'. */#define TT_Flow_Down -1 /* bitmap is oriented from top to bottom */#define TT_Flow_Up 1 /* bitmap is oriented from bottom to top */#define TT_Flow_Error 0 /* an error occurred during rendering */ /* A structure used to describe the target bitmap or pixmap to the */ /* renderer. Note that there is nothing in this structure that */ /* gives the nature of the buffer. */ /* */ /* IMPORTANT NOTE: */ /* */ /* In the case of a pixmap, the `width' and `cols' fields must */ /* have the _same_ values, and _must_ be padded to 32-bits, i.e., */ /* be a multiple of 4. Clipping problems will arise otherwise, */ /* if not even page faults! */ /* */ /* The typical settings are: */ /* */ /* - for a WxH bitmap: */ /* */ /* rows = H */ /* cols = (W+7) / 8 */ /* width = W */ /* flow = your_choice */ /* */ /* - for a WxH pixmap: */ /* */ /* rows = H */ /* cols = (W+3) & ~3 */ /* width = cols */ /* flow = your_choice */ struct TT_Raster_Map_ { int rows; /* number of rows */ int cols; /* number of columns (bytes) per row */ int width; /* number of pixels per line */ int flow; /* bitmap orientation */ void* bitmap; /* bit/pixmap buffer */ long size; /* bit/pixmap size in bytes */ }; typedef struct TT_Raster_Map_ TT_Raster_Map; /* ------ The font header TrueType table structure ------ */ struct TT_Header_ { TT_Fixed Table_Version; TT_Fixed Font_Revision; TT_Long CheckSum_Adjust; TT_Long Magic_Number; TT_UShort Flags; TT_UShort Units_Per_EM; TT_Long Created [2]; TT_Long Modified[2]; TT_FWord xMin; TT_FWord yMin; TT_FWord xMax; TT_FWord yMax; TT_UShort Mac_Style; TT_UShort Lowest_Rec_PPEM; TT_Short Font_Direction; TT_Short Index_To_Loc_Format; TT_Short Glyph_Data_Format; }; typedef struct TT_Header_ TT_Header; /* ------ The horizontal header TrueType table structure ------ */ /*******************************************************/ /* This structure is the one defined by the TrueType */ /* specification, plus two fields used to link the */ /* font-units metrics to the header. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -