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

其他游戏

开发平台:

Visual C++

  1. /***************************************************************************/
  2. /*                                                                         */
  3. /*  ftobjs.h                                                               */
  4. /*                                                                         */
  5. /*    The FreeType private base classes (specification).                   */
  6. /*                                                                         */
  7. /*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 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.   /*************************************************************************/
  18.   /*                                                                       */
  19.   /*  This file contains the definition of all internal FreeType classes.  */
  20.   /*                                                                       */
  21.   /*************************************************************************/
  22. #ifndef __FTOBJS_H__
  23. #define __FTOBJS_H__
  24. #include <ft2build.h>
  25. #include FT_RENDER_H
  26. #include FT_SIZES_H
  27. #include FT_LCD_FILTER_H
  28. #include FT_INTERNAL_MEMORY_H
  29. #include FT_INTERNAL_GLYPH_LOADER_H
  30. #include FT_INTERNAL_DRIVER_H
  31. #include FT_INTERNAL_AUTOHINT_H
  32. #include FT_INTERNAL_SERVICE_H
  33. #ifdef FT_CONFIG_OPTION_INCREMENTAL
  34. #include FT_INCREMENTAL_H
  35. #endif
  36. FT_BEGIN_HEADER
  37.   /*************************************************************************/
  38.   /*                                                                       */
  39.   /* Some generic definitions.                                             */
  40.   /*                                                                       */
  41. #ifndef TRUE
  42. #define TRUE  1
  43. #endif
  44. #ifndef FALSE
  45. #define FALSE  0
  46. #endif
  47. #ifndef NULL
  48. #define NULL  (void*)0
  49. #endif
  50.   /*************************************************************************/
  51.   /*                                                                       */
  52.   /* The min and max functions missing in C.  As usual, be careful not to  */
  53.   /* write things like FT_MIN( a++, b++ ) to avoid side effects.           */
  54.   /*                                                                       */
  55. #define FT_MIN( a, b )  ( (a) < (b) ? (a) : (b) )
  56. #define FT_MAX( a, b )  ( (a) > (b) ? (a) : (b) )
  57. #define FT_ABS( a )     ( (a) < 0 ? -(a) : (a) )
  58. #define FT_PAD_FLOOR( x, n )  ( (x) & ~((n)-1) )
  59. #define FT_PAD_ROUND( x, n )  FT_PAD_FLOOR( (x) + ((n)/2), n )
  60. #define FT_PAD_CEIL( x, n )   FT_PAD_FLOOR( (x) + ((n)-1), n )
  61. #define FT_PIX_FLOOR( x )     ( (x) & ~63 )
  62. #define FT_PIX_ROUND( x )     FT_PIX_FLOOR( (x) + 32 )
  63. #define FT_PIX_CEIL( x )      FT_PIX_FLOOR( (x) + 63 )
  64.   /*
  65.    *  Return the highest power of 2 that is <= value; this correspond to
  66.    *  the highest bit in a given 32-bit value.
  67.    */
  68.   FT_BASE( FT_UInt32 )
  69.   ft_highpow2( FT_UInt32  value );
  70.   /*
  71.    *  character classification functions -- since these are used to parse
  72.    *  font files, we must not use those in <ctypes.h> which are
  73.    *  locale-dependent
  74.    */
  75. #define  ft_isdigit( x )   ( ( (unsigned)(x) - '0' ) < 10U )
  76. #define  ft_isxdigit( x )  ( ( (unsigned)(x) - '0' ) < 10U || 
  77.                              ( (unsigned)(x) - 'a' ) < 6U  || 
  78.                              ( (unsigned)(x) - 'A' ) < 6U  )
  79.   /* the next two macros assume ASCII representation */
  80. #define  ft_isupper( x )  ( ( (unsigned)(x) - 'A' ) < 26U )
  81. #define  ft_islower( x )  ( ( (unsigned)(x) - 'a' ) < 26U )
  82. #define  ft_isalpha( x )  ( ft_isupper( x ) || ft_islower( x ) )
  83. #define  ft_isalnum( x )  ( ft_isdigit( x ) || ft_isalpha( x ) )
  84.   /*************************************************************************/
  85.   /*************************************************************************/
  86.   /*************************************************************************/
  87.   /****                                                                 ****/
  88.   /****                                                                 ****/
  89.   /****                       C H A R M A P S                           ****/
  90.   /****                                                                 ****/
  91.   /****                                                                 ****/
  92.   /*************************************************************************/
  93.   /*************************************************************************/
  94.   /*************************************************************************/
  95.   /* handle to internal charmap object */
  96.   typedef struct FT_CMapRec_*              FT_CMap;
  97.   /* handle to charmap class structure */
  98.   typedef const struct FT_CMap_ClassRec_*  FT_CMap_Class;
  99.   /* internal charmap object structure */
  100.   typedef struct  FT_CMapRec_
  101.   {
  102.     FT_CharMapRec  charmap;
  103.     FT_CMap_Class  clazz;
  104.   } FT_CMapRec;
  105.   /* typecase any pointer to a charmap handle */
  106. #define FT_CMAP( x )              ((FT_CMap)( x ))
  107.   /* obvious macros */
  108. #define FT_CMAP_PLATFORM_ID( x )  FT_CMAP( x )->charmap.platform_id
  109. #define FT_CMAP_ENCODING_ID( x )  FT_CMAP( x )->charmap.encoding_id
  110. #define FT_CMAP_ENCODING( x )     FT_CMAP( x )->charmap.encoding
  111. #define FT_CMAP_FACE( x )         FT_CMAP( x )->charmap.face
  112.   /* class method definitions */
  113.   typedef FT_Error
  114.   (*FT_CMap_InitFunc)( FT_CMap     cmap,
  115.                        FT_Pointer  init_data );
  116.   typedef void
  117.   (*FT_CMap_DoneFunc)( FT_CMap  cmap );
  118.   typedef FT_UInt
  119.   (*FT_CMap_CharIndexFunc)( FT_CMap    cmap,
  120.                             FT_UInt32  char_code );
  121.   typedef FT_UInt
  122.   (*FT_CMap_CharNextFunc)( FT_CMap     cmap,
  123.                            FT_UInt32  *achar_code );
  124.   typedef struct  FT_CMap_ClassRec_
  125.   {
  126.     FT_ULong               size;
  127.     FT_CMap_InitFunc       init;
  128.     FT_CMap_DoneFunc       done;
  129.     FT_CMap_CharIndexFunc  char_index;
  130.     FT_CMap_CharNextFunc   char_next;
  131.   } FT_CMap_ClassRec;
  132.   /* create a new charmap and add it to charmap->face */
  133.   FT_BASE( FT_Error )
  134.   FT_CMap_New( FT_CMap_Class  clazz,
  135.                FT_Pointer     init_data,
  136.                FT_CharMap     charmap,
  137.                FT_CMap       *acmap );
  138.   /* destroy a charmap and remove it from face's list */
  139.   FT_BASE( void )
  140.   FT_CMap_Done( FT_CMap  cmap );
  141.   /*************************************************************************/
  142.   /*                                                                       */
  143.   /* <Struct>                                                              */
  144.   /*    FT_Face_InternalRec                                                */
  145.   /*                                                                       */
  146.   /* <Description>                                                         */
  147.   /*    This structure contains the internal fields of each FT_Face        */
  148.   /*    object.  These fields may change between different releases of     */
  149.   /*    FreeType.                                                          */
  150.   /*                                                                       */
  151.   /* <Fields>                                                              */
  152.   /*    max_points ::                                                      */
  153.   /*      The maximal number of points used to store the vectorial outline */
  154.   /*      of any glyph in this face.  If this value cannot be known in     */
  155.   /*      advance, or if the face isn't scalable, this should be set to 0. */
  156.   /*      Only relevant for scalable formats.                              */
  157.   /*                                                                       */
  158.   /*    max_contours ::                                                    */
  159.   /*      The maximal number of contours used to store the vectorial       */
  160.   /*      outline of any glyph in this face.  If this value cannot be      */
  161.   /*      known in advance, or if the face isn't scalable, this should be  */
  162.   /*      set to 0.  Only relevant for scalable formats.                   */
  163.   /*                                                                       */
  164.   /*    transform_matrix ::                                                */
  165.   /*      A 2x2 matrix of 16.16 coefficients used to transform glyph       */
  166.   /*      outlines after they are loaded from the font.  Only used by the  */
  167.   /*      convenience functions.                                           */
  168.   /*                                                                       */
  169.   /*    transform_delta ::                                                 */
  170.   /*      A translation vector used to transform glyph outlines after they */
  171.   /*      are loaded from the font.  Only used by the convenience          */
  172.   /*      functions.                                                       */
  173.   /*                                                                       */
  174.   /*    transform_flags ::                                                 */
  175.   /*      Some flags used to classify the transform.  Only used by the     */
  176.   /*      convenience functions.                                           */
  177.   /*                                                                       */
  178.   /*    services ::                                                        */
  179.   /*      A cache for frequently used services.  It should be only         */
  180.   /*      accessed with the macro `FT_FACE_LOOKUP_SERVICE'.                */
  181.   /*                                                                       */
  182.   /*    incremental_interface ::                                           */
  183.   /*      If non-null, the interface through which glyph data and metrics  */
  184.   /*      are loaded incrementally for faces that do not provide all of    */
  185.   /*      this data when first opened.  This field exists only if          */
  186.   /*      @FT_CONFIG_OPTION_INCREMENTAL is defined.                        */
  187.   /*                                                                       */
  188.   /*    ignore_unpatented_hinter ::                                        */
  189.   /*      This boolean flag instructs the glyph loader to ignore the       */
  190.   /*      native font hinter, if one is found.  This is exclusively used   */
  191.   /*      in the case when the unpatented hinter is compiled within the    */
  192.   /*      library.                                                         */
  193.   /*                                                                       */
  194.   typedef struct  FT_Face_InternalRec_
  195.   {
  196. #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
  197.     FT_UShort           reserved1;
  198.     FT_Short            reserved2;
  199. #endif
  200.     FT_Matrix           transform_matrix;
  201.     FT_Vector           transform_delta;
  202.     FT_Int              transform_flags;
  203.     FT_ServiceCacheRec  services;
  204. #ifdef FT_CONFIG_OPTION_INCREMENTAL
  205.     FT_Incremental_InterfaceRec*  incremental_interface;
  206. #endif
  207.     FT_Bool             ignore_unpatented_hinter;
  208.   } FT_Face_InternalRec;
  209.   /*************************************************************************/
  210.   /*                                                                       */
  211.   /* <Struct>                                                              */
  212.   /*    FT_Slot_InternalRec                                                */
  213.   /*                                                                       */
  214.   /* <Description>                                                         */
  215.   /*    This structure contains the internal fields of each FT_GlyphSlot   */
  216.   /*    object.  These fields may change between different releases of     */
  217.   /*    FreeType.                                                          */
  218.   /*                                                                       */
  219.   /* <Fields>                                                              */
  220.   /*    loader            :: The glyph loader object used to load outlines */
  221.   /*                         into the glyph slot.                          */
  222.   /*                                                                       */
  223.   /*    flags             :: Possible values are zero or                   */
  224.   /*                         FT_GLYPH_OWN_BITMAP.  The latter indicates    */
  225.   /*                         that the FT_GlyphSlot structure owns the      */
  226.   /*                         bitmap buffer.                                */
  227.   /*                                                                       */
  228.   /*    glyph_transformed :: Boolean.  Set to TRUE when the loaded glyph   */
  229.   /*                         must be transformed through a specific        */
  230.   /*                         font transformation.  This is _not_ the same  */
  231.   /*                         as the face transform set through             */
  232.   /*                         FT_Set_Transform().                           */
  233.   /*                                                                       */
  234.   /*    glyph_matrix      :: The 2x2 matrix corresponding to the glyph     */
  235.   /*                         transformation, if necessary.                 */
  236.   /*                                                                       */
  237.   /*    glyph_delta       :: The 2d translation vector corresponding to    */
  238.   /*                         the glyph transformation, if necessary.       */
  239.   /*                                                                       */
  240.   /*    glyph_hints       :: Format-specific glyph hints management.       */
  241.   /*                                                                       */
  242. #define FT_GLYPH_OWN_BITMAP  0x1
  243.   typedef struct  FT_Slot_InternalRec_
  244.   {
  245.     FT_GlyphLoader  loader;
  246.     FT_UInt         flags;
  247.     FT_Bool         glyph_transformed;
  248.     FT_Matrix       glyph_matrix;
  249.     FT_Vector       glyph_delta;
  250.     void*           glyph_hints;
  251.   } FT_GlyphSlot_InternalRec;
  252.   /*************************************************************************/
  253.   /*************************************************************************/
  254.   /*************************************************************************/
  255.   /****                                                                 ****/
  256.   /****                                                                 ****/
  257.   /****                         M O D U L E S                           ****/
  258.   /****                                                                 ****/
  259.   /****                                                                 ****/
  260.   /*************************************************************************/
  261.   /*************************************************************************/
  262.   /*************************************************************************/
  263.   /*************************************************************************/
  264.   /*                                                                       */
  265.   /* <Struct>                                                              */
  266.   /*    FT_ModuleRec                                                       */
  267.   /*                                                                       */
  268.   /* <Description>                                                         */
  269.   /*    A module object instance.                                          */
  270.   /*                                                                       */
  271.   /* <Fields>                                                              */
  272.   /*    clazz   :: A pointer to the module's class.                        */
  273.   /*                                                                       */
  274.   /*    library :: A handle to the parent library object.                  */
  275.   /*                                                                       */
  276.   /*    memory  :: A handle to the memory manager.                         */
  277.   /*                                                                       */
  278.   /*    generic :: A generic structure for user-level extensibility (?).   */
  279.   /*                                                                       */
  280.   typedef struct  FT_ModuleRec_
  281.   {
  282.     FT_Module_Class*  clazz;
  283.     FT_Library        library;
  284.     FT_Memory         memory;
  285.     FT_Generic        generic;
  286.   } FT_ModuleRec;
  287.   /* typecast an object to a FT_Module */
  288. #define FT_MODULE( x )          ((FT_Module)( x ))
  289. #define FT_MODULE_CLASS( x )    FT_MODULE( x )->clazz
  290. #define FT_MODULE_LIBRARY( x )  FT_MODULE( x )->library
  291. #define FT_MODULE_MEMORY( x )   FT_MODULE( x )->memory
  292. #define FT_MODULE_IS_DRIVER( x )  ( FT_MODULE_CLASS( x )->module_flags & 
  293.                                     FT_MODULE_FONT_DRIVER )
  294. #define FT_MODULE_IS_RENDERER( x )  ( FT_MODULE_CLASS( x )->module_flags & 
  295.                                       FT_MODULE_RENDERER )
  296. #define FT_MODULE_IS_HINTER( x )  ( FT_MODULE_CLASS( x )->module_flags & 
  297.                                     FT_MODULE_HINTER )
  298. #define FT_MODULE_IS_STYLER( x )  ( FT_MODULE_CLASS( x )->module_flags & 
  299.                                     FT_MODULE_STYLER )
  300. #define FT_DRIVER_IS_SCALABLE( x )  ( FT_MODULE_CLASS( x )->module_flags & 
  301.                                       FT_MODULE_DRIVER_SCALABLE )
  302. #define FT_DRIVER_USES_OUTLINES( x )  !( FT_MODULE_CLASS( x )->module_flags & 
  303.                                          FT_MODULE_DRIVER_NO_OUTLINES )
  304. #define FT_DRIVER_HAS_HINTER( x )  ( FT_MODULE_CLASS( x )->module_flags & 
  305.                                      FT_MODULE_DRIVER_HAS_HINTER )
  306.   /*************************************************************************/
  307.   /*                                                                       */
  308.   /* <Function>                                                            */
  309.   /*    FT_Get_Module_Interface                                            */
  310.   /*                                                                       */
  311.   /* <Description>                                                         */
  312.   /*    Finds a module and returns its specific interface as a typeless    */
  313.   /*    pointer.                                                           */
  314.   /*                                                                       */
  315.   /* <Input>                                                               */
  316.   /*    library     :: A handle to the library object.                     */
  317.   /*                                                                       */
  318.   /*    module_name :: The module's name (as an ASCII string).             */
  319.   /*                                                                       */
  320.   /* <Return>                                                              */
  321.   /*    A module-specific interface if available, 0 otherwise.             */
  322.   /*                                                                       */
  323.   /* <Note>                                                                */
  324.   /*    You should better be familiar with FreeType internals to know      */
  325.   /*    which module to look for, and what its interface is :-)            */
  326.   /*                                                                       */
  327.   FT_BASE( const void* )
  328.   FT_Get_Module_Interface( FT_Library   library,
  329.                            const char*  mod_name );
  330.   FT_BASE( FT_Pointer )
  331.   ft_module_get_service( FT_Module    module,
  332.                          const char*  service_id );
  333.  /* */
  334.   /*************************************************************************/
  335.   /*************************************************************************/
  336.   /*************************************************************************/
  337.   /****                                                                 ****/
  338.   /****                                                                 ****/
  339.   /****               FACE, SIZE & GLYPH SLOT OBJECTS                   ****/
  340.   /****                                                                 ****/
  341.   /****                                                                 ****/
  342.   /*************************************************************************/
  343.   /*************************************************************************/
  344.   /*************************************************************************/
  345.   /* a few macros used to perform easy typecasts with minimal brain damage */
  346. #define FT_FACE( x )          ((FT_Face)(x))
  347. #define FT_SIZE( x )          ((FT_Size)(x))
  348. #define FT_SLOT( x )          ((FT_GlyphSlot)(x))
  349. #define FT_FACE_DRIVER( x )   FT_FACE( x )->driver
  350. #define FT_FACE_LIBRARY( x )  FT_FACE_DRIVER( x )->root.library
  351. #define FT_FACE_MEMORY( x )   FT_FACE( x )->memory
  352. #define FT_FACE_STREAM( x )   FT_FACE( x )->stream
  353. #define FT_SIZE_FACE( x )     FT_SIZE( x )->face
  354. #define FT_SLOT_FACE( x )     FT_SLOT( x )->face
  355. #define FT_FACE_SLOT( x )     FT_FACE( x )->glyph
  356. #define FT_FACE_SIZE( x )     FT_FACE( x )->size
  357.   /*************************************************************************/
  358.   /*                                                                       */
  359.   /* <Function>                                                            */
  360.   /*    FT_New_GlyphSlot                                                   */
  361.   /*                                                                       */
  362.   /* <Description>                                                         */
  363.   /*    It is sometimes useful to have more than one glyph slot for a      */
  364.   /*    given face object.  This function is used to create additional     */
  365.   /*    slots.  All of them are automatically discarded when the face is   */
  366.   /*    destroyed.                                                         */
  367.   /*                                                                       */
  368.   /* <Input>                                                               */
  369.   /*    face  :: A handle to a parent face object.                         */
  370.   /*                                                                       */
  371.   /* <Output>                                                              */
  372.   /*    aslot :: A handle to a new glyph slot object.                      */
  373.   /*                                                                       */
  374.   /* <Return>                                                              */
  375.   /*    FreeType error code.  0 means success.                             */
  376.   /*                                                                       */
  377.   FT_BASE( FT_Error )
  378.   FT_New_GlyphSlot( FT_Face        face,
  379.                     FT_GlyphSlot  *aslot );
  380.   /*************************************************************************/
  381.   /*                                                                       */
  382.   /* <Function>                                                            */
  383.   /*    FT_Done_GlyphSlot                                                  */
  384.   /*                                                                       */
  385.   /* <Description>                                                         */
  386.   /*    Destroys a given glyph slot.  Remember however that all slots are  */
  387.   /*    automatically destroyed with its parent.  Using this function is   */
  388.   /*    not always mandatory.                                              */
  389.   /*                                                                       */
  390.   /* <Input>                                                               */
  391.   /*    slot :: A handle to a target glyph slot.                           */
  392.   /*                                                                       */
  393.   FT_BASE( void )
  394.   FT_Done_GlyphSlot( FT_GlyphSlot  slot );
  395.  /* */
  396. #define FT_REQUEST_WIDTH( req )                                            
  397.           ( (req)->horiResolution                                          
  398.               ? (FT_Pos)( (req)->width * (req)->horiResolution + 36 ) / 72 
  399.               : (req)->width )
  400. #define FT_REQUEST_HEIGHT( req )                                            
  401.           ( (req)->vertResolution                                           
  402.               ? (FT_Pos)( (req)->height * (req)->vertResolution + 36 ) / 72 
  403.               : (req)->height )
  404.   /* Set the metrics according to a bitmap strike. */
  405.   FT_BASE( void )
  406.   FT_Select_Metrics( FT_Face   face,
  407.                      FT_ULong  strike_index );
  408.   /* Set the metrics according to a size request. */
  409.   FT_BASE( void )
  410.   FT_Request_Metrics( FT_Face          face,
  411.                       FT_Size_Request  req );
  412.   /* Match a size request against `available_sizes'. */
  413.   FT_BASE( FT_Error )
  414.   FT_Match_Size( FT_Face          face,
  415.                  FT_Size_Request  req,
  416.                  FT_Bool          ignore_width,
  417.                  FT_ULong*        size_index );
  418.   /* Use the horizontal metrics to synthesize the vertical metrics. */
  419.   /* If `advance' is zero, it is also synthesized.                  */
  420.   FT_BASE( void )
  421.   ft_synthesize_vertical_metrics( FT_Glyph_Metrics*  metrics,
  422.                                   FT_Pos             advance );
  423.   /* Free the bitmap of a given glyphslot when needed (i.e., only when it */
  424.   /* was allocated with ft_glyphslot_alloc_bitmap).                       */
  425.   FT_BASE( void )
  426.   ft_glyphslot_free_bitmap( FT_GlyphSlot  slot );
  427.   /* Allocate a new bitmap buffer in a glyph slot. */
  428.   FT_BASE( FT_Error )
  429.   ft_glyphslot_alloc_bitmap( FT_GlyphSlot  slot,
  430.                              FT_ULong      size );
  431.   /* Set the bitmap buffer in a glyph slot to a given pointer.  The buffer */
  432.   /* will not be freed by a later call to ft_glyphslot_free_bitmap.        */
  433.   FT_BASE( void )
  434.   ft_glyphslot_set_bitmap( FT_GlyphSlot  slot,
  435.                            FT_Byte*      buffer );
  436.   /*************************************************************************/
  437.   /*************************************************************************/
  438.   /*************************************************************************/
  439.   /****                                                                 ****/
  440.   /****                                                                 ****/
  441.   /****                        R E N D E R E R S                        ****/
  442.   /****                                                                 ****/
  443.   /****                                                                 ****/
  444.   /*************************************************************************/
  445.   /*************************************************************************/
  446.   /*************************************************************************/
  447. #define FT_RENDERER( x )      ((FT_Renderer)( x ))
  448. #define FT_GLYPH( x )         ((FT_Glyph)( x ))
  449. #define FT_BITMAP_GLYPH( x )  ((FT_BitmapGlyph)( x ))
  450. #define FT_OUTLINE_GLYPH( x ) ((FT_OutlineGlyph)( x ))
  451.   typedef struct  FT_RendererRec_
  452.   {
  453.     FT_ModuleRec            root;
  454.     FT_Renderer_Class*      clazz;
  455.     FT_Glyph_Format         glyph_format;
  456.     FT_Glyph_Class          glyph_class;
  457.     FT_Raster               raster;
  458.     FT_Raster_Render_Func   raster_render;
  459.     FT_Renderer_RenderFunc  render;
  460.   } FT_RendererRec;
  461.   /*************************************************************************/
  462.   /*************************************************************************/
  463.   /*************************************************************************/
  464.   /****                                                                 ****/
  465.   /****                                                                 ****/
  466.   /****                    F O N T   D R I V E R S                      ****/
  467.   /****                                                                 ****/
  468.   /****                                                                 ****/
  469.   /*************************************************************************/
  470.   /*************************************************************************/
  471.   /*************************************************************************/
  472.   /* typecast a module into a driver easily */
  473. #define FT_DRIVER( x )        ((FT_Driver)(x))
  474.   /* typecast a module as a driver, and get its driver class */
  475. #define FT_DRIVER_CLASS( x )  FT_DRIVER( x )->clazz
  476.   /*************************************************************************/
  477.   /*                                                                       */
  478.   /* <Struct>                                                              */
  479.   /*    FT_DriverRec                                                       */
  480.   /*                                                                       */
  481.   /* <Description>                                                         */
  482.   /*    The root font driver class.  A font driver is responsible for      */
  483.   /*    managing and loading font files of a given format.                 */
  484.   /*                                                                       */
  485.   /*  <Fields>                                                             */
  486.   /*     root         :: Contains the fields of the root module class.     */
  487.   /*                                                                       */
  488.   /*     clazz        :: A pointer to the font driver's class.  Note that  */
  489.   /*                     this is NOT root.clazz.  `class' wasn't used      */
  490.   /*                     as it is a reserved word in C++.                  */
  491.   /*                                                                       */
  492.   /*     faces_list   :: The list of faces currently opened by this        */
  493.   /*                     driver.                                           */
  494.   /*                                                                       */
  495.   /*     extensions   :: A typeless pointer to the driver's extensions     */
  496.   /*                     registry, if they are supported through the       */
  497.   /*                     configuration macro FT_CONFIG_OPTION_EXTENSIONS.  */
  498.   /*                                                                       */
  499.   /*     glyph_loader :: The glyph loader for all faces managed by this    */
  500.   /*                     driver.  This object isn't defined for unscalable */
  501.   /*                     formats.                                          */
  502.   /*                                                                       */
  503.   typedef struct  FT_DriverRec_
  504.   {
  505.     FT_ModuleRec     root;
  506.     FT_Driver_Class  clazz;
  507.     FT_ListRec       faces_list;
  508.     void*            extensions;
  509.     FT_GlyphLoader   glyph_loader;
  510.   } FT_DriverRec;
  511.   /*************************************************************************/
  512.   /*************************************************************************/
  513.   /*************************************************************************/
  514.   /****                                                                 ****/
  515.   /****                                                                 ****/
  516.   /****                       L I B R A R I E S                         ****/
  517.   /****                                                                 ****/
  518.   /****                                                                 ****/
  519.   /*************************************************************************/
  520.   /*************************************************************************/
  521.   /*************************************************************************/
  522.   /* This hook is used by the TrueType debugger.  It must be set to an */
  523.   /* alternate truetype bytecode interpreter function.                 */
  524. #define FT_DEBUG_HOOK_TRUETYPE            0
  525.   /* Set this debug hook to a non-null pointer to force unpatented hinting */
  526.   /* for all faces when both TT_USE_BYTECODE_INTERPRETER and               */
  527.   /* TT_CONFIG_OPTION_UNPATENTED_HINTING are defined.  This is only used   */
  528.   /* during debugging.                                                     */
  529. #define FT_DEBUG_HOOK_UNPATENTED_HINTING  1
  530.   typedef void  (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap*      bitmap,
  531.                                             FT_Render_Mode  render_mode,
  532.                                             FT_Library      library );
  533.   /*************************************************************************/
  534.   /*                                                                       */
  535.   /* <Struct>                                                              */
  536.   /*    FT_LibraryRec                                                      */
  537.   /*                                                                       */
  538.   /* <Description>                                                         */
  539.   /*    The FreeType library class.  This is the root of all FreeType      */
  540.   /*    data.  Use FT_New_Library() to create a library object, and        */
  541.   /*    FT_Done_Library() to discard it and all child objects.             */
  542.   /*                                                                       */
  543.   /* <Fields>                                                              */
  544.   /*    memory           :: The library's memory object.  Manages memory   */
  545.   /*                        allocation.                                    */
  546.   /*                                                                       */
  547.   /*    generic          :: Client data variable.  Used to extend the      */
  548.   /*                        Library class by higher levels and clients.    */
  549.   /*                                                                       */
  550.   /*    version_major    :: The major version number of the library.       */
  551.   /*                                                                       */
  552.   /*    version_minor    :: The minor version number of the library.       */
  553.   /*                                                                       */
  554.   /*    version_patch    :: The current patch level of the library.        */
  555.   /*                                                                       */
  556.   /*    num_modules      :: The number of modules currently registered     */
  557.   /*                        within this library.  This is set to 0 for new */
  558.   /*                        libraries.  New modules are added through the  */
  559.   /*                        FT_Add_Module() API function.                  */
  560.   /*                                                                       */
  561.   /*    modules          :: A table used to store handles to the currently */
  562.   /*                        registered modules. Note that each font driver */
  563.   /*                        contains a list of its opened faces.           */
  564.   /*                                                                       */
  565.   /*    renderers        :: The list of renderers currently registered     */
  566.   /*                        within the library.                            */
  567.   /*                                                                       */
  568.   /*    cur_renderer     :: The current outline renderer.  This is a       */
  569.   /*                        shortcut used to avoid parsing the list on     */
  570.   /*                        each call to FT_Outline_Render().  It is a     */
  571.   /*                        handle to the current renderer for the         */
  572.   /*                        FT_GLYPH_FORMAT_OUTLINE format.                */
  573.   /*                                                                       */
  574.   /*    auto_hinter      :: XXX                                            */
  575.   /*                                                                       */
  576.   /*    raster_pool      :: The raster object's render pool.  This can     */
  577.   /*                        ideally be changed dynamically at run-time.    */
  578.   /*                                                                       */
  579.   /*    raster_pool_size :: The size of the render pool in bytes.          */
  580.   /*                                                                       */
  581.   /*    debug_hooks      :: XXX                                            */
  582.   /*                                                                       */
  583.   typedef struct  FT_LibraryRec_
  584.   {
  585.     FT_Memory          memory;           /* library's memory manager */
  586.     FT_Generic         generic;
  587.     FT_Int             version_major;
  588.     FT_Int             version_minor;
  589.     FT_Int             version_patch;
  590.     FT_UInt            num_modules;
  591.     FT_Module          modules[FT_MAX_MODULES];  /* module objects  */
  592.     FT_ListRec         renderers;        /* list of renderers        */
  593.     FT_Renderer        cur_renderer;     /* current outline renderer */
  594.     FT_Module          auto_hinter;
  595.     FT_Byte*           raster_pool;      /* scan-line conversion */
  596.                                          /* render pool          */
  597.     FT_ULong           raster_pool_size; /* size of render pool in bytes */
  598.     FT_DebugHook_Func  debug_hooks[4];
  599. #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
  600.     FT_LcdFilter             lcd_filter;
  601.     FT_Int                   lcd_extra;        /* number of extra pixels */
  602.     FT_Byte                  lcd_weights[7];   /* filter weights, if any */
  603.     FT_Bitmap_LcdFilterFunc  lcd_filter_func;  /* filtering callback     */
  604. #endif
  605.   } FT_LibraryRec;
  606.   FT_BASE( FT_Renderer )
  607.   FT_Lookup_Renderer( FT_Library       library,
  608.                       FT_Glyph_Format  format,
  609.                       FT_ListNode*     node );
  610.   FT_BASE( FT_Error )
  611.   FT_Render_Glyph_Internal( FT_Library      library,
  612.                             FT_GlyphSlot    slot,
  613.                             FT_Render_Mode  render_mode );
  614.   typedef const char*
  615.   (*FT_Face_GetPostscriptNameFunc)( FT_Face  face );
  616.   typedef FT_Error
  617.   (*FT_Face_GetGlyphNameFunc)( FT_Face     face,
  618.                                FT_UInt     glyph_index,
  619.                                FT_Pointer  buffer,
  620.                                FT_UInt     buffer_max );
  621.   typedef FT_UInt
  622.   (*FT_Face_GetGlyphNameIndexFunc)( FT_Face     face,
  623.                                     FT_String*  glyph_name );
  624. #ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
  625.   /*************************************************************************/
  626.   /*                                                                       */
  627.   /* <Function>                                                            */
  628.   /*    FT_New_Memory                                                      */
  629.   /*                                                                       */
  630.   /* <Description>                                                         */
  631.   /*    Creates a new memory object.                                       */
  632.   /*                                                                       */
  633.   /* <Return>                                                              */
  634.   /*    A pointer to the new memory object.  0 in case of error.           */
  635.   /*                                                                       */
  636.   FT_BASE( FT_Memory )
  637.   FT_New_Memory( void );
  638.   /*************************************************************************/
  639.   /*                                                                       */
  640.   /* <Function>                                                            */
  641.   /*    FT_Done_Memory                                                     */
  642.   /*                                                                       */
  643.   /* <Description>                                                         */
  644.   /*    Discards memory manager.                                           */
  645.   /*                                                                       */
  646.   /* <Input>                                                               */
  647.   /*    memory :: A handle to the memory manager.                          */
  648.   /*                                                                       */
  649.   FT_BASE( void )
  650.   FT_Done_Memory( FT_Memory  memory );
  651. #endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
  652.   /* Define default raster's interface.  The default raster is located in  */
  653.   /* `src/base/ftraster.c'.                                                */
  654.   /*                                                                       */
  655.   /* Client applications can register new rasters through the              */
  656.   /* FT_Set_Raster() API.                                                  */
  657. #ifndef FT_NO_DEFAULT_RASTER
  658.   FT_EXPORT_VAR( FT_Raster_Funcs )  ft_default_raster;
  659. #endif
  660. FT_END_HEADER
  661. #endif /* __FTOBJS_H__ */
  662. /* END */