ftdriver.h
上传用户:yisoukefu
上传日期:2020-08-09
资源大小:39506k
文件大小:11k
源码类别:

其他游戏

开发平台:

Visual C++

  1. /***************************************************************************/
  2. /*                                                                         */
  3. /*  ftdriver.h                                                             */
  4. /*                                                                         */
  5. /*    FreeType font driver interface (specification).                      */
  6. /*                                                                         */
  7. /*  Copyright 1996-2001, 2002, 2003, 2006 by                               */
  8. /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
  9. /*                                                                         */
  10. /*  This file is part of the FreeType project, and may only be used,       */
  11. /*  modified, and distributed under the terms of the FreeType project      */
  12. /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
  13. /*  this file you indicate that you have read the license and              */
  14. /*  understand and accept it fully.                                        */
  15. /*                                                                         */
  16. /***************************************************************************/
  17. #ifndef __FTDRIVER_H__
  18. #define __FTDRIVER_H__
  19. #include <ft2build.h>
  20. #include FT_MODULE_H
  21. FT_BEGIN_HEADER
  22.   typedef FT_Error
  23.   (*FT_Face_InitFunc)( FT_Stream      stream,
  24.                        FT_Face        face,
  25.                        FT_Int         typeface_index,
  26.                        FT_Int         num_params,
  27.                        FT_Parameter*  parameters );
  28.   typedef void
  29.   (*FT_Face_DoneFunc)( FT_Face  face );
  30.   typedef FT_Error
  31.   (*FT_Size_InitFunc)( FT_Size  size );
  32.   typedef void
  33.   (*FT_Size_DoneFunc)( FT_Size  size );
  34.   typedef FT_Error
  35.   (*FT_Slot_InitFunc)( FT_GlyphSlot  slot );
  36.   typedef void
  37.   (*FT_Slot_DoneFunc)( FT_GlyphSlot  slot );
  38.   typedef FT_Error
  39.   (*FT_Size_RequestFunc)( FT_Size          size,
  40.                           FT_Size_Request  req );
  41.   typedef FT_Error
  42.   (*FT_Size_SelectFunc)( FT_Size   size,
  43.                          FT_ULong  size_index );
  44. #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
  45.   typedef FT_Error
  46.   (*FT_Size_ResetPointsFunc)( FT_Size     size,
  47.                               FT_F26Dot6  char_width,
  48.                               FT_F26Dot6  char_height,
  49.                               FT_UInt     horz_resolution,
  50.                               FT_UInt     vert_resolution );
  51.   typedef FT_Error
  52.   (*FT_Size_ResetPixelsFunc)( FT_Size  size,
  53.                               FT_UInt  pixel_width,
  54.                               FT_UInt  pixel_height );
  55. #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
  56.   typedef FT_Error
  57.   (*FT_Slot_LoadFunc)( FT_GlyphSlot  slot,
  58.                        FT_Size       size,
  59.                        FT_UInt       glyph_index,
  60.                        FT_Int32      load_flags );
  61.   typedef FT_UInt
  62.   (*FT_CharMap_CharIndexFunc)( FT_CharMap  charmap,
  63.                                FT_Long     charcode );
  64.   typedef FT_Long
  65.   (*FT_CharMap_CharNextFunc)( FT_CharMap  charmap,
  66.                               FT_Long     charcode );
  67.   typedef FT_Error
  68.   (*FT_Face_GetKerningFunc)( FT_Face     face,
  69.                              FT_UInt     left_glyph,
  70.                              FT_UInt     right_glyph,
  71.                              FT_Vector*  kerning );
  72.   typedef FT_Error
  73.   (*FT_Face_AttachFunc)( FT_Face    face,
  74.                          FT_Stream  stream );
  75.   typedef FT_Error
  76.   (*FT_Face_GetAdvancesFunc)( FT_Face     face,
  77.                               FT_UInt     first,
  78.                               FT_UInt     count,
  79.                               FT_Bool     vertical,
  80.                               FT_UShort*  advances );
  81.   /*************************************************************************/
  82.   /*                                                                       */
  83.   /* <Struct>                                                              */
  84.   /*    FT_Driver_ClassRec                                                 */
  85.   /*                                                                       */
  86.   /* <Description>                                                         */
  87.   /*    The font driver class.  This structure mostly contains pointers to */
  88.   /*    driver methods.                                                    */
  89.   /*                                                                       */
  90.   /* <Fields>                                                              */
  91.   /*    root             :: The parent module.                             */
  92.   /*                                                                       */
  93.   /*    face_object_size :: The size of a face object in bytes.            */
  94.   /*                                                                       */
  95.   /*    size_object_size :: The size of a size object in bytes.            */
  96.   /*                                                                       */
  97.   /*    slot_object_size :: The size of a glyph object in bytes.           */
  98.   /*                                                                       */
  99.   /*    init_face        :: The format-specific face constructor.          */
  100.   /*                                                                       */
  101.   /*    done_face        :: The format-specific face destructor.           */
  102.   /*                                                                       */
  103.   /*    init_size        :: The format-specific size constructor.          */
  104.   /*                                                                       */
  105.   /*    done_size        :: The format-specific size destructor.           */
  106.   /*                                                                       */
  107.   /*    init_slot        :: The format-specific slot constructor.          */
  108.   /*                                                                       */
  109.   /*    done_slot        :: The format-specific slot destructor.           */
  110.   /*                                                                       */
  111.   /*                                                                       */
  112.   /*    load_glyph       :: A function handle to load a glyph to a slot.   */
  113.   /*                        This field is mandatory!                       */
  114.   /*                                                                       */
  115.   /*    get_char_index   :: A function handle to return the glyph index of */
  116.   /*                        a given character for a given charmap.  This   */
  117.   /*                        field is mandatory!                            */
  118.   /*                                                                       */
  119.   /*    get_kerning      :: A function handle to return the unscaled       */
  120.   /*                        kerning for a given pair of glyphs.  Can be    */
  121.   /*                        set to 0 if the format doesn't support         */
  122.   /*                        kerning.                                       */
  123.   /*                                                                       */
  124.   /*    attach_file      :: This function handle is used to read           */
  125.   /*                        additional data for a face from another        */
  126.   /*                        file/stream.  For example, this can be used to */
  127.   /*                        add data from AFM or PFM files on a Type 1     */
  128.   /*                        face, or a CIDMap on a CID-keyed face.         */
  129.   /*                                                                       */
  130.   /*    get_advances     :: A function handle used to return advance       */
  131.   /*                        widths of `count' glyphs (in font units),      */
  132.   /*                        starting at `first'.  The `vertical' flag must */
  133.   /*                        be set to get vertical advance heights.  The   */
  134.   /*                        `advances' buffer is caller-allocated.         */
  135.   /*                        Currently not implemented.  The idea of this   */
  136.   /*                        function is to be able to perform              */
  137.   /*                        device-independent text layout without loading */
  138.   /*                        a single glyph image.                          */
  139.   /*                                                                       */
  140.   /*    request_size     :: A handle to a function used to request the new */
  141.   /*                        character size.  Can be set to 0 if the        */
  142.   /*                        scaling done in the base layer suffices.       */
  143.   /*                                                                       */
  144.   /*    select_size      :: A handle to a function used to select a new    */
  145.   /*                        fixed size.  It is used only if                */
  146.   /*                        @FT_FACE_FLAG_FIXED_SIZES is set.  Can be set  */
  147.   /*                        to 0 if the scaling done in the base layer     */
  148.   /*                        suffices.                                      */
  149.   /* <Note>                                                                */
  150.   /*    Most function pointers, with the exception of `load_glyph' and     */
  151.   /*    `get_char_index' can be set to 0 to indicate a default behaviour.  */
  152.   /*                                                                       */
  153.   typedef struct  FT_Driver_ClassRec_
  154.   {
  155.     FT_Module_Class           root;
  156.     FT_Long                   face_object_size;
  157.     FT_Long                   size_object_size;
  158.     FT_Long                   slot_object_size;
  159.     FT_Face_InitFunc          init_face;
  160.     FT_Face_DoneFunc          done_face;
  161.     FT_Size_InitFunc          init_size;
  162.     FT_Size_DoneFunc          done_size;
  163.     FT_Slot_InitFunc          init_slot;
  164.     FT_Slot_DoneFunc          done_slot;
  165. #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
  166.     FT_Size_ResetPointsFunc   set_char_sizes;
  167.     FT_Size_ResetPixelsFunc   set_pixel_sizes;
  168. #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
  169.     FT_Slot_LoadFunc          load_glyph;
  170.     FT_Face_GetKerningFunc    get_kerning;
  171.     FT_Face_AttachFunc        attach_file;
  172.     FT_Face_GetAdvancesFunc   get_advances;
  173.     /* since version 2.2 */
  174.     FT_Size_RequestFunc       request_size;
  175.     FT_Size_SelectFunc        select_size;
  176.   } FT_Driver_ClassRec, *FT_Driver_Class;
  177.   /*
  178.    *  The following functions are used as stubs for `set_char_sizes' and
  179.    *  `set_pixel_sizes'; the code uses `request_size' and `select_size'
  180.    *  functions instead.
  181.    *
  182.    *  Implementation is in `src/base/ftobjs.c'.
  183.    */
  184. #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
  185.   FT_BASE( FT_Error )
  186.   ft_stub_set_char_sizes( FT_Size     size,
  187.                           FT_F26Dot6  width,
  188.                           FT_F26Dot6  height,
  189.                           FT_UInt     horz_res,
  190.                           FT_UInt     vert_res );
  191.   FT_BASE( FT_Error )
  192.   ft_stub_set_pixel_sizes( FT_Size  size,
  193.                            FT_UInt  width,
  194.                            FT_UInt  height );
  195. #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
  196. FT_END_HEADER
  197. #endif /* __FTDRIVER_H__ */
  198. /* END */