misc/libfreetype/src/pshinter/pshalgo.h
author sheepluva
Thu, 03 May 2012 14:21:53 +0200
changeset 7017 19a434fc91fc
parent 5172 88f2e05288ba
permissions -rw-r--r--
visually indicate when map preview generation is in progress.
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
/*  pshalgo.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 hinting algorithm (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, 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
#ifndef __PSHALGO_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
#define __PSHALGO_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
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
#include "pshrec.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
#include "pshglob.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
#include FT_TRIGONOMETRY_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
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
FT_BEGIN_HEADER
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
  /* handle to Hint structure */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
  typedef struct PSH_HintRec_*  PSH_Hint;
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
  /* hint bit-flags */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
  typedef enum  PSH_Hint_Flags_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
    PSH_HINT_GHOST  = PS_HINT_FLAG_GHOST,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
    PSH_HINT_BOTTOM = PS_HINT_FLAG_BOTTOM,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
    PSH_HINT_ACTIVE = 4,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
    PSH_HINT_FITTED = 8
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
  } PSH_Hint_Flags;
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
#define psh_hint_is_active( x )  ( ( (x)->flags & PSH_HINT_ACTIVE ) != 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
#define psh_hint_is_ghost( x )   ( ( (x)->flags & PSH_HINT_GHOST  ) != 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
#define psh_hint_is_fitted( x )  ( ( (x)->flags & PSH_HINT_FITTED ) != 0 )
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
#define psh_hint_activate( x )    (x)->flags |=  PSH_HINT_ACTIVE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
#define psh_hint_deactivate( x )  (x)->flags &= ~PSH_HINT_ACTIVE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
#define psh_hint_set_fitted( x )  (x)->flags |=  PSH_HINT_FITTED
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
  /* hint structure */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
  typedef struct  PSH_HintRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
    FT_Int    org_pos;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
    FT_Int    org_len;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
    FT_Pos    cur_pos;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
    FT_Pos    cur_len;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
    FT_UInt   flags;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
    PSH_Hint  parent;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
    FT_Int    order;
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
  } PSH_HintRec;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
  /* this is an interpolation zone used for strong points;  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
  /* weak points are interpolated according to their strong */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
  /* neighbours                                             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
  typedef struct  PSH_ZoneRec_
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
    FT_Fixed  scale;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
    FT_Fixed  delta;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
    FT_Pos    min;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
    FT_Pos    max;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
  } PSH_ZoneRec, *PSH_Zone;
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
  typedef struct  PSH_Hint_TableRec_
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
    FT_UInt        max_hints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
    FT_UInt        num_hints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
    PSH_Hint       hints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
    PSH_Hint*      sort;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
    PSH_Hint*      sort_global;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
    FT_UInt        num_zones;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
    PSH_ZoneRec*   zones;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
    PSH_Zone       zone;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
    PS_Mask_Table  hint_masks;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
    PS_Mask_Table  counter_masks;
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
  } PSH_Hint_TableRec, *PSH_Hint_Table;
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
  typedef struct PSH_PointRec_*    PSH_Point;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
  typedef struct PSH_ContourRec_*  PSH_Contour;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
  enum
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
    PSH_DIR_NONE  =  4,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   102
    PSH_DIR_UP    = -1,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
    PSH_DIR_DOWN  =  1,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
    PSH_DIR_LEFT  = -2,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   105
    PSH_DIR_RIGHT =  2
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
#define PSH_DIR_HORIZONTAL  2
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
#define PSH_DIR_VERTICAL    1
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
#define PSH_DIR_COMPARE( d1, d2 )   ( (d1) == (d2) || (d1) == -(d2) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
#define PSH_DIR_IS_HORIZONTAL( d )  PSH_DIR_COMPARE( d, PSH_DIR_HORIZONTAL )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
#define PSH_DIR_IS_VERTICAL( d )    PSH_DIR_COMPARE( d, PSH_DIR_VERTICAL )
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   116
 /* the following bit-flags are computed once by the glyph */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
 /* analyzer, for both dimensions                          */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   118
  enum
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
    PSH_POINT_OFF    = 1,   /* point is off the curve */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
    PSH_POINT_SMOOTH = 2,   /* point is smooth        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
    PSH_POINT_INFLEX = 4    /* point is inflection    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
  };
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
#define psh_point_is_smooth( p )  ( (p)->flags & PSH_POINT_SMOOTH )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
#define psh_point_is_off( p )     ( (p)->flags & PSH_POINT_OFF    )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
#define psh_point_is_inflex( p )  ( (p)->flags & PSH_POINT_INFLEX )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
#define psh_point_set_smooth( p )  (p)->flags |= PSH_POINT_SMOOTH
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
#define psh_point_set_off( p )     (p)->flags |= PSH_POINT_OFF
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   131
#define psh_point_set_inflex( p )  (p)->flags |= PSH_POINT_INFLEX
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
  /* the following bit-flags are re-computed for each dimension */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
  enum
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
    PSH_POINT_STRONG   = 16,   /* point is strong                           */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   137
    PSH_POINT_FITTED   = 32,   /* point is already fitted                   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
    PSH_POINT_EXTREMUM = 64,   /* point is local extremum                   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
    PSH_POINT_POSITIVE = 128,  /* extremum has positive contour flow        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   140
    PSH_POINT_NEGATIVE = 256,  /* extremum has negative contour flow        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
    PSH_POINT_EDGE_MIN = 512,  /* point is aligned to left/bottom stem edge */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   142
    PSH_POINT_EDGE_MAX = 1024  /* point is aligned to top/right stem edge   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   143
  };
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   144
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
#define psh_point_is_strong( p )    ( (p)->flags2 & PSH_POINT_STRONG )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
#define psh_point_is_fitted( p )    ( (p)->flags2 & PSH_POINT_FITTED )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
#define psh_point_is_extremum( p )  ( (p)->flags2 & PSH_POINT_EXTREMUM )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
#define psh_point_is_positive( p )  ( (p)->flags2 & PSH_POINT_POSITIVE )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   149
#define psh_point_is_negative( p )  ( (p)->flags2 & PSH_POINT_NEGATIVE )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
#define psh_point_is_edge_min( p )  ( (p)->flags2 & PSH_POINT_EDGE_MIN )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   151
#define psh_point_is_edge_max( p )  ( (p)->flags2 & PSH_POINT_EDGE_MAX )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
#define psh_point_set_strong( p )    (p)->flags2 |= PSH_POINT_STRONG
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   154
#define psh_point_set_fitted( p )    (p)->flags2 |= PSH_POINT_FITTED
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
#define psh_point_set_extremum( p )  (p)->flags2 |= PSH_POINT_EXTREMUM
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
#define psh_point_set_positive( p )  (p)->flags2 |= PSH_POINT_POSITIVE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
#define psh_point_set_negative( p )  (p)->flags2 |= PSH_POINT_NEGATIVE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
#define psh_point_set_edge_min( p )  (p)->flags2 |= PSH_POINT_EDGE_MIN
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
#define psh_point_set_edge_max( p )  (p)->flags2 |= PSH_POINT_EDGE_MAX
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   162
  typedef struct  PSH_PointRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   163
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
    PSH_Point    prev;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   165
    PSH_Point    next;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   166
    PSH_Contour  contour;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   167
    FT_UInt      flags;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
    FT_UInt      flags2;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
    FT_Char      dir_in;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   170
    FT_Char      dir_out;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
    FT_Angle     angle_in;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   172
    FT_Angle     angle_out;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   173
    PSH_Hint     hint;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   174
    FT_Pos       org_u;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   175
    FT_Pos       org_v;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   176
    FT_Pos       cur_u;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
#ifdef DEBUG_HINTER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
    FT_Pos       org_x;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   179
    FT_Pos       cur_x;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   180
    FT_Pos       org_y;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   181
    FT_Pos       cur_y;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   182
    FT_UInt      flags_x;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   183
    FT_UInt      flags_y;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   184
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   185
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   186
  } PSH_PointRec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   187
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   188
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   189
#define PSH_POINT_EQUAL_ORG( a, b )  ( (a)->org_u == (b)->org_u && \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   190
                                       (a)->org_v == (b)->org_v )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   191
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   192
#define PSH_POINT_ANGLE( a, b )  FT_Atan2( (b)->org_u - (a)->org_u,  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   193
                                           (b)->org_v - (a)->org_v )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   194
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   195
  typedef struct  PSH_ContourRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   197
    PSH_Point  start;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   198
    FT_UInt    count;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   199
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   200
  } PSH_ContourRec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   201
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   202
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   203
  typedef struct  PSH_GlyphRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   204
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   205
    FT_UInt            num_points;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   206
    FT_UInt            num_contours;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   207
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
    PSH_Point          points;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
    PSH_Contour        contours;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   210
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   211
    FT_Memory          memory;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   212
    FT_Outline*        outline;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   213
    PSH_Globals        globals;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   214
    PSH_Hint_TableRec  hint_tables[2];
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   215
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   216
    FT_Bool            vertical;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   217
    FT_Int             major_dir;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   218
    FT_Int             minor_dir;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
    FT_Bool            do_horz_hints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   221
    FT_Bool            do_vert_hints;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   222
    FT_Bool            do_horz_snapping;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   223
    FT_Bool            do_vert_snapping;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   224
    FT_Bool            do_stem_adjust;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   225
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   226
  } PSH_GlyphRec, *PSH_Glyph;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   227
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   228
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
#ifdef DEBUG_HINTER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   230
  extern PSH_Hint_Table  ps_debug_hint_table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   231
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   232
  typedef void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   233
  (*PSH_HintFunc)( PSH_Hint  hint,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   234
                   FT_Bool   vertical );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   235
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   236
  extern PSH_HintFunc    ps_debug_hint_func;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   237
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   238
  extern PSH_Glyph       ps_debug_glyph;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   239
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   240
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   241
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   242
  extern FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   243
  ps_hints_apply( PS_Hints        ps_hints,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   244
                  FT_Outline*     outline,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   245
                  PSH_Globals     globals,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   246
                  FT_Render_Mode  hint_mode );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   247
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   248
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   249
FT_END_HEADER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   250
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   251
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   252
#endif /* __PSHALGO_H__ */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   253
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   254
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   255
/* END */