cnFontGen

Tool to convert a font file to a large png glyph for game engines
Log | Files | Refs

ftmodapi.h (21050B)


      1 /***************************************************************************/
      2 /*                                                                         */
      3 /*  ftmodapi.h                                                             */
      4 /*                                                                         */
      5 /*    FreeType modules public 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 
     18 
     19 #ifndef __FTMODAPI_H__
     20 #define __FTMODAPI_H__
     21 
     22 
     23 #include <ft2build.h>
     24 #include FT_FREETYPE_H
     25 
     26 #ifdef FREETYPE_H
     27 #error "freetype.h of FreeType 1 has been loaded!"
     28 #error "Please fix the directory search order for header files"
     29 #error "so that freetype.h of FreeType 2 is found first."
     30 #endif
     31 
     32 
     33 FT_BEGIN_HEADER
     34 
     35 
     36   /*************************************************************************/
     37   /*                                                                       */
     38   /* <Section>                                                             */
     39   /*    module_management                                                  */
     40   /*                                                                       */
     41   /* <Title>                                                               */
     42   /*    Module Management                                                  */
     43   /*                                                                       */
     44   /* <Abstract>                                                            */
     45   /*    How to add, upgrade, and remove modules from FreeType.             */
     46   /*                                                                       */
     47   /* <Description>                                                         */
     48   /*    The definitions below are used to manage modules within FreeType.  */
     49   /*    Modules can be added, upgraded, and removed at runtime.            */
     50   /*                                                                       */
     51   /*************************************************************************/
     52 
     53 
     54   /* module bit flags */
     55 #define FT_MODULE_FONT_DRIVER         1  /* this module is a font driver  */
     56 #define FT_MODULE_RENDERER            2  /* this module is a renderer     */
     57 #define FT_MODULE_HINTER              4  /* this module is a glyph hinter */
     58 #define FT_MODULE_STYLER              8  /* this module is a styler       */
     59 
     60 #define FT_MODULE_DRIVER_SCALABLE     0x100   /* the driver supports      */
     61                                               /* scalable fonts           */
     62 #define FT_MODULE_DRIVER_NO_OUTLINES  0x200   /* the driver does not      */
     63                                               /* support vector outlines  */
     64 #define FT_MODULE_DRIVER_HAS_HINTER   0x400   /* the driver provides its  */
     65                                               /* own hinter               */
     66 
     67 
     68   /* deprecated values */
     69 #define ft_module_font_driver         FT_MODULE_FONT_DRIVER
     70 #define ft_module_renderer            FT_MODULE_RENDERER
     71 #define ft_module_hinter              FT_MODULE_HINTER
     72 #define ft_module_styler              FT_MODULE_STYLER
     73 
     74 #define ft_module_driver_scalable     FT_MODULE_DRIVER_SCALABLE
     75 #define ft_module_driver_no_outlines  FT_MODULE_DRIVER_NO_OUTLINES
     76 #define ft_module_driver_has_hinter   FT_MODULE_DRIVER_HAS_HINTER
     77 
     78 
     79   typedef FT_Pointer  FT_Module_Interface;
     80 
     81   typedef FT_Error
     82   (*FT_Module_Constructor)( FT_Module  module );
     83 
     84   typedef void
     85   (*FT_Module_Destructor)( FT_Module  module );
     86 
     87   typedef FT_Module_Interface
     88   (*FT_Module_Requester)( FT_Module    module,
     89                           const char*  name );
     90 
     91 
     92   /*************************************************************************/
     93   /*                                                                       */
     94   /* <Struct>                                                              */
     95   /*    FT_Module_Class                                                    */
     96   /*                                                                       */
     97   /* <Description>                                                         */
     98   /*    The module class descriptor.                                       */
     99   /*                                                                       */
    100   /* <Fields>                                                              */
    101   /*    module_flags    :: Bit flags describing the module.                */
    102   /*                                                                       */
    103   /*    module_size     :: The size of one module object/instance in       */
    104   /*                       bytes.                                          */
    105   /*                                                                       */
    106   /*    module_name     :: The name of the module.                         */
    107   /*                                                                       */
    108   /*    module_version  :: The version, as a 16.16 fixed number            */
    109   /*                       (major.minor).                                  */
    110   /*                                                                       */
    111   /*    module_requires :: The version of FreeType this module requires,   */
    112   /*                       as a 16.16 fixed number (major.minor).  Starts  */
    113   /*                       at version 2.0, i.e., 0x20000.                  */
    114   /*                                                                       */
    115   /*    module_init     :: A function used to initialize (not create) a    */
    116   /*                       new module object.                              */
    117   /*                                                                       */
    118   /*    module_done     :: A function used to finalize (not destroy) a     */
    119   /*                       given module object                             */
    120   /*                                                                       */
    121   /*    get_interface   :: Queries a given module for a specific           */
    122   /*                       interface by name.                              */
    123   /*                                                                       */
    124   typedef struct  FT_Module_Class_
    125   {
    126     FT_ULong               module_flags;
    127     FT_Long                module_size;
    128     const FT_String*       module_name;
    129     FT_Fixed               module_version;
    130     FT_Fixed               module_requires;
    131 
    132     const void*            module_interface;
    133 
    134     FT_Module_Constructor  module_init;
    135     FT_Module_Destructor   module_done;
    136     FT_Module_Requester    get_interface;
    137 
    138   } FT_Module_Class;
    139 
    140 
    141   /*************************************************************************/
    142   /*                                                                       */
    143   /* <Function>                                                            */
    144   /*    FT_Add_Module                                                      */
    145   /*                                                                       */
    146   /* <Description>                                                         */
    147   /*    Adds a new module to a given library instance.                     */
    148   /*                                                                       */
    149   /* <InOut>                                                               */
    150   /*    library :: A handle to the library object.                         */
    151   /*                                                                       */
    152   /* <Input>                                                               */
    153   /*    clazz   :: A pointer to class descriptor for the module.           */
    154   /*                                                                       */
    155   /* <Return>                                                              */
    156   /*    FreeType error code.  0 means success.                             */
    157   /*                                                                       */
    158   /* <Note>                                                                */
    159   /*    An error will be returned if a module already exists by that name, */
    160   /*    or if the module requires a version of FreeType that is too great. */
    161   /*                                                                       */
    162   FT_EXPORT( FT_Error )
    163   FT_Add_Module( FT_Library              library,
    164                  const FT_Module_Class*  clazz );
    165 
    166 
    167   /*************************************************************************/
    168   /*                                                                       */
    169   /* <Function>                                                            */
    170   /*    FT_Get_Module                                                      */
    171   /*                                                                       */
    172   /* <Description>                                                         */
    173   /*    Finds a module by its name.                                        */
    174   /*                                                                       */
    175   /* <Input>                                                               */
    176   /*    library     :: A handle to the library object.                     */
    177   /*                                                                       */
    178   /*    module_name :: The module's name (as an ASCII string).             */
    179   /*                                                                       */
    180   /* <Return>                                                              */
    181   /*    A module handle.  0 if none was found.                             */
    182   /*                                                                       */
    183   /* <Note>                                                                */
    184   /*    FreeType's internal modules aren't documented very well, and you   */
    185   /*    should look up the source code for details.                        */
    186   /*                                                                       */
    187   FT_EXPORT( FT_Module )
    188   FT_Get_Module( FT_Library   library,
    189                  const char*  module_name );
    190 
    191 
    192   /*************************************************************************/
    193   /*                                                                       */
    194   /* <Function>                                                            */
    195   /*    FT_Remove_Module                                                   */
    196   /*                                                                       */
    197   /* <Description>                                                         */
    198   /*    Removes a given module from a library instance.                    */
    199   /*                                                                       */
    200   /* <InOut>                                                               */
    201   /*    library :: A handle to a library object.                           */
    202   /*                                                                       */
    203   /* <Input>                                                               */
    204   /*    module  :: A handle to a module object.                            */
    205   /*                                                                       */
    206   /* <Return>                                                              */
    207   /*    FreeType error code.  0 means success.                             */
    208   /*                                                                       */
    209   /* <Note>                                                                */
    210   /*    The module object is destroyed by the function in case of success. */
    211   /*                                                                       */
    212   FT_EXPORT( FT_Error )
    213   FT_Remove_Module( FT_Library  library,
    214                     FT_Module   module );
    215 
    216 
    217   /*************************************************************************/
    218   /*                                                                       */
    219   /* <Function>                                                            */
    220   /*    FT_New_Library                                                     */
    221   /*                                                                       */
    222   /* <Description>                                                         */
    223   /*    This function is used to create a new FreeType library instance    */
    224   /*    from a given memory object.  It is thus possible to use libraries  */
    225   /*    with distinct memory allocators within the same program.           */
    226   /*                                                                       */
    227   /* <Input>                                                               */
    228   /*    memory   :: A handle to the original memory object.                */
    229   /*                                                                       */
    230   /* <Output>                                                              */
    231   /*    alibrary :: A pointer to handle of a new library object.           */
    232   /*                                                                       */
    233   /* <Return>                                                              */
    234   /*    FreeType error code.  0 means success.                             */
    235   /*                                                                       */
    236   FT_EXPORT( FT_Error )
    237   FT_New_Library( FT_Memory    memory,
    238                   FT_Library  *alibrary );
    239 
    240 
    241   /*************************************************************************/
    242   /*                                                                       */
    243   /* <Function>                                                            */
    244   /*    FT_Done_Library                                                    */
    245   /*                                                                       */
    246   /* <Description>                                                         */
    247   /*    Discards a given library object.  This closes all drivers and      */
    248   /*    discards all resource objects.                                     */
    249   /*                                                                       */
    250   /* <Input>                                                               */
    251   /*    library :: A handle to the target library.                         */
    252   /*                                                                       */
    253   /* <Return>                                                              */
    254   /*    FreeType error code.  0 means success.                             */
    255   /*                                                                       */
    256   FT_EXPORT( FT_Error )
    257   FT_Done_Library( FT_Library  library );
    258 
    259 /* */
    260 
    261   typedef void
    262   (*FT_DebugHook_Func)( void*  arg );
    263 
    264 
    265   /*************************************************************************/
    266   /*                                                                       */
    267   /* <Function>                                                            */
    268   /*    FT_Set_Debug_Hook                                                  */
    269   /*                                                                       */
    270   /* <Description>                                                         */
    271   /*    Sets a debug hook function for debugging the interpreter of a font */
    272   /*    format.                                                            */
    273   /*                                                                       */
    274   /* <InOut>                                                               */
    275   /*    library    :: A handle to the library object.                      */
    276   /*                                                                       */
    277   /* <Input>                                                               */
    278   /*    hook_index :: The index of the debug hook.  You should use the     */
    279   /*                  values defined in `ftobjs.h', e.g.,                  */
    280   /*                  `FT_DEBUG_HOOK_TRUETYPE'.                            */
    281   /*                                                                       */
    282   /*    debug_hook :: The function used to debug the interpreter.          */
    283   /*                                                                       */
    284   /* <Note>                                                                */
    285   /*    Currently, four debug hook slots are available, but only two (for  */
    286   /*    the TrueType and the Type 1 interpreter) are defined.              */
    287   /*                                                                       */
    288   /*    Since the internal headers of FreeType are no longer installed,    */
    289   /*    the symbol `FT_DEBUG_HOOK_TRUETYPE' isn't available publicly.      */
    290   /*    This is a bug and will be fixed in a forthcoming release.          */
    291   /*                                                                       */
    292   FT_EXPORT( void )
    293   FT_Set_Debug_Hook( FT_Library         library,
    294                      FT_UInt            hook_index,
    295                      FT_DebugHook_Func  debug_hook );
    296 
    297 
    298   /*************************************************************************/
    299   /*                                                                       */
    300   /* <Function>                                                            */
    301   /*    FT_Add_Default_Modules                                             */
    302   /*                                                                       */
    303   /* <Description>                                                         */
    304   /*    Adds the set of default drivers to a given library object.         */
    305   /*    This is only useful when you create a library object with          */
    306   /*    @FT_New_Library (usually to plug a custom memory manager).         */
    307   /*                                                                       */
    308   /* <InOut>                                                               */
    309   /*    library :: A handle to a new library object.                       */
    310   /*                                                                       */
    311   FT_EXPORT( void )
    312   FT_Add_Default_Modules( FT_Library  library );
    313 
    314 
    315 
    316   /**************************************************************************
    317    *
    318    * @section:
    319    *   truetype_engine
    320    *
    321    * @title:
    322    *   The TrueType Engine
    323    *
    324    * @abstract:
    325    *   TrueType bytecode support.
    326    *
    327    * @description:
    328    *   This section contains a function used to query the level of TrueType
    329    *   bytecode support compiled in this version of the library.
    330    *
    331    */
    332 
    333 
    334   /**************************************************************************
    335    *
    336    *  @enum:
    337    *     FT_TrueTypeEngineType
    338    *
    339    *  @description:
    340    *     A list of values describing which kind of TrueType bytecode
    341    *     engine is implemented in a given FT_Library instance.  It is used
    342    *     by the @FT_Get_TrueType_Engine_Type function.
    343    *
    344    *  @values:
    345    *     FT_TRUETYPE_ENGINE_TYPE_NONE ::
    346    *       The library doesn't implement any kind of bytecode interpreter.
    347    *
    348    *     FT_TRUETYPE_ENGINE_TYPE_UNPATENTED ::
    349    *       The library implements a bytecode interpreter that doesn't
    350    *       support the patented operations of the TrueType virtual machine.
    351    *
    352    *       Its main use is to load certain Asian fonts which position and
    353    *       scale glyph components with bytecode instructions.  It produces
    354    *       bad output for most other fonts.
    355    *
    356    *    FT_TRUETYPE_ENGINE_TYPE_PATENTED ::
    357    *       The library implements a bytecode interpreter that covers
    358    *       the full instruction set of the TrueType virtual machine.
    359    *       See the file `docs/PATENTS' for legal aspects.
    360    *
    361    *  @since:
    362    *       2.2
    363    *
    364    */
    365   typedef enum
    366   {
    367     FT_TRUETYPE_ENGINE_TYPE_NONE = 0,
    368     FT_TRUETYPE_ENGINE_TYPE_UNPATENTED,
    369     FT_TRUETYPE_ENGINE_TYPE_PATENTED
    370 
    371   } FT_TrueTypeEngineType;
    372 
    373 
    374   /**************************************************************************
    375    *
    376    *  @func:
    377    *     FT_Get_TrueType_Engine_Type
    378    *
    379    *  @description:
    380    *     Return a @FT_TrueTypeEngineType value to indicate which level of
    381    *     the TrueType virtual machine a given library instance supports.
    382    *
    383    *  @input:
    384    *     library ::
    385    *       A library instance.
    386    *
    387    *  @return:
    388    *     A value indicating which level is supported.
    389    *
    390    *  @since:
    391    *     2.2
    392    *
    393    */
    394   FT_EXPORT( FT_TrueTypeEngineType )
    395   FT_Get_TrueType_Engine_Type( FT_Library  library );
    396 
    397 
    398   /* */
    399 
    400 
    401 FT_END_HEADER
    402 
    403 #endif /* __FTMODAPI_H__ */
    404 
    405 
    406 /* END */