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

其他游戏

开发平台:

Visual C++

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