misc/libfreetype/src/pshinter/pshmod.c
author koda
Mon, 25 Apr 2011 01:46:54 +0200
changeset 5172 88f2e05288ba
permissions -rw-r--r--
aaand let's add freetype as well while we are at it other smaller changes
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
/*  pshmod.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
/*    FreeType PostScript hinter 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 2001, 2002, 2007 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 <ft2build.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
#include FT_INTERNAL_OBJECTS_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
#include "pshrec.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
#include "pshalgo.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
#include "pshpic.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
  /* the Postscript Hinter module structure */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
  typedef struct  PS_Hinter_Module_Rec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
    FT_ModuleRec          root;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
    PS_HintsRec           ps_hints;
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
    PSH_Globals_FuncsRec  globals_funcs;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
    T1_Hints_FuncsRec     t1_funcs;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
    T2_Hints_FuncsRec     t2_funcs;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
  } PS_Hinter_ModuleRec, *PS_Hinter_Module;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
  /* finalize module */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
  FT_CALLBACK_DEF( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
  ps_hinter_done( PS_Hinter_Module  module )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
    module->t1_funcs.hints = NULL;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
    module->t2_funcs.hints = NULL;
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
    ps_hints_done( &module->ps_hints );
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
  /* initialize module, create hints recorder and the interface */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
  FT_CALLBACK_DEF( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
  ps_hinter_init( PS_Hinter_Module  module )
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
    FT_Memory  memory = module->root.memory;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
    void*      ph     = &module->ps_hints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
    ps_hints_init( &module->ps_hints, memory );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
    psh_globals_funcs_init( &module->globals_funcs );
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
    t1_hints_funcs_init( &module->t1_funcs );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
    module->t1_funcs.hints = (T1_Hints)ph;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
    t2_hints_funcs_init( &module->t2_funcs );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
    module->t2_funcs.hints = (T2_Hints)ph;
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
    return 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
  /* returns global hints interface */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
  FT_CALLBACK_DEF( PSH_Globals_Funcs )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
  pshinter_get_globals_funcs( FT_Module  module )
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
    return &((PS_Hinter_Module)module)->globals_funcs;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
  }
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
  /* return Type 1 hints interface */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
  FT_CALLBACK_DEF( T1_Hints_Funcs )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
  pshinter_get_t1_funcs( FT_Module  module )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
    return &((PS_Hinter_Module)module)->t1_funcs;
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
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
  /* return Type 2 hints interface */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
  FT_CALLBACK_DEF( T2_Hints_Funcs )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
  pshinter_get_t2_funcs( FT_Module  module )
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
    return &((PS_Hinter_Module)module)->t2_funcs;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
  FT_DEFINE_PSHINTER_INTERFACE(pshinter_interface,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
    pshinter_get_globals_funcs,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
    pshinter_get_t1_funcs,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
    pshinter_get_t2_funcs
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
  )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   102
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
  FT_DEFINE_MODULE(pshinter_module_class,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   105
    0,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   106
    sizeof ( PS_Hinter_ModuleRec ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
    "pshinter",
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
    0x10000L,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
    0x20000L,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   110
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
    &FTPSHINTER_INTERFACE_GET,            /* module-specific interface */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
    (FT_Module_Constructor)ps_hinter_init,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
    (FT_Module_Destructor) ps_hinter_done,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   115
    (FT_Module_Requester)  0        /* no additional interface for now */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   116
  )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   118
/* END */