📄 truetype.h
字号:
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. */ 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're 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 ) \ (((TT_ULong)_x1 << 24) | \ ((TT_ULong)_x2 << 16) | \ ((TT_ULong)_x3 << 8) | \ (TT_ULong)_x4) /* ----------------------- instance management -------------------- */ /* Open a new font instance and returns an instance handle */ /* for it in '*instance'. */ EXPORT_DEF TT_Error TT_New_Instance( TT_Face face, TT_Instance* instance ); /* Set device resolution for a given instance. The values are */ /* given in dpi (Dots Per Inch). Default is 96 in both directions. */ EXPORT_DEF TT_Error TT_Set_Instance_Resolutions( TT_Instance instance, TT_UShort xResolution, TT_UShort yResolution ); /* Set the pointsize for a given instance. Default is 10pt. */ EXPORT_DEF TT_Error TT_Set_Instance_CharSize( TT_Instance instance, TT_F26Dot6 charSize ); EXPORT_DEF TT_Error TT_Set_Instance_CharSizes( TT_Instance instance, TT_F26Dot6 charWidth, TT_F26Dot6 charHeight );#define TT_Set_Instance_PointSize( ins, ptsize ) \ TT_Set_Instance_CharSize( ins, ptsize*64 ) EXPORT_DEF TT_Error TT_Set_Instance_PixelSizes( TT_Instance instance, TT_UShort pixelWidth, TT_UShort pixelHeight, TT_F26Dot6 pointSize ); /* This function has been deprecated !! Do not use it, as it */ /* doesn't work reliably. You can perfectly control hinting */ /* yourself when loading glyphs, then apply transforms as usual */ EXPORT_DEF TT_Error TT_Set_Instance_Transform_Flags( TT_Instance instance, TT_Bool rotated, TT_Bool stretched ); /* Return instance metrics in 'metrics'. */ EXPORT_DEF TT_Error TT_Get_Instance_Metrics( TT_Instance instance, TT_Instance_Metrics* metrics ); /* Set an instance's generic pointer. */ EXPORT_DEF TT_Error TT_Set_Instance_Pointer( TT_Instance instance, void* data ); /* Get an instance's generic pointer. */ EXPORT_DEF void* TT_Get_Instance_Pointer( TT_Instance instance ); /* Close a given instance object, destroying all associated data. */ EXPORT_DEF TT_Error TT_Done_Instance( TT_Instance instance ); /* ----------------------- glyph management ----------------------- */ /* Create a new glyph object related to the given 'face'. */ EXPORT_DEF TT_Error TT_New_Glyph( TT_Face face, TT_Glyph* glyph ); /* Discard (and destroy) a given glyph object. */ EXPORT_DEF TT_Error TT_Done_Glyph( TT_Glyph glyph );#define TTLOAD_SCALE_GLYPH 1#define TTLOAD_HINT_GLYPH 2#define TTLOAD_DEFAULT (TTLOAD_SCALE_GLYPH | TTLOAD_HINT_GLYPH) /* Load and process (scale/transform and hint) a glyph from the */ /* given 'instance'. The glyph and instance handles must be */ /* related to the same face object. The glyph index can be */ /* computed with a call to TT_Char_Index(). */ /* The 'load_flags' argument is a combination of the macros */ /* TTLOAD_SCALE_GLYPH and TTLOAD_HINT_GLYPH. Hinting will be */ /* applied only if the scaling is selected. */ /* When scaling is off (i.e., load_flags = 0), the returned */ /* outlines are in EM square coordinates (also called FUnits), */ /* extracted directly from the font with no hinting. */ /* Other glyph metrics are also in FUnits. */ /* When scaling is on, the returned outlines are in fractional */ /* pixel units (i.e. TT_F26Dot6 = 26.6 fixed floats). */ /* NOTE: The glyph index must be in the range 0..num_glyphs-1 */ /* where 'num_glyphs' is the total number of glyphs in */ /* the font file (given in the face properties). */ EXPORT_DEF TT_Error TT_Load_Glyph( TT_Instance instance, TT_Glyph glyph, TT_UShort glyphIndex, TT_UShort loadFlags ); /* Return glyph outline pointers in 'outline'. Note that the returned */ /* pointers are owned by the glyph object, and will be destroyed with */ /* it. The client application should _not_ change the pointers. */ EXPORT_DEF TT_Error TT_Get_Glyph_Outline( TT_Glyph glyph, TT_Outline* outline ); /* Copy the glyph metrics into 'metrics'. */ EXPORT_DEF TT_Error TT_Get_Glyph_Metrics( TT_Glyph glyph, TT_Glyph_Metrics* metrics ); /* Copy the glyph's big metrics into 'metrics'. */ /* Necessary to obtain vertical metrics. */ EXPORT_DEF TT_Error TT_Get_Glyph_Big_Metrics( TT_Glyph glyph, TT_Big_Glyph_Metrics* metrics ); /* Render the glyph into a bitmap, with given position offsets. */ /* Note: Only use integer pixel offsets to preserve the fine */ /* hinting of the glyph and the 'correct' anti-aliasing */ /* (where vertical and horizontal stems aren't grayed). */ /* This means that xOffset and yOffset must be multiples */ /* of 64! */ EXPORT_DEF TT_Error TT_Get_Glyph_Bitmap( TT_Glyph glyph, TT_Raster_Map* map, TT_F26Dot6 xOffset, TT_F26Dot6 yOffset ); /* Render the glyph into a pixmap, with given position offsets. */ /* Note : Only use integer pixel offsets to preserve the fine */ /* hinting of the glyph and the 'correct' anti-aliasing */ /* (where vertical and horizontal stems aren't grayed). */ /* This means that xOffset and yOffset must be multiples */ /* of 64! */ EXPORT_DEF TT_Error TT_Get_Glyph_Pixmap( TT_Glyph glyph, TT_Raster_Map* map, TT_F26Dot6 xOffset, TT_F26Dot6 yOffset ); /* ----------------------- outline support ------------------------ */ /* Allocate a new outline. Reserve space for 'numPoints' and */ /* 'numContours'. */ EXPORT_DEF TT_Error TT_New_Outline( TT_UShort numPoints, TT_Short numContours, TT_Outline* outline ); /* Release an outline. */ EXPORT_DEF TT_Error TT_Done_Outline( TT_Outline* outline ); /* Copy an outline into another one. */ EXPORT_DEF TT_Error TT_Copy_Outline( TT_Outline* source, TT_Outline* target ); /* Render an outline into a bitmap. */ EXPORT_DEF TT_Error TT_Get_Outline_Bitmap( TT_Engine engine, TT_Outline* outline, TT_Raster_Map* map ); /* Render an outline into a pixmap -- note that this function uses */ /* a different pixel scale, where 1.0 pixels = 128 XXXX */ EXPORT_DEF TT_Error TT_Get_Outline_Pixmap( TT_Engine engine, TT_Outline* outline, TT_Raster_Map* map ); /* Return an outline's bounding box -- this function is slow as it */ /* performs a complete scan-line process, without drawing, to get */ /* the most accurate values. XXXX */ EXPORT_DEF TT_Error TT_Get_Outline_BBox( TT_Outline* outline, TT_B
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -