misc/libfreetype/src/pshinter/pshrec.h
author nemo
Tue, 13 Sep 2011 00:32:41 -0400
changeset 5886 a4a620f68b22
parent 5172 88f2e05288ba
permissions -rw-r--r--
fix voice preview
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
/*  pshrec.h                                                               */
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
/*    Postscript (Type1/Type2) hints recorder (specification).             */
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, 2003, 2006, 2008 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
  /**************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
  /*                                                                        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
  /*  The functions defined here are called from the Type 1, CID and CFF    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
  /*  font drivers to record the hints of a given character/glyph.          */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
  /*                                                                        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
  /*  The hints are recorded in a unified format, and are later processed   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
  /*  by the `optimizer' and `fitter' to adjust the outlines to the pixel   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
  /*  grid.                                                                 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
  /*                                                                        */
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
#ifndef __PSHREC_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
#define __PSHREC_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
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
#include <ft2build.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
#include "pshglob.h"
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
FT_BEGIN_HEADER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
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
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
  /*************************************************************************/
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
  /*****                 GLYPH HINTS RECORDER INTERNALS                *****/
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
  /* handle to hint record */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
  typedef struct PS_HintRec_*  PS_Hint;
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
  /* hint types */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
  typedef enum  PS_Hint_Type_
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
    PS_HINT_TYPE_1 = 1,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
    PS_HINT_TYPE_2 = 2
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
  } PS_Hint_Type;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
  /* hint flags */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
  typedef enum  PS_Hint_Flags_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
    PS_HINT_FLAG_GHOST  = 1,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
    PS_HINT_FLAG_BOTTOM = 2
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
  } PS_Hint_Flags;
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
  /* hint descriptor */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
  typedef struct  PS_HintRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
    FT_Int   pos;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
    FT_Int   len;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
    FT_UInt  flags;
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
  } PS_HintRec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
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
#define ps_hint_is_active( x )  ( (x)->flags & PS_HINT_FLAG_ACTIVE )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
#define ps_hint_is_ghost( x )   ( (x)->flags & PS_HINT_FLAG_GHOST  )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
#define ps_hint_is_bottom( x )  ( (x)->flags & PS_HINT_FLAG_BOTTOM )
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
  /* hints table descriptor */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
  typedef struct  PS_Hint_TableRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
    FT_UInt  num_hints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
    FT_UInt  max_hints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
    PS_Hint  hints;
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
  } PS_Hint_TableRec, *PS_Hint_Table;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
  /* hint and counter mask descriptor */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
  typedef struct  PS_MaskRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
    FT_UInt   num_bits;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
    FT_UInt   max_bits;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   102
    FT_Byte*  bytes;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
    FT_UInt   end_point;
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
  } PS_MaskRec, *PS_Mask;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   106
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
  /* masks and counters table descriptor */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
  typedef struct  PS_Mask_TableRec_
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
    FT_UInt  num_masks;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
    FT_UInt  max_masks;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
    PS_Mask  masks;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   115
  } PS_Mask_TableRec, *PS_Mask_Table;
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
 /* dimension-specific hints descriptor */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
  typedef struct  PS_DimensionRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
    PS_Hint_TableRec  hints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
    PS_Mask_TableRec  masks;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
    PS_Mask_TableRec  counters;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
  } PS_DimensionRec, *PS_Dimension;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
  /* glyph hints descriptor                                */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
  /* dimension 0 => X coordinates + vertical hints/stems   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
  /* dimension 1 => Y coordinates + horizontal hints/stems */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   131
  typedef struct  PS_HintsRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   132
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
    FT_Memory        memory;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
    FT_Error         error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
    FT_UInt32        magic;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
    PS_Hint_Type     hint_type;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   137
    PS_DimensionRec  dimension[2];
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
  } PS_HintsRec, *PS_Hints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   140
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
  /* */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   142
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   143
  /* initialize hints recorder */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   144
  FT_LOCAL( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
  ps_hints_init( PS_Hints   hints,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
                 FT_Memory  memory );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
  /* finalize hints recorder */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   149
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
  ps_hints_done( PS_Hints  hints );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   151
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
  /* initialize Type1 hints recorder interface */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   154
  t1_hints_funcs_init( T1_Hints_FuncsRec*  funcs );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
  /* initialize Type2 hints recorder interface */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
  t2_hints_funcs_init( T2_Hints_FuncsRec*  funcs );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   161
#ifdef DEBUG_HINTER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   162
  extern PS_Hints  ps_debug_hints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   163
  extern  int      ps_debug_no_horz_hints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
  extern  int      ps_debug_no_vert_hints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   165
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   166
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   167
 /* */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   170
FT_END_HEADER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   172
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   173
#endif /* __PS_HINTER_RECORD_H__ */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   174
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   175
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   176
/* END */