Home | History | Annotate | Download | only in autofit
      1 /***************************************************************************/
      2 /*                                                                         */
      3 /*  afmodule.c                                                             */
      4 /*                                                                         */
      5 /*    Auto-fitter module implementation (body).                            */
      6 /*                                                                         */
      7 /*  Copyright 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 #include "afmodule.h"
     20 #include "afloader.h"
     21 #include "afpic.h"
     22 
     23 #ifdef AF_DEBUG
     24   int    _af_debug;
     25   int    _af_debug_disable_horz_hints;
     26   int    _af_debug_disable_vert_hints;
     27   int    _af_debug_disable_blue_hints;
     28   void*  _af_debug_hints;
     29 #endif
     30 
     31 #include FT_INTERNAL_OBJECTS_H
     32 
     33 
     34   typedef struct  FT_AutofitterRec_
     35   {
     36     FT_ModuleRec  root;
     37     AF_LoaderRec  loader[1];
     38 
     39   } FT_AutofitterRec, *FT_Autofitter;
     40 
     41 
     42   FT_CALLBACK_DEF( FT_Error )
     43   af_autofitter_init( FT_Autofitter  module )
     44   {
     45     return af_loader_init( module->loader, module->root.library->memory );
     46   }
     47 
     48 
     49   FT_CALLBACK_DEF( void )
     50   af_autofitter_done( FT_Autofitter  module )
     51   {
     52     af_loader_done( module->loader );
     53   }
     54 
     55 
     56   FT_CALLBACK_DEF( FT_Error )
     57   af_autofitter_load_glyph( FT_Autofitter  module,
     58                             FT_GlyphSlot   slot,
     59                             FT_Size        size,
     60                             FT_UInt        glyph_index,
     61                             FT_Int32       load_flags )
     62   {
     63     FT_UNUSED( size );
     64 
     65     return af_loader_load_glyph( module->loader, slot->face,
     66                                  glyph_index, load_flags );
     67   }
     68 
     69 
     70   FT_DEFINE_AUTOHINTER_SERVICE(af_autofitter_service,
     71     NULL,
     72     NULL,
     73     NULL,
     74     (FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph
     75   )
     76 
     77   FT_DEFINE_MODULE(autofit_module_class,
     78 
     79     FT_MODULE_HINTER,
     80     sizeof ( FT_AutofitterRec ),
     81 
     82     "autofitter",
     83     0x10000L,   /* version 1.0 of the autofitter  */
     84     0x20000L,   /* requires FreeType 2.0 or above */
     85 
     86     (const void*)&AF_AF_AUTOFITTER_SERVICE_GET,
     87 
     88     (FT_Module_Constructor)af_autofitter_init,
     89     (FT_Module_Destructor) af_autofitter_done,
     90     (FT_Module_Requester)  NULL
     91   )
     92 
     93 
     94 /* END */
     95