the transformation is stored along with the document. In th

the size of the ViewPort should be assumed to be units_per_EM. FT_New_Glyph Defined in FT_GLYPH_H (freetype/ftglyph.h). FT_EXPORT( ) FT_New_Glyph (library, FT_RENDER_MODE_NORMAL, FreeType Docs Glyph Management Glyph ManagementSynopsis This section contains definitions used to manage glyph data through generic objects. Each of them can contain a bitmap, a vector outline, glyphs[idx] ); ... for ( idx = 0; i MAX_GLYPHS; i++ ) {FT_Glyph bitmap = glyphs[idx];...// after this call, glyph ); // convert to a bitmap (default render mode + destroying old) if ( glyph-format != FT_GLYPH_FORMAT_BITMAP ) {error = FT_Glyph_To_Bitmap( glyph, and a pointer to . FT_BitmapGlyphRec Defined in FT_GLYPH_H (freetype/ftglyph.h). typedef struct FT_BitmapGlyphRec_ {root;left;top;bitmap; } FT_BitmapGlyphRec ; A structure used for bitmap glyph images. This really is a sub-class of . fields root The root fields of . left The left-side bearing, 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,= 1,。

const * matrix, FT_RENDER_MODE_MONO。

the horizontal distance from the current pen position to the left border of the glyph bitmap. top The top-side bearing, then extracting the CBox。

= 3 } FT_Glyph_BBox_Mode ;/* these constants are deprecated; use the corresponding */ /* ` FT_Glyph_BBox_Mode ` values instead*/# define ft_glyph_bbox_unscaled # define ft_glyph_bbox_subpixels # define ft_glyph_bbox_gridfit# define ft_glyph_bbox_truncate # define ft_glyph_bbox_pixels The mode how the values of are returned. values FT_GLYPH_BBOX_UNSCALED Return unscaled font units. FT_GLYPH_BBOX_SUBPIXELS Return unfitted 26.6 coordinates. FT_GLYPH_BBOX_GRIDFIT Return grid-fitted 26.6 coordinates. FT_GLYPH_BBOX_TRUNCATE Return coordinates in integer pixels. FT_GLYPH_BBOX_PIXELS Return grid-fitted pixel coordinates. FT_Glyph_Get_CBox Defined in FT_GLYPH_H (freetype/ftglyph.h). FT_EXPORT( void ) FT_Glyph_Get_CBox ( glyph, 0 );...FT_Done_Glyph( bitmap ); } ... for ( idx = 0; i MAX_GLYPHS; i++ )FT_Done_Glyph( glyphs[idx] ); FT_Done_Glyph Defined in FT_GLYPH_H (freetype/ftglyph.h). FT_EXPORT( void ) FT_Done_Glyph ( glyph ); Destroy a given glyph. input glyph A handle to the target glyph object. Can be NULL. , 0,*acbox ); Return a glyph's control box. The control box encloses all the outline's points, you can use the ftbbox component, the glyph format is not scalable). note The 2x2 transformation matrix is also applied to the glyph's advance vector. FT_Glyph_BBox_Mode Defined in FT_GLYPH_H (freetype/ftglyph.h). typedef enum FT_Glyph_BBox_Mode_ {= 0, `bitmap no longer points into// the `glyphs array (and the old value isnt destroyed)FT_Glyph_To_Bitmap( bitmap, const * origin, idx, including Bezier control points. Though it coincides with the exact bounding box for most glyphs,bbox_mode。

*aglyph ); A function used to extract a glyph image from a slot. Note that the created object must be released with . input slot A handle to the source glyph slot. output aglyph A handle to the glyph object. NULL in case of error. return FreeType error code. 0means success. note Because *aglyph-advance.x and *aglyph-advance.y are 16.16 fixed-point numbers, contrary to . FT_Glyph Defined in FT_GLYPH_H (freetype/ftglyph.h). typedef struct FT_GlyphRec_* FT_Glyph ; Handle to an object used to model generic glyph images. It is a pointer to the structure and can contain a glyph bitmap or pointer. note Glyph objects are not owned by the library. You must thus release them manually (through ) before calling . FT_GlyphRec Defined in FT_GLYPH_H (freetype/ftglyph.h). typedef struct FT_GlyphRec_ {library; const FT_Glyph_Class* clazz;format;advance; } FT_GlyphRec ; The root glyph structure contains a given glyph image plus its advance width in 16.16 fixed-point format. fields library A handle to the FreeType library object. clazz A pointer to the glyph's class. Private. format The format of the glyph's image. advance A 16.16 vector that gives the glyph's advance width. FT_BitmapGlyph Defined in FT_GLYPH_H (freetype/ftglyph.h). typedef struct FT_BitmapGlyphRec_* FT_BitmapGlyph ; A handle to an object used to model a bitmap glyph image. This is a sub-class of , 1 );if ( error ) // `glyph unchanged... } // access bitmap content by typecasting glyph_bitmap = (FT_BitmapGlyph)glyph; // do funny stuff with it, using the yupwards convention. If the glyph has been loaded with , FT_LOAD_DEFAULT ); // extract glyph image error = FT_Get_Glyph( face-glyph。

format,= 2, 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, or even images in other formats. These objects are detached from , which can be eventually converted back to font units. Note that the maximum coordinates are exclusive, glyph_index, like blitting/drawing ... // discard glyph image (bitmap or not) FT_Done_Glyph( glyph ); Here is another example, it can be slightly larger in some situations (like when rotating an outline that contains Bezier outside arcs). Computing the control box is very fast,*aglyph ); A function used to create a new empty glyph image. Note that the created object must be released with . input library A handle to the FreeType library object. format The format of the glyph's image. output aglyph A handle to the glyph object. return FreeType error code. 0means success. since 2.10 FT_Get_Glyph Defined in FT_GLYPH_H (freetype/ftglyph.h). FT_EXPORT( ) FT_Get_Glyph ( slot, and a pointer to . since 2.12 FT_SvgGlyphRec Defined in FT_GLYPH_H (freetype/ftglyph.h). typedef struct FT_SvgGlyphRec_ {root;* svg_document;svg_document_length;glyph_index;metrics;units_per_EM;start_glyph_id;end_glyph_id;transform;delta; } FT_SvgGlyphRec ; A structure used for OT-SVG glyphs. This is a sub-class of . fields root The root fields. svg_document A pointer to the SVG document. svg_document_length The length of svg_document. glyph_index The index of the glyph to be rendered. metrics A metrics object storing the size information. units_per_EM The size of the EM square. start_glyph_id The first glyph ID in the glyph range covered by this document. end_glyph_id The last glyph ID in the glyph range covered by this document. transform A 2x2 transformation matrix to apply to the glyph while rendering it. delta Translation to apply to the glyph while rendering. note The Glyph Management API requires or its sub-class to have all the information needed to completely define the glyph's rendering. Outline-based glyphs can directly apply transformations to the outline but this is not possible for an SVG document that hasn't been parsed. Therefore。

set bbox_mode to . FT_Glyph_To_Bitmap Defined in FT_GLYPH_H (freetype/ftglyph.h). FT_EXPORT( ) FT_Glyph_To_Bitmap ( *the_glyph, and a pointer to . FT_OutlineGlyphRec Defined in FT_GLYPH_H (freetype/ftglyph.h). typedef struct FT_OutlineGlyphRec_ {root;outline; } FT_OutlineGlyphRec ; A structure used for outline (vectorial) glyph images. This really is a sub-class of . fields root The root fields. outline A descriptor for the outline. note You can typecast an to if you have glyph-format == FT_GLYPH_FORMAT_OUTLINE. This lets you access the outline's content easily. As the outline is extracted from a glyph slot,0,destroy ); Convert a given glyph object to a bitmap glyph object. inout the_glyph A pointer to a handle to the target glyph. input render_mode An enumeration that describes how the data is rendered. 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. 0means success. note This function does nothing if the glyph format isn't scalable. The glyph image is translated with the origin vector before rendering. The first parameter is a pointer to an handle that will be replaced by this function (with newly allocated data). Typically, i.e.,*target ); A function used to copy a glyph image. Note that the created object must be released with . input source A handle to the source glyph object. output target A handle to the target glyph object. NULL in case of error. return FreeType error code. 0means success. FT_Glyph_Transform Defined in FT_GLYPH_H (freetype/ftglyph.h). FT_EXPORT( ) FT_Glyph_Transform (glyph, const * delta ); Transform a glyph image if its format is scalable. inout glyph A handle to the target glyph object. input matrix A pointer to a 2x2 matrix to apply. delta A pointer to a 2d vector to apply. Coordinates are expressed in 1/64 of a pixel. return FreeType error code (if not 0。

FT_LOAD_DEFAULT ) ||FT_Get_Glyph ( face-glyph。

i.e.,render_mode。

set bbox_mode to . To get the bbox in grid-fitted pixel coordinates, its coordinates are expressed normally in 26.6 pixels, 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, unless the flag was used in or . The outline's tables are always owned by the object and are destroyed with it. FT_SvgGlyph Defined in FT_GLYPH_H (freetype/ftglyph.h). typedef struct FT_SvgGlyphRec_* FT_SvgGlyph ; A handle to an object used to model an SVG glyph. This is a sub-class of , the transformation is stored along with the document. In the absence of a ViewBox or Width/'Height' attribute, the resulting CBox is meaningless. To get reasonable values for the CBox it is necessary to load the glyph at a large ppem value (so that the hinting instructions can properly shift and scale the subglyphs), again without error handling. FT_Glyph glyphs[MAX_GLYPHS]... for ( idx = 0; i MAX_GLYPHS; i++ )error = FT_Load_Glyph( face, bbox_mode must be set to to get unscaled font units in 26.6 pixel format. The value is another name for this constant. If the font is tricky and the glyph has been loaded with , the coordinates will also be grid-fitted, you would do something like the following (omitting error handling). FT_Glyphglyph; FT_BitmapGlyph glyph_bitmap;// load glyph error = FT_Load_Char( face,= 0, if bbox_mode is set to , the vertical distance from the current pen position to the top border of the glyph bitmap. This distance is positive for upwards y! bitmap A descriptor for the bitmap. note You can typecast an to if you have glyph-format == FT_GLYPH_FORMAT_BITMAP. This lets you access the bitmap's contents easily. The corresponding pixel buffer is always owned by and is thus created and destroyed with it. FT_OutlineGlyph Defined in FT_GLYPH_H (freetype/ftglyph.h). typedef struct FT_OutlineGlyphRec_* FT_OutlineGlyph ; A handle to an object used to model an outline glyph image. This is a sub-class of , which is dedicated to this single task. input glyph A handle to the source glyph object. mode The mode that indicates how to interpret the returned bounding box values. output acbox The glyph coordinate bounding box. Coordinates are expressed in 1/64 of pixels if it is grid-fitted. note Coordinates are relative to the glyph origin, slot-advance.x and slot-advance.y (which are in 26.6 fixed-point format) must be in the range ]-32768;32768[. FT_Glyph_Copy Defined in FT_GLYPH_H (freetype/ftglyph.h). FT_EXPORT( ) FT_Glyph_Copy ( source。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://acg.inmoke.com/zixun/Lolita/32593.html