ft2-glyph_management.html

来自「Free type 2.1.0 Documents」· HTML 代码 · 共 496 行 · 第 1/2 页

HTML
496
字号
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>

  FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> )
  <b>FT_Glyph_Transform</b>( <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a>    glyph,
                      <a href="ft2-basic_types.html#FT_Matrix">FT_Matrix</a>*  matrix,
                      <a href="ft2-basic_types.html#FT_Vector">FT_Vector</a>*  delta );

</pre></table><br>
<table align=center width="87%"><tr><td>
<p>Transforms a glyph image if its format is scalable.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>inout</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>glyph</b></td><td>
<p>A handle to the target glyph object.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>matrix</b></td><td>
<p>A pointer to a 2x2 matrix to apply.</p>
</td></tr>
<tr valign=top><td><b>delta</b></td><td>
<p>A pointer to a 2d vector to apply. Coordinates are expressed in 1/64th of a pixel.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
<p>FreeType error code (the glyph format is not scalable if it is not zero).</p>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td>
<p>The 2x2 transformation matrix is also applied to the glyph's advance vector.</p>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_Glyph_BBox_Mode">FT_Glyph_BBox_Mode</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>

  <span class="keyword">typedef</span> <span class="keyword">enum</span>  FT_Glyph_BBox_Mode_
  {
    <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_UNSCALED</a>  = 0,
    <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_SUBPIXELS</a> = 0,
    <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_GRIDFIT</a>   = 1,
    <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_TRUNCATE</a>  = 2,
    <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_PIXELS</a>    = 3

  } <b>FT_Glyph_BBox_Mode</b>;

</pre></table><br>
<table align=center width="87%"><tr><td>
<p>The mode how the values of <a href="ft2-glyph_management.html#FT_Glyph_Get_CBox">FT_Glyph_Get_CBox</a> are returned.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>values</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>FT_GLYPH_BBOX_UNSCALED</b></td><td>
<p>Return unscaled font units.</p>
</td></tr>
<tr valign=top><td><b>FT_GLYPH_BBOX_SUBPIXELS</b></td><td>
<p>Return unfitted 26.6 coordinates.</p>
</td></tr>
<tr valign=top><td><b>FT_GLYPH_BBOX_GRIDFIT</b></td><td>
<p>Return grid-fitted 26.6 coordinates.</p>
</td></tr>
<tr valign=top><td><b>FT_GLYPH_BBOX_TRUNCATE</b></td><td>
<p>Return coordinates in integer pixels.</p>
</td></tr>
<tr valign=top><td><b>FT_GLYPH_BBOX_PIXELS</b></td><td>
<p>Return grid-fitted pixel coordinates.</p>
</td></tr>
</table>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="ft_glyph_bbox_xxx">ft_glyph_bbox_xxx</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>

#define <a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_unscaled</a>   <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_UNSCALED</a>
#define <a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_subpixels</a>  <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_SUBPIXELS</a>
#define <a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_gridfit</a>    <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_GRIDFIT</a>
#define <a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_truncate</a>   <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_TRUNCATE</a>
#define <a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_pixels</a>     <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_PIXELS</a>

</pre></table><br>
<table align=center width="87%"><tr><td>
<p>These constants are deprecated. Use the corresponding <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_Glyph_BBox_Mode</a> values instead.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>values</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>ft_glyph_bbox_unscaled</b></td><td>
<p>see <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_UNSCALED</a></p>
</td></tr>
<tr valign=top><td><b>ft_glyph_bbox_subpixels</b></td><td>
<p>see <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_SUBPIXELS</a></p>
</td></tr>
<tr valign=top><td><b>ft_glyph_bbox_gridfit</b></td><td>
<p>see <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_GRIDFIT</a></p>
</td></tr>
<tr valign=top><td><b>ft_glyph_bbox_truncate</b></td><td>
<p>see <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_TRUNCATE</a></p>
</td></tr>
<tr valign=top><td><b>ft_glyph_bbox_pixels</b></td><td>
<p>see <a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_PIXELS</a></p>
</td></tr>
</table>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_Glyph_Get_CBox">FT_Glyph_Get_CBox</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>

  FT_EXPORT( <span class="keyword">void</span> )
  <b>FT_Glyph_Get_CBox</b>( <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a>  glyph,
                     <a href="ft2-basic_types.html#FT_UInt">FT_UInt</a>   bbox_mode,
                     <a href="ft2-basic_types.html#FT_BBox">FT_BBox</a>  *acbox );

