ftadvanc.h

Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  ftadvanc.h                                                             */
00004 /*                                                                         */
00005 /*    Quick computation of advance widths (specification only).            */
00006 /*                                                                         */
00007 /*  Copyright 2008 by                                                      */
00008 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
00009 /*                                                                         */
00010 /*  This file is part of the FreeType project, and may only be used,       */
00011 /*  modified, and distributed under the terms of the FreeType project      */
00012 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
00013 /*  this file you indicate that you have read the license and              */
00014 /*  understand and accept it fully.                                        */
00015 /*                                                                         */
00016 /***************************************************************************/
00017 
00018 
00019 #ifndef __FTADVANC_H__
00020 #define __FTADVANC_H__
00021 
00022 
00023 #include <ft2build.h>
00024 #include FT_FREETYPE_H
00025 
00026 #ifdef FREETYPE_H
00027 #error "freetype.h of FreeType 1 has been loaded!"
00028 #error "Please fix the directory search order for header files"
00029 #error "so that freetype.h of FreeType 2 is found first."
00030 #endif
00031 
00032 
00033 FT_BEGIN_HEADER
00034 
00035 
00036   /**************************************************************************
00037    *
00038    * @section:
00039    *   quick_advance
00040    *
00041    * @title:
00042    *   Quick retrieval of advance values
00043    *
00044    * @abstract:
00045    *   Retrieve horizontal and vertical advance values without processing
00046    *   glyph outlines, if possible.
00047    *
00048    * @description:
00049    *   This section contains functions to quickly extract advance values
00050    *   without handling glyph outlines, if possible.
00051    */
00052 
00053 
00054   /*************************************************************************/
00055   /*                                                                       */
00056   /* <Const>                                                               */
00057   /*    FT_ADVANCE_FLAG_FAST_ONLY                                          */
00058   /*                                                                       */
00059   /* <Description>                                                         */
00060   /*    A bit-flag to be OR-ed with the `flags' parameter of the           */
00061   /*    @FT_Get_Advance and @FT_Get_Advances functions.                    */
00062   /*                                                                       */
00063   /*    If set, it indicates that you want these functions to fail if the  */
00064   /*    corresponding hinting mode or font driver doesn't allow for very   */
00065   /*    quick advance computation.                                         */
00066   /*                                                                       */
00067   /*    Typically, glyphs which are either unscaled, unhinted, bitmapped,  */
00068   /*    or light-hinted can have their advance width computed very         */
00069   /*    quickly.                                                           */
00070   /*                                                                       */
00071   /*    Normal and bytecode hinted modes, which require loading, scaling,  */
00072   /*    and hinting of the glyph outline, are extremely slow by            */
00073   /*    comparison.                                                        */
00074   /*                                                                       */
00075 #define FT_ADVANCE_FLAG_FAST_ONLY  0x20000000UL
00076 
00077 
00078   /*************************************************************************/
00079   /*                                                                       */
00080   /* <Function>                                                            */
00081   /*    FT_Get_Advance                                                     */
00082   /*                                                                       */
00083   /* <Description>                                                         */
00084   /*    Retrieve the advance value of a given glyph outline in an          */
00085   /*    @FT_Face.  By default, the unhinted advance is returned in font    */
00086   /*    units.                                                             */
00087   /*                                                                       */
00088   /* <Input>                                                               */
00089   /*    face       :: The source @FT_Face handle.                          */
00090   /*                                                                       */
00091   /*    gindex     :: The glyph index.                                     */
00092   /*                                                                       */
00093   /*    load_flags :: A set of bit flags similar to those used when        */
00094   /*                  calling @FT_Load_Glyph, used to determine what kind  */
00095   /*                  of advances you need.                                */
00096   /* <Output>                                                              */
00097   /*    padvance :: The advance value, in either font units or 16.16       */
00098   /*                format.                                                */
00099   /*                                                                       */
00100   /*                If @FT_LOAD_VERTICAL_LAYOUT is set, this is the        */
00101   /*                vertical advance corresponding to a vertical layout.   */
00102   /*                Otherwise, it is the horizontal advance in a           */
00103   /*                horizontal layout.                                     */
00104   /*                                                                       */
00105   /* <Return>                                                              */
00106   /*    FreeType error code.  0 means success.                             */
00107   /*                                                                       */
00108   /* <Note>                                                                */
00109   /*    This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and   */
00110   /*    if the corresponding font backend doesn't have a quick way to      */
00111   /*    retrieve the advances.                                             */
00112   /*                                                                       */
00113   /*    A scaled advance is returned in 16.16 format but isn't transformed */
00114   /*    by the affine transformation specified by @FT_Set_Transform.       */
00115   /*                                                                       */
00116   FT_EXPORT( FT_Error )
00117   FT_Get_Advance( FT_Face    face,
00118                   FT_UInt    gindex,
00119                   FT_Int32   load_flags,
00120                   FT_Fixed  *padvance );
00121 
00122 
00123   /*************************************************************************/
00124   /*                                                                       */
00125   /* <Function>                                                            */
00126   /*    FT_Get_Advances                                                    */
00127   /*                                                                       */
00128   /* <Description>                                                         */
00129   /*    Retrieve the advance values of several glyph outlines in an        */
00130   /*    @FT_Face.  By default, the unhinted advances are returned in font  */
00131   /*    units.                                                             */
00132   /*                                                                       */
00133   /* <Input>                                                               */
00134   /*    face        :: The source @FT_Face handle.                         */
00135   /*                                                                       */
00136   /*    start       :: The first glyph index.                              */
00137   /*                                                                       */
00138   /*    count       :: The number of advance values you want to retrieve.  */
00139   /*                                                                       */
00140   /*    load_flags  :: A set of bit flags similar to those used when       */
00141   /*                   calling @FT_Load_Glyph.                             */
00142   /*                                                                       */
00143   /* <Output>                                                              */
00144   /*    padvance :: The advances, in either font units or 16.16 format.    */
00145   /*                This array must contain at least `count' elements.     */
00146   /*                                                                       */
00147   /*                If @FT_LOAD_VERTICAL_LAYOUT is set, these are the      */
00148   /*                vertical advances corresponding to a vertical layout.  */
00149   /*                Otherwise, they are the horizontal advances in a       */
00150   /*                horizontal layout.                                     */
00151   /*                                                                       */
00152   /* <Return>                                                              */
00153   /*    FreeType error code.  0 means success.                             */
00154   /*                                                                       */
00155   /* <Note>                                                                */
00156   /*    This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and   */
00157   /*    if the corresponding font backend doesn't have a quick way to      */
00158   /*    retrieve the advances.                                             */
00159   /*                                                                       */
00160   /*    Scaled advances are returned in 16.16 format but aren't            */
00161   /*    transformed by the affine transformation specified by              */
00162   /*    @FT_Set_Transform.                                                 */
00163   /*                                                                       */
00164   FT_EXPORT( FT_Error )
00165   FT_Get_Advances( FT_Face    face,
00166                    FT_UInt    start,
00167                    FT_UInt    count,
00168                    FT_Int32   load_flags,
00169                    FT_Fixed  *padvances );
00170 
00171 /* */
00172 
00173 
00174 FT_END_HEADER
00175 
00176 #endif /* __FTADVANC_H__ */
00177 
00178 
00179 /* END */

Generated on Tue Jul 5 14:13:35 2011 for ROOT_528-00b_version by  doxygen 1.5.1