📄 ftglyph.h
字号:
enum { ft_glyph_bbox_unscaled = 0, /* return unscaled font units */ ft_glyph_bbox_subpixels = 0, /* return unfitted 26.6 coordinates */ ft_glyph_bbox_gridfit = 1, /* return grid-fitted 26.6 coordinates */ ft_glyph_bbox_truncate = 2, /* return coordinates in integer pixels */ ft_glyph_bbox_pixels = 3 /* return grid-fitted pixel coordinates */ }; /*************************************************************************/ /* */ /* <Function> */ /* FT_Glyph_Get_CBox */ /* */ /* <Description> */ /* Returns a glyph's `control box'. The control box encloses all the */ /* outline's points, including Bezier control points. Though it */ /* coincides with the exact bounding box for most glyphs, it can be */ /* slightly larger in some situations (like when rotating an outline */ /* which contains Bezier outside arcs). */ /* */ /* Computing the control box is very fast, while getting the bounding */ /* box can take much more time as it needs to walk over all segments */ /* and arcs in the outline. To get the latter, you can use the */ /* `ftbbox' component which is dedicated to this single task. */ /* */ /* <Input> */ /* glyph :: A handle to the source glyph object. */ /* */ /* mode :: The mode which indicates how to interpret the returned */ /* bounding box values. */ /* */ /* <Output> */ /* acbox :: The glyph coordinate bounding box. Coordinates are */ /* expressed in 1/64th of pixels if it is grid-fitted. */ /* */ /* <Note> */ /* Coordinates are relative to the glyph origin, using the Y-upwards */ /* convention. */ /* */ /* If the glyph has been loaded with FT_LOAD_NO_SCALE, `bbox_mode' */ /* must be set to `ft_glyph_bbox_unscaled' to get unscaled font */ /* units. */ /* */ /* If `bbox_mode' is set to `ft_glyph_bbox_subpixels' the bbox */ /* coordinates are returned in 26.6 pixels (i.e. 1/64th of pixels). */ /* */ /* Note that the maximum coordinates are exclusive, which means that */ /* one can compute the width and height of the glyph image (be it in */ /* integer or 26.6 pixels) as: */ /* */ /* width = bbox.xMax - bbox.xMin; */ /* height = bbox.yMax - bbox.yMin; */ /* */ /* Note also that for 26.6 coordinates, if `bbox_mode' is set to */ /* `ft_glyph_bbox_gridfit', the coordinates will also be grid-fitted, */ /* which corresponds to: */ /* */ /* bbox.xMin = FLOOR(bbox.xMin); */ /* bbox.yMin = FLOOR(bbox.yMin); */ /* bbox.xMax = CEILING(bbox.xMax); */ /* bbox.yMax = CEILING(bbox.yMax); */ /* */ /* To get the bbox in pixel coordinates, set `bbox_mode' to */ /* `ft_glyph_bbox_truncate'. */ /* */ /* To get the bbox in grid-fitted pixel coordinates, set `bbox_mode' */ /* to `ft_glyph_bbox_pixels'. */ /* */ /* The default value for `bbox_mode' is `ft_glyph_bbox_pixels'. */ /* */ FT_EXPORT( void ) FT_Glyph_Get_CBox( FT_Glyph glyph, FT_UInt bbox_mode, FT_BBox *acbox ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Glyph_To_Bitmap */ /* */ /* <Description> */ /* Converts a given glyph object to a bitmap glyph object. */ /* */ /* <InOut> */ /* the_glyph :: A pointer to a handle to the target glyph. */ /* */ /* <Input> */ /* render_mode :: A set of bit flags that describe how the data is */ /* */ /* */ /* origin :: A pointer to a vector used to translate the glyph */ /* image before rendering. Can be 0 (if no */ /* translation). The origin is expressed in */ /* 26.6 pixels. */ /* */ /* destroy :: A boolean that indicates that the original glyph */ /* image should be destroyed by this function. It is */ /* never destroyed in case of error. */ /* */ /* <Return> */ /* FreeType error code. 0 means success. */ /* */ /* <Note> */ /* The glyph image is translated with the `origin' vector before */ /* rendering. In case of error, it it translated back to its */ /* original position and the glyph is left untouched. */ /* */ /* The first parameter is a pointer to a FT_Glyph handle, that will */ /* be replaced by this function. Typically, you would use (omitting */ /* error handling): */ /* */ /* */ /* { */ /* FT_Glyph glyph; */ /* FT_BitmapGlyph glyph_bitmap; */ /* */ /* */ /* // load glyph */ /* error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAUT ); */ /* */ /* // extract glyph image */ /* error = FT_Get_Glyph( face->glyph, &glyph ); */ /* */ /* // convert to a bitmap (default render mode + destroy old) */ /* if ( glyph->format != ft_glyph_format_bitmap ) */ /* { */ /* error = FT_Glyph_To_Bitmap( &glyph, ft_render_mode_default, */ /* 0, 1 ); */ /* if ( error ) // glyph unchanged */ /* ... */ /* } */ /* */ /* // access bitmap content by typecasting */ /* glyph_bitmap = (FT_BitmapGlyph)glyph; */ /* */ /* // do funny stuff with it, like blitting/drawing */ /* ... */ /* */ /* // discard glyph image (bitmap or not) */ /* FT_Done_Glyph( glyph ); */ /* } */ /* */ /* */ /* This function will always fail if the glyph's format isn't */ /* scalable. */ /* */ FT_EXPORT( FT_Error ) FT_Glyph_To_Bitmap( FT_Glyph* the_glyph, FT_ULong render_mode, FT_Vector* origin, FT_Bool destroy ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Done_Glyph */ /* */ /* <Description> */ /* Destroys a given glyph. */ /* */ /* <Input> */ /* glyph :: A handle to the target glyph object. */ /* */ FT_EXPORT( void ) FT_Done_Glyph( FT_Glyph glyph ); /* other helpful functions */ /*************************************************************************/ /* */ /* <Function> */ /* FT_Matrix_Multiply */ /* */ /* <Description> */ /* Performs the matrix operation `b = a*b'. */ /* */ /* <Input> */ /* a :: A pointer to matrix `a'. */ /* */ /* <InOut> */ /* b :: A pointer to matrix `b'. */ /* */ /* <Note> */ /* The result is undefined if either `a' or `b' is zero. */ /* */ FT_EXPORT( void ) FT_Matrix_Multiply( FT_Matrix* a, FT_Matrix* b ); /*************************************************************************/ /* */ /* <Function> */ /* FT_Matrix_Invert */ /* */ /* <Description> */ /* Inverts a 2x2 matrix. Returns an error if it can't be inverted. */ /* */ /* <InOut> */ /* matrix :: A pointer to the target matrix. Remains untouched in */ /* case of error. */ /* */ /* <Return> */ /* FreeType error code. 0 means success. */ /* */ FT_EXPORT( FT_Error ) FT_Matrix_Invert( FT_Matrix* matrix );FT_END_HEADER#endif /* __FTGLYPH_H__ *//* END */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -