misc/libfreetype/src/autofit/afmodule.c
author unc0rr
Wed, 25 Jul 2012 16:24:30 +0400
changeset 7433 c7fff3e61d49
parent 5172 88f2e05288ba
permissions -rw-r--r--
- Implement AI land marks which only used to tracks visited areas on the map for now. Significantly reduces wasting of cpu time by AI checking same place several times (10x or even more in rare cases) - More branching in walk algorythm which allows for better coverage of reachable places. Sometimes makes AI perform ridiculous jumping just to make a tiny step. - Small fixes/adjustments
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5172
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     1
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     2
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     3
/*  afmodule.c                                                             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     4
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     5
/*    Auto-fitter module implementation (body).                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     6
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     7
/*  Copyright 2003-2006, 2009, 2011 by                                     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     8
/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     9
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    10
/*  This file is part of the FreeType project, and may only be used,       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    11
/*  modified, and distributed under the terms of the FreeType project      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    12
/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    13
/*  this file you indicate that you have read the license and              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    14
/*  understand and accept it fully.                                        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    15
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    16
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    17
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    18
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    19
#include "afmodule.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
#include "afloader.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
#include "afpic.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
#ifdef FT_DEBUG_AUTOFIT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
  int    _af_debug_disable_horz_hints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
  int    _af_debug_disable_vert_hints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
  int    _af_debug_disable_blue_hints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
  void*  _af_debug_hints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
#include FT_INTERNAL_OBJECTS_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
  typedef struct  FT_AutofitterRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
    FT_ModuleRec  root;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
    AF_LoaderRec  loader[1];
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
  } FT_AutofitterRec, *FT_Autofitter;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
  FT_CALLBACK_DEF( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
  af_autofitter_init( FT_Autofitter  module )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
    return af_loader_init( module->loader, module->root.library->memory );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
  FT_CALLBACK_DEF( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
  af_autofitter_done( FT_Autofitter  module )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
    af_loader_done( module->loader );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
  FT_CALLBACK_DEF( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
  af_autofitter_load_glyph( FT_Autofitter  module,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
                            FT_GlyphSlot   slot,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
                            FT_Size        size,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
                            FT_UInt        glyph_index,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
                            FT_Int32       load_flags )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
    FT_UNUSED( size );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
    return af_loader_load_glyph( module->loader, slot->face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
                                 glyph_index, load_flags );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
  FT_DEFINE_AUTOHINTER_SERVICE(
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
    af_autofitter_service,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
    NULL,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
    NULL,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
    NULL,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
    (FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
  FT_DEFINE_MODULE(
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
    autofit_module_class,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
    FT_MODULE_HINTER,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
    sizeof ( FT_AutofitterRec ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
    "autofitter",
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
    0x10000L,   /* version 1.0 of the autofitter  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
    0x20000L,   /* requires FreeType 2.0 or above */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
    (const void*)&AF_AF_AUTOFITTER_SERVICE_GET,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
    (FT_Module_Constructor)af_autofitter_init,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
    (FT_Module_Destructor) af_autofitter_done,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
    (FT_Module_Requester)  NULL )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
/* END */