</pre></table><br>
<table align=center width="87%"><tr><td>
<p>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).</p>
<p>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.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>glyph</b></td><td>
<p>A handle to the source glyph object.</p>
</td></tr>
<tr valign=top><td><b>mode</b></td><td>
<p>The mode which indicates how to interpret the returned bounding box values.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>output</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>acbox</b></td><td>
<p>The glyph coordinate bounding box. Coordinates are expressed in 1/64th of pixels if it is grid-fitted.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td>
<p>Coordinates are relative to the glyph origin, using the Y-upwards convention.</p>
<p>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 in 26.6 pixel format. The value `FT_GLYPH_BBOX_SUBPIXELS' is another name for this constant.</p>
<p>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:</p>
<p>width = bbox.xMax - bbox.xMin; height = bbox.yMax - bbox.yMin;</p>
<p>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:</p>
<p>bbox.xMin = FLOOR(bbox.xMin); bbox.yMin = FLOOR(bbox.yMin); bbox.xMax = CEILING(bbox.xMax); bbox.yMax = CEILING(bbox.yMax);</p>
<p>To get the bbox in pixel coordinates, set `bbox_mode' to `FT_GLYPH_BBOX_TRUNCATE'.</p>
<p>To get the bbox in grid-fitted pixel coordinates, set `bbox_mode' to `FT_GLYPH_BBOX_PIXELS'.</p>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_Glyph_To_Bitmap">FT_Glyph_To_Bitmap</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>

  FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> )
  <b>FT_Glyph_To_Bitmap</b>( <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a>*       the_glyph,
                      <a href="ft2-base_interface.html#FT_Render_Mode">FT_Render_Mode</a>  render_mode,
                      <a href="ft2-basic_types.html#FT_Vector">FT_Vector</a>*      origin,
                      <a href="ft2-basic_types.html#FT_Bool">FT_Bool</a>         destroy );

</pre></table><br>
<table align=center width="87%"><tr><td>
<p>Converts a given glyph object to a bitmap glyph object.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>inout</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>the_glyph</b></td><td>
<p>A pointer to a handle to the target glyph.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>render_mode</b></td><td>
<p>An enumeration that describe how the data is rendered.</p>
</td></tr>
<tr valign=top><td><b>origin</b></td><td>
<p>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.</p>
</td></tr>
<tr valign=top><td><b>destroy</b></td><td>
<p>A boolean that indicates that the original glyph image should be destroyed by this function. It is never destroyed in case of error.</p>
</td></tr>
</table>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td>
<p>FreeType error code. 0 means success.</p>
</td></tr></table>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td>
<p>The glyph image is translated with the `origin' vector before rendering.</p>
<p>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):</p>
<p></p>
<pre class="colored">
  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-&gt;glyph, &amp;glyph );                   
                                                                 
  // convert to a bitmap (default render mode + destroy old)     
  if ( glyph-&gt;format != FT_GLYPH_FORMAT_BITMAP )                 
  {                                                              
    error = FT_Glyph_To_Bitmap( &amp;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 );                                        
</pre>
<p></p>
<p>This function does nothing if the glyph format isn't scalable.</p>
</td></tr></table>
</td></tr></table><hr width="75%">
<table align=center width="75%"><tr><td>
<h4><a name="FT_Done_Glyph">FT_Done_Glyph</a></h4>
<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre>

  FT_EXPORT( <span class="keyword">void</span> )
  <b>FT_Done_Glyph</b>( <a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a>  glyph );


  /* other helpful functions */

</pre></table><br>
<table align=center width="87%"><tr><td>
<p>Destroys a given glyph.</p>
</td></tr></table><br>
<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td>
<table cellpadding=3>
<tr valign=top><td><b>glyph</b></td><td>
<p>A handle to the target glyph object.</p>
</td></tr>
</table>
</td></tr></table>
</td></tr></table><hr width="75%">
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?