vrshoot

diff libs/ft2static/freetype/ftglyph.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libs/ft2static/freetype/ftglyph.h	Sat Feb 01 19:58:19 2014 +0200
     1.3 @@ -0,0 +1,613 @@
     1.4 +/***************************************************************************/
     1.5 +/*                                                                         */
     1.6 +/*  ftglyph.h                                                              */
     1.7 +/*                                                                         */
     1.8 +/*    FreeType convenience functions to handle glyphs (specification).     */
     1.9 +/*                                                                         */
    1.10 +/*  Copyright 1996-2001, 2002, 2003, 2006, 2008, 2009 by                   */
    1.11 +/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
    1.12 +/*                                                                         */
    1.13 +/*  This file is part of the FreeType project, and may only be used,       */
    1.14 +/*  modified, and distributed under the terms of the FreeType project      */
    1.15 +/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
    1.16 +/*  this file you indicate that you have read the license and              */
    1.17 +/*  understand and accept it fully.                                        */
    1.18 +/*                                                                         */
    1.19 +/***************************************************************************/
    1.20 +
    1.21 +
    1.22 +  /*************************************************************************/
    1.23 +  /*                                                                       */
    1.24 +  /* This file contains the definition of several convenience functions    */
    1.25 +  /* that can be used by client applications to easily retrieve glyph      */
    1.26 +  /* bitmaps and outlines from a given face.                               */
    1.27 +  /*                                                                       */
    1.28 +  /* These functions should be optional if you are writing a font server   */
    1.29 +  /* or text layout engine on top of FreeType.  However, they are pretty   */
    1.30 +  /* handy for many other simple uses of the library.                      */
    1.31 +  /*                                                                       */
    1.32 +  /*************************************************************************/
    1.33 +
    1.34 +
    1.35 +#ifndef __FTGLYPH_H__
    1.36 +#define __FTGLYPH_H__
    1.37 +
    1.38 +
    1.39 +#include <ft2build.h>
    1.40 +#include FT_FREETYPE_H
    1.41 +
    1.42 +#ifdef FREETYPE_H
    1.43 +#error "freetype.h of FreeType 1 has been loaded!"
    1.44 +#error "Please fix the directory search order for header files"
    1.45 +#error "so that freetype.h of FreeType 2 is found first."
    1.46 +#endif
    1.47 +
    1.48 +
    1.49 +FT_BEGIN_HEADER
    1.50 +
    1.51 +
    1.52 +  /*************************************************************************/
    1.53 +  /*                                                                       */
    1.54 +  /* <Section>                                                             */
    1.55 +  /*    glyph_management                                                   */
    1.56 +  /*                                                                       */
    1.57 +  /* <Title>                                                               */
    1.58 +  /*    Glyph Management                                                   */
    1.59 +  /*                                                                       */
    1.60 +  /* <Abstract>                                                            */
    1.61 +  /*    Generic interface to manage individual glyph data.                 */
    1.62 +  /*                                                                       */
    1.63 +  /* <Description>                                                         */
    1.64 +  /*    This section contains definitions used to manage glyph data        */
    1.65 +  /*    through generic FT_Glyph objects.  Each of them can contain a      */
    1.66 +  /*    bitmap, a vector outline, or even images in other formats.         */
    1.67 +  /*                                                                       */
    1.68 +  /*************************************************************************/
    1.69 +
    1.70 +
    1.71 +  /* forward declaration to a private type */
    1.72 +  typedef struct FT_Glyph_Class_  FT_Glyph_Class;
    1.73 +
    1.74 +
    1.75 +  /*************************************************************************/
    1.76 +  /*                                                                       */
    1.77 +  /* <Type>                                                                */
    1.78 +  /*    FT_Glyph                                                           */
    1.79 +  /*                                                                       */
    1.80 +  /* <Description>                                                         */
    1.81 +  /*    Handle to an object used to model generic glyph images.  It is a   */
    1.82 +  /*    pointer to the @FT_GlyphRec structure and can contain a glyph      */
    1.83 +  /*    bitmap or pointer.                                                 */
    1.84 +  /*                                                                       */
    1.85 +  /* <Note>                                                                */
    1.86 +  /*    Glyph objects are not owned by the library.  You must thus release */
    1.87 +  /*    them manually (through @FT_Done_Glyph) _before_ calling            */
    1.88 +  /*    @FT_Done_FreeType.                                                 */
    1.89 +  /*                                                                       */
    1.90 +  typedef struct FT_GlyphRec_*  FT_Glyph;
    1.91 +
    1.92 +
    1.93 +  /*************************************************************************/
    1.94 +  /*                                                                       */
    1.95 +  /* <Struct>                                                              */
    1.96 +  /*    FT_GlyphRec                                                        */
    1.97 +  /*                                                                       */
    1.98 +  /* <Description>                                                         */
    1.99 +  /*    The root glyph structure contains a given glyph image plus its     */
   1.100 +  /*    advance width in 16.16 fixed float format.                         */
   1.101 +  /*                                                                       */
   1.102 +  /* <Fields>                                                              */
   1.103 +  /*    library :: A handle to the FreeType library object.                */
   1.104 +  /*                                                                       */
   1.105 +  /*    clazz   :: A pointer to the glyph's class.  Private.               */
   1.106 +  /*                                                                       */
   1.107 +  /*    format  :: The format of the glyph's image.                        */
   1.108 +  /*                                                                       */
   1.109 +  /*    advance :: A 16.16 vector that gives the glyph's advance width.    */
   1.110 +  /*                                                                       */
   1.111 +  typedef struct  FT_GlyphRec_
   1.112 +  {
   1.113 +    FT_Library             library;
   1.114 +    const FT_Glyph_Class*  clazz;
   1.115 +    FT_Glyph_Format        format;
   1.116 +    FT_Vector              advance;
   1.117 +
   1.118 +  } FT_GlyphRec;
   1.119 +
   1.120 +
   1.121 +  /*************************************************************************/
   1.122 +  /*                                                                       */
   1.123 +  /* <Type>                                                                */
   1.124 +  /*    FT_BitmapGlyph                                                     */
   1.125 +  /*                                                                       */
   1.126 +  /* <Description>                                                         */
   1.127 +  /*    A handle to an object used to model a bitmap glyph image.  This is */
   1.128 +  /*    a sub-class of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec.     */
   1.129 +  /*                                                                       */
   1.130 +  typedef struct FT_BitmapGlyphRec_*  FT_BitmapGlyph;
   1.131 +
   1.132 +
   1.133 +  /*************************************************************************/
   1.134 +  /*                                                                       */
   1.135 +  /* <Struct>                                                              */
   1.136 +  /*    FT_BitmapGlyphRec                                                  */
   1.137 +  /*                                                                       */
   1.138 +  /* <Description>                                                         */
   1.139 +  /*    A structure used for bitmap glyph images.  This really is a        */
   1.140 +  /*    `sub-class' of @FT_GlyphRec.                                       */
   1.141 +  /*                                                                       */
   1.142 +  /* <Fields>                                                              */
   1.143 +  /*    root   :: The root @FT_Glyph fields.                               */
   1.144 +  /*                                                                       */
   1.145 +  /*    left   :: The left-side bearing, i.e., the horizontal distance     */
   1.146 +  /*              from the current pen position to the left border of the  */
   1.147 +  /*              glyph bitmap.                                            */
   1.148 +  /*                                                                       */
   1.149 +  /*    top    :: The top-side bearing, i.e., the vertical distance from   */
   1.150 +  /*              the current pen position to the top border of the glyph  */
   1.151 +  /*              bitmap.  This distance is positive for upwards~y!        */
   1.152 +  /*                                                                       */
   1.153 +  /*    bitmap :: A descriptor for the bitmap.                             */
   1.154 +  /*                                                                       */
   1.155 +  /* <Note>                                                                */
   1.156 +  /*    You can typecast an @FT_Glyph to @FT_BitmapGlyph if you have       */
   1.157 +  /*    `glyph->format == FT_GLYPH_FORMAT_BITMAP'.  This lets you access   */
   1.158 +  /*    the bitmap's contents easily.                                      */
   1.159 +  /*                                                                       */
   1.160 +  /*    The corresponding pixel buffer is always owned by @FT_BitmapGlyph  */
   1.161 +  /*    and is thus created and destroyed with it.                         */
   1.162 +  /*                                                                       */
   1.163 +  typedef struct  FT_BitmapGlyphRec_
   1.164 +  {
   1.165 +    FT_GlyphRec  root;
   1.166 +    FT_Int       left;
   1.167 +    FT_Int       top;
   1.168 +    FT_Bitmap    bitmap;
   1.169 +
   1.170 +  } FT_BitmapGlyphRec;
   1.171 +
   1.172 +
   1.173 +  /*************************************************************************/
   1.174 +  /*                                                                       */
   1.175 +  /* <Type>                                                                */
   1.176 +  /*    FT_OutlineGlyph                                                    */
   1.177 +  /*                                                                       */
   1.178 +  /* <Description>                                                         */
   1.179 +  /*    A handle to an object used to model an outline glyph image.  This  */
   1.180 +  /*    is a sub-class of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec. */
   1.181 +  /*                                                                       */
   1.182 +  typedef struct FT_OutlineGlyphRec_*  FT_OutlineGlyph;
   1.183 +
   1.184 +
   1.185 +  /*************************************************************************/
   1.186 +  /*                                                                       */
   1.187 +  /* <Struct>                                                              */
   1.188 +  /*    FT_OutlineGlyphRec                                                 */
   1.189 +  /*                                                                       */
   1.190 +  /* <Description>                                                         */
   1.191 +  /*    A structure used for outline (vectorial) glyph images.  This       */
   1.192 +  /*    really is a `sub-class' of @FT_GlyphRec.                           */
   1.193 +  /*                                                                       */
   1.194 +  /* <Fields>                                                              */
   1.195 +  /*    root    :: The root @FT_Glyph fields.                              */
   1.196 +  /*                                                                       */
   1.197 +  /*    outline :: A descriptor for the outline.                           */
   1.198 +  /*                                                                       */
   1.199 +  /* <Note>                                                                */
   1.200 +  /*    You can typecast an @FT_Glyph to @FT_OutlineGlyph if you have      */
   1.201 +  /*    `glyph->format == FT_GLYPH_FORMAT_OUTLINE'.  This lets you access  */
   1.202 +  /*    the outline's content easily.                                      */
   1.203 +  /*                                                                       */
   1.204 +  /*    As the outline is extracted from a glyph slot, its coordinates are */
   1.205 +  /*    expressed normally in 26.6 pixels, unless the flag                 */
   1.206 +  /*    @FT_LOAD_NO_SCALE was used in @FT_Load_Glyph() or @FT_Load_Char(). */
   1.207 +  /*                                                                       */
   1.208 +  /*    The outline's tables are always owned by the object and are        */
   1.209 +  /*    destroyed with it.                                                 */
   1.210 +  /*                                                                       */
   1.211 +  typedef struct  FT_OutlineGlyphRec_
   1.212 +  {
   1.213 +    FT_GlyphRec  root;
   1.214 +    FT_Outline   outline;
   1.215 +
   1.216 +  } FT_OutlineGlyphRec;
   1.217 +
   1.218 +
   1.219 +  /*************************************************************************/
   1.220 +  /*                                                                       */
   1.221 +  /* <Function>                                                            */
   1.222 +  /*    FT_Get_Glyph                                                       */
   1.223 +  /*                                                                       */
   1.224 +  /* <Description>                                                         */
   1.225 +  /*    A function used to extract a glyph image from a slot.  Note that   */
   1.226 +  /*    the created @FT_Glyph object must be released with @FT_Done_Glyph. */
   1.227 +  /*                                                                       */
   1.228 +  /* <Input>                                                               */
   1.229 +  /*    slot   :: A handle to the source glyph slot.                       */
   1.230 +  /*                                                                       */
   1.231 +  /* <Output>                                                              */
   1.232 +  /*    aglyph :: A handle to the glyph object.                            */
   1.233 +  /*                                                                       */
   1.234 +  /* <Return>                                                              */
   1.235 +  /*    FreeType error code.  0~means success.                             */
   1.236 +  /*                                                                       */
   1.237 +  FT_EXPORT( FT_Error )
   1.238 +  FT_Get_Glyph( FT_GlyphSlot  slot,
   1.239 +                FT_Glyph     *aglyph );
   1.240 +
   1.241 +
   1.242 +  /*************************************************************************/
   1.243 +  /*                                                                       */
   1.244 +  /* <Function>                                                            */
   1.245 +  /*    FT_Glyph_Copy                                                      */
   1.246 +  /*                                                                       */
   1.247 +  /* <Description>                                                         */
   1.248 +  /*    A function used to copy a glyph image.  Note that the created      */
   1.249 +  /*    @FT_Glyph object must be released with @FT_Done_Glyph.             */
   1.250 +  /*                                                                       */
   1.251 +  /* <Input>                                                               */
   1.252 +  /*    source :: A handle to the source glyph object.                     */
   1.253 +  /*                                                                       */
   1.254 +  /* <Output>                                                              */
   1.255 +  /*    target :: A handle to the target glyph object.  0~in case of       */
   1.256 +  /*              error.                                                   */
   1.257 +  /*                                                                       */
   1.258 +  /* <Return>                                                              */
   1.259 +  /*    FreeType error code.  0~means success.                             */
   1.260 +  /*                                                                       */
   1.261 +  FT_EXPORT( FT_Error )
   1.262 +  FT_Glyph_Copy( FT_Glyph   source,
   1.263 +                 FT_Glyph  *target );
   1.264 +
   1.265 +
   1.266 +  /*************************************************************************/
   1.267 +  /*                                                                       */
   1.268 +  /* <Function>                                                            */
   1.269 +  /*    FT_Glyph_Transform                                                 */
   1.270 +  /*                                                                       */
   1.271 +  /* <Description>                                                         */
   1.272 +  /*    Transform a glyph image if its format is scalable.                 */
   1.273 +  /*                                                                       */
   1.274 +  /* <InOut>                                                               */
   1.275 +  /*    glyph  :: A handle to the target glyph object.                     */
   1.276 +  /*                                                                       */
   1.277 +  /* <Input>                                                               */
   1.278 +  /*    matrix :: A pointer to a 2x2 matrix to apply.                      */
   1.279 +  /*                                                                       */
   1.280 +  /*    delta  :: A pointer to a 2d vector to apply.  Coordinates are      */
   1.281 +  /*              expressed in 1/64th of a pixel.                          */
   1.282 +  /*                                                                       */
   1.283 +  /* <Return>                                                              */
   1.284 +  /*    FreeType error code (if not 0, the glyph format is not scalable).  */
   1.285 +  /*                                                                       */
   1.286 +  /* <Note>                                                                */
   1.287 +  /*    The 2x2 transformation matrix is also applied to the glyph's       */
   1.288 +  /*    advance vector.                                                    */
   1.289 +  /*                                                                       */
   1.290 +  FT_EXPORT( FT_Error )
   1.291 +  FT_Glyph_Transform( FT_Glyph    glyph,
   1.292 +                      FT_Matrix*  matrix,
   1.293 +                      FT_Vector*  delta );
   1.294 +
   1.295 +
   1.296 +  /*************************************************************************/
   1.297 +  /*                                                                       */
   1.298 +  /* <Enum>                                                                */
   1.299 +  /*    FT_Glyph_BBox_Mode                                                 */
   1.300 +  /*                                                                       */
   1.301 +  /* <Description>                                                         */
   1.302 +  /*    The mode how the values of @FT_Glyph_Get_CBox are returned.        */
   1.303 +  /*                                                                       */
   1.304 +  /* <Values>                                                              */
   1.305 +  /*    FT_GLYPH_BBOX_UNSCALED ::                                          */
   1.306 +  /*      Return unscaled font units.                                      */
   1.307 +  /*                                                                       */
   1.308 +  /*    FT_GLYPH_BBOX_SUBPIXELS ::                                         */
   1.309 +  /*      Return unfitted 26.6 coordinates.                                */
   1.310 +  /*                                                                       */
   1.311 +  /*    FT_GLYPH_BBOX_GRIDFIT ::                                           */
   1.312 +  /*      Return grid-fitted 26.6 coordinates.                             */
   1.313 +  /*                                                                       */
   1.314 +  /*    FT_GLYPH_BBOX_TRUNCATE ::                                          */
   1.315 +  /*      Return coordinates in integer pixels.                            */
   1.316 +  /*                                                                       */
   1.317 +  /*    FT_GLYPH_BBOX_PIXELS ::                                            */
   1.318 +  /*      Return grid-fitted pixel coordinates.                            */
   1.319 +  /*                                                                       */
   1.320 +  typedef enum  FT_Glyph_BBox_Mode_
   1.321 +  {
   1.322 +    FT_GLYPH_BBOX_UNSCALED  = 0,
   1.323 +    FT_GLYPH_BBOX_SUBPIXELS = 0,
   1.324 +    FT_GLYPH_BBOX_GRIDFIT   = 1,
   1.325 +    FT_GLYPH_BBOX_TRUNCATE  = 2,
   1.326 +    FT_GLYPH_BBOX_PIXELS    = 3
   1.327 +
   1.328 +  } FT_Glyph_BBox_Mode;
   1.329 +
   1.330 +
   1.331 +  /*************************************************************************/
   1.332 +  /*                                                                       */
   1.333 +  /* <Enum>                                                                */
   1.334 +  /*    ft_glyph_bbox_xxx                                                  */
   1.335 +  /*                                                                       */
   1.336 +  /* <Description>                                                         */
   1.337 +  /*    These constants are deprecated.  Use the corresponding             */
   1.338 +  /*    @FT_Glyph_BBox_Mode values instead.                                */
   1.339 +  /*                                                                       */
   1.340 +  /* <Values>                                                              */
   1.341 +  /*   ft_glyph_bbox_unscaled  :: See @FT_GLYPH_BBOX_UNSCALED.             */
   1.342 +  /*   ft_glyph_bbox_subpixels :: See @FT_GLYPH_BBOX_SUBPIXELS.            */
   1.343 +  /*   ft_glyph_bbox_gridfit   :: See @FT_GLYPH_BBOX_GRIDFIT.              */
   1.344 +  /*   ft_glyph_bbox_truncate  :: See @FT_GLYPH_BBOX_TRUNCATE.             */
   1.345 +  /*   ft_glyph_bbox_pixels    :: See @FT_GLYPH_BBOX_PIXELS.               */
   1.346 +  /*                                                                       */
   1.347 +#define ft_glyph_bbox_unscaled   FT_GLYPH_BBOX_UNSCALED
   1.348 +#define ft_glyph_bbox_subpixels  FT_GLYPH_BBOX_SUBPIXELS
   1.349 +#define ft_glyph_bbox_gridfit    FT_GLYPH_BBOX_GRIDFIT
   1.350 +#define ft_glyph_bbox_truncate   FT_GLYPH_BBOX_TRUNCATE
   1.351 +#define ft_glyph_bbox_pixels     FT_GLYPH_BBOX_PIXELS
   1.352 +
   1.353 +
   1.354 +  /*************************************************************************/
   1.355 +  /*                                                                       */
   1.356 +  /* <Function>                                                            */
   1.357 +  /*    FT_Glyph_Get_CBox                                                  */
   1.358 +  /*                                                                       */
   1.359 +  /* <Description>                                                         */
   1.360 +  /*    Return a glyph's `control box'.  The control box encloses all the  */
   1.361 +  /*    outline's points, including Bézier control points.  Though it      */
   1.362 +  /*    coincides with the exact bounding box for most glyphs, it can be   */
   1.363 +  /*    slightly larger in some situations (like when rotating an outline  */
   1.364 +  /*    which contains Bézier outside arcs).                               */
   1.365 +  /*                                                                       */
   1.366 +  /*    Computing the control box is very fast, while getting the bounding */
   1.367 +  /*    box can take much more time as it needs to walk over all segments  */
   1.368 +  /*    and arcs in the outline.  To get the latter, you can use the       */
   1.369 +  /*    `ftbbox' component which is dedicated to this single task.         */
   1.370 +  /*                                                                       */
   1.371 +  /* <Input>                                                               */
   1.372 +  /*    glyph :: A handle to the source glyph object.                      */
   1.373 +  /*                                                                       */
   1.374 +  /*    mode  :: The mode which indicates how to interpret the returned    */
   1.375 +  /*             bounding box values.                                      */
   1.376 +  /*                                                                       */
   1.377 +  /* <Output>                                                              */
   1.378 +  /*    acbox :: The glyph coordinate bounding box.  Coordinates are       */
   1.379 +  /*             expressed in 1/64th of pixels if it is grid-fitted.       */
   1.380 +  /*                                                                       */
   1.381 +  /* <Note>                                                                */
   1.382 +  /*    Coordinates are relative to the glyph origin, using the y~upwards  */
   1.383 +  /*    convention.                                                        */
   1.384 +  /*                                                                       */
   1.385 +  /*    If the glyph has been loaded with @FT_LOAD_NO_SCALE, `bbox_mode'   */
   1.386 +  /*    must be set to @FT_GLYPH_BBOX_UNSCALED to get unscaled font        */
   1.387 +  /*    units in 26.6 pixel format.  The value @FT_GLYPH_BBOX_SUBPIXELS    */
   1.388 +  /*    is another name for this constant.                                 */
   1.389 +  /*                                                                       */
   1.390 +  /*    Note that the maximum coordinates are exclusive, which means that  */
   1.391 +  /*    one can compute the width and height of the glyph image (be it in  */
   1.392 +  /*    integer or 26.6 pixels) as:                                        */
   1.393 +  /*                                                                       */
   1.394 +  /*    {                                                                  */
   1.395 +  /*      width  = bbox.xMax - bbox.xMin;                                  */
   1.396 +  /*      height = bbox.yMax - bbox.yMin;                                  */
   1.397 +  /*    }                                                                  */
   1.398 +  /*                                                                       */
   1.399 +  /*    Note also that for 26.6 coordinates, if `bbox_mode' is set to      */
   1.400 +  /*    @FT_GLYPH_BBOX_GRIDFIT, the coordinates will also be grid-fitted,  */
   1.401 +  /*    which corresponds to:                                              */
   1.402 +  /*                                                                       */
   1.403 +  /*    {                                                                  */
   1.404 +  /*      bbox.xMin = FLOOR(bbox.xMin);                                    */
   1.405 +  /*      bbox.yMin = FLOOR(bbox.yMin);                                    */
   1.406 +  /*      bbox.xMax = CEILING(bbox.xMax);                                  */
   1.407 +  /*      bbox.yMax = CEILING(bbox.yMax);                                  */
   1.408 +  /*    }                                                                  */
   1.409 +  /*                                                                       */
   1.410 +  /*    To get the bbox in pixel coordinates, set `bbox_mode' to           */
   1.411 +  /*    @FT_GLYPH_BBOX_TRUNCATE.                                           */
   1.412 +  /*                                                                       */
   1.413 +  /*    To get the bbox in grid-fitted pixel coordinates, set `bbox_mode'  */
   1.414 +  /*    to @FT_GLYPH_BBOX_PIXELS.                                          */
   1.415 +  /*                                                                       */
   1.416 +  FT_EXPORT( void )
   1.417 +  FT_Glyph_Get_CBox( FT_Glyph  glyph,
   1.418 +                     FT_UInt   bbox_mode,
   1.419 +                     FT_BBox  *acbox );
   1.420 +
   1.421 +
   1.422 +  /*************************************************************************/
   1.423 +  /*                                                                       */
   1.424 +  /* <Function>                                                            */
   1.425 +  /*    FT_Glyph_To_Bitmap                                                 */
   1.426 +  /*                                                                       */
   1.427 +  /* <Description>                                                         */
   1.428 +  /*    Convert a given glyph object to a bitmap glyph object.             */
   1.429 +  /*                                                                       */
   1.430 +  /* <InOut>                                                               */
   1.431 +  /*    the_glyph   :: A pointer to a handle to the target glyph.          */
   1.432 +  /*                                                                       */
   1.433 +  /* <Input>                                                               */
   1.434 +  /*    render_mode :: An enumeration that describes how the data is       */
   1.435 +  /*                   rendered.                                           */
   1.436 +  /*                                                                       */
   1.437 +  /*    origin      :: A pointer to a vector used to translate the glyph   */
   1.438 +  /*                   image before rendering.  Can be~0 (if no            */
   1.439 +  /*                   translation).  The origin is expressed in           */
   1.440 +  /*                   26.6 pixels.                                        */
   1.441 +  /*                                                                       */
   1.442 +  /*    destroy     :: A boolean that indicates that the original glyph    */
   1.443 +  /*                   image should be destroyed by this function.  It is  */
   1.444 +  /*                   never destroyed in case of error.                   */
   1.445 +  /*                                                                       */
   1.446 +  /* <Return>                                                              */
   1.447 +  /*    FreeType error code.  0~means success.                             */
   1.448 +  /*                                                                       */
   1.449 +  /* <Note>                                                                */
   1.450 +  /*    This function does nothing if the glyph format isn't scalable.     */
   1.451 +  /*                                                                       */
   1.452 +  /*    The glyph image is translated with the `origin' vector before      */
   1.453 +  /*    rendering.                                                         */
   1.454 +  /*                                                                       */
   1.455 +  /*    The first parameter is a pointer to an @FT_Glyph handle, that will */
   1.456 +  /*    be _replaced_ by this function (with newly allocated data).        */
   1.457 +  /*    Typically, you would use (omitting error handling):                */
   1.458 +  /*                                                                       */
   1.459 +  /*                                                                       */
   1.460 +  /*      {                                                                */
   1.461 +  /*        FT_Glyph        glyph;                                         */
   1.462 +  /*        FT_BitmapGlyph  glyph_bitmap;                                  */
   1.463 +  /*                                                                       */
   1.464 +  /*                                                                       */
   1.465 +  /*        // load glyph                                                  */
   1.466 +  /*        error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAUT );     */
   1.467 +  /*                                                                       */
   1.468 +  /*        // extract glyph image                                         */
   1.469 +  /*        error = FT_Get_Glyph( face->glyph, &glyph );                   */
   1.470 +  /*                                                                       */
   1.471 +  /*        // convert to a bitmap (default render mode + destroying old)  */
   1.472 +  /*        if ( glyph->format != FT_GLYPH_FORMAT_BITMAP )                 */
   1.473 +  /*        {                                                              */
   1.474 +  /*          error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL,   */
   1.475 +  /*                                      0, 1 );                          */
   1.476 +  /*          if ( error ) // `glyph' unchanged                            */
   1.477 +  /*            ...                                                        */
   1.478 +  /*        }                                                              */
   1.479 +  /*                                                                       */
   1.480 +  /*        // access bitmap content by typecasting                        */
   1.481 +  /*        glyph_bitmap = (FT_BitmapGlyph)glyph;                          */
   1.482 +  /*                                                                       */
   1.483 +  /*        // do funny stuff with it, like blitting/drawing               */
   1.484 +  /*        ...                                                            */
   1.485 +  /*                                                                       */
   1.486 +  /*        // discard glyph image (bitmap or not)                         */
   1.487 +  /*        FT_Done_Glyph( glyph );                                        */
   1.488 +  /*      }                                                                */
   1.489 +  /*                                                                       */
   1.490 +  /*                                                                       */
   1.491 +  /*    Here another example, again without error handling:                */
   1.492 +  /*                                                                       */
   1.493 +  /*                                                                       */
   1.494 +  /*      {                                                                */
   1.495 +  /*        FT_Glyph  glyphs[MAX_GLYPHS]                                   */
   1.496 +  /*                                                                       */
   1.497 +  /*                                                                       */
   1.498 +  /*        ...                                                            */
   1.499 +  /*                                                                       */
   1.500 +  /*        for ( idx = 0; i < MAX_GLYPHS; i++ )                           */
   1.501 +  /*          error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) ||       */
   1.502 +  /*                  FT_Get_Glyph ( face->glyph, &glyph[idx] );           */
   1.503 +  /*                                                                       */
   1.504 +  /*        ...                                                            */
   1.505 +  /*                                                                       */
   1.506 +  /*        for ( idx = 0; i < MAX_GLYPHS; i++ )                           */
   1.507 +  /*        {                                                              */
   1.508 +  /*          FT_Glyph  bitmap = glyphs[idx];                              */
   1.509 +  /*                                                                       */
   1.510 +  /*                                                                       */
   1.511 +  /*          ...                                                          */
   1.512 +  /*                                                                       */
   1.513 +  /*          // after this call, `bitmap' no longer points into           */
   1.514 +  /*          // the `glyphs' array (and the old value isn't destroyed)    */
   1.515 +  /*          FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 );    */
   1.516 +  /*                                                                       */
   1.517 +  /*          ...                                                          */
   1.518 +  /*                                                                       */
   1.519 +  /*          FT_Done_Glyph( bitmap );                                     */
   1.520 +  /*        }                                                              */
   1.521 +  /*                                                                       */
   1.522 +  /*        ...                                                            */
   1.523 +  /*                                                                       */
   1.524 +  /*        for ( idx = 0; i < MAX_GLYPHS; i++ )                           */
   1.525 +  /*          FT_Done_Glyph( glyphs[idx] );                                */
   1.526 +  /*      }                                                                */
   1.527 +  /*                                                                       */
   1.528 +  FT_EXPORT( FT_Error )
   1.529 +  FT_Glyph_To_Bitmap( FT_Glyph*       the_glyph,
   1.530 +                      FT_Render_Mode  render_mode,
   1.531 +                      FT_Vector*      origin,
   1.532 +                      FT_Bool         destroy );
   1.533 +
   1.534 +
   1.535 +  /*************************************************************************/
   1.536 +  /*                                                                       */
   1.537 +  /* <Function>                                                            */
   1.538 +  /*    FT_Done_Glyph                                                      */
   1.539 +  /*                                                                       */
   1.540 +  /* <Description>                                                         */
   1.541 +  /*    Destroy a given glyph.                                             */
   1.542 +  /*                                                                       */
   1.543 +  /* <Input>                                                               */
   1.544 +  /*    glyph :: A handle to the target glyph object.                      */
   1.545 +  /*                                                                       */
   1.546 +  FT_EXPORT( void )
   1.547 +  FT_Done_Glyph( FT_Glyph  glyph );
   1.548 +
   1.549 +  /* */
   1.550 +
   1.551 +
   1.552 +  /* other helpful functions */
   1.553 +
   1.554 +  /*************************************************************************/
   1.555 +  /*                                                                       */
   1.556 +  /* <Section>                                                             */
   1.557 +  /*    computations                                                       */
   1.558 +  /*                                                                       */
   1.559 +  /*************************************************************************/
   1.560 +
   1.561 +
   1.562 +  /*************************************************************************/
   1.563 +  /*                                                                       */
   1.564 +  /* <Function>                                                            */
   1.565 +  /*    FT_Matrix_Multiply                                                 */
   1.566 +  /*                                                                       */
   1.567 +  /* <Description>                                                         */
   1.568 +  /*    Perform the matrix operation `b = a*b'.                            */
   1.569 +  /*                                                                       */
   1.570 +  /* <Input>                                                               */
   1.571 +  /*    a :: A pointer to matrix `a'.                                      */
   1.572 +  /*                                                                       */
   1.573 +  /* <InOut>                                                               */
   1.574 +  /*    b :: A pointer to matrix `b'.                                      */
   1.575 +  /*                                                                       */
   1.576 +  /* <Note>                                                                */
   1.577 +  /*    The result is undefined if either `a' or `b' is zero.              */
   1.578 +  /*                                                                       */
   1.579 +  FT_EXPORT( void )
   1.580 +  FT_Matrix_Multiply( const FT_Matrix*  a,
   1.581 +                      FT_Matrix*        b );
   1.582 +
   1.583 +
   1.584 +  /*************************************************************************/
   1.585 +  /*                                                                       */
   1.586 +  /* <Function>                                                            */
   1.587 +  /*    FT_Matrix_Invert                                                   */
   1.588 +  /*                                                                       */
   1.589 +  /* <Description>                                                         */
   1.590 +  /*    Invert a 2x2 matrix.  Return an error if it can't be inverted.     */
   1.591 +  /*                                                                       */
   1.592 +  /* <InOut>                                                               */
   1.593 +  /*    matrix :: A pointer to the target matrix.  Remains untouched in    */
   1.594 +  /*              case of error.                                           */
   1.595 +  /*                                                                       */
   1.596 +  /* <Return>                                                              */
   1.597 +  /*    FreeType error code.  0~means success.                             */
   1.598 +  /*                                                                       */
   1.599 +  FT_EXPORT( FT_Error )
   1.600 +  FT_Matrix_Invert( FT_Matrix*  matrix );
   1.601 +
   1.602 +
   1.603 +  /* */
   1.604 +
   1.605 +
   1.606 +FT_END_HEADER
   1.607 +
   1.608 +#endif /* __FTGLYPH_H__ */
   1.609 +
   1.610 +
   1.611 +/* END */
   1.612 +
   1.613 +
   1.614 +/* Local Variables: */
   1.615 +/* coding: utf-8    */
   1.616 +/* End:             */