xref: /inferno-os/libfreetype/pshalgo1.h (revision 37da2899f40661e3e9631e497da8dc59b971cbd0)
1 /***************************************************************************/
2 /*                                                                         */
3 /*  pshalgo1.h                                                             */
4 /*                                                                         */
5 /*    PostScript hinting algorithm 1 (specification).                      */
6 /*                                                                         */
7 /*  Copyright 2001 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 #ifndef __PSHALGO1_H__
20 #define __PSHALGO1_H__
21 
22 #include "pshrec.h"
23 
24 FT_BEGIN_HEADER
25 
26   typedef struct PSH1_HintRec_*  PSH1_Hint;
27 
28   typedef enum
29   {
30     PSH1_HINT_FLAG_GHOST  = PS_HINT_FLAG_GHOST,
31     PSH1_HINT_FLAG_BOTTOM = PS_HINT_FLAG_BOTTOM,
32     PSH1_HINT_FLAG_ACTIVE = 4
33 
34   } PSH1_Hint_Flags;
35 
36 #define psh1_hint_is_active( x )                          \
37           ( ( (x)->flags & PSH1_HINT_FLAG_ACTIVE ) != 0 )
38 #define psh1_hint_is_ghost( x )                          \
39           ( ( (x)->flags & PSH1_HINT_FLAG_GHOST ) != 0 )
40 
41 #define psh1_hint_activate( x )    (x)->flags |= PSH1_HINT_FLAG_ACTIVE
42 #define psh1_hint_deactivate( x )  (x)->flags &= ~PSH1_HINT_FLAG_ACTIVE
43 
44   typedef struct  PSH1_HintRec_
45   {
46     FT_Int     org_pos;
47     FT_Int     org_len;
48     FT_Pos     cur_pos;
49     FT_Pos     cur_len;
50 
51     FT_UInt    flags;
52 
53     PSH1_Hint  parent;
54     FT_Int     order;
55 
56   } PSH1_HintRec;
57 
58 
59   /* this is an interpolation zone used for strong points;  */
60   /* weak points are interpolated according to their strong */
61   /* neighbours                                             */
62   typedef struct  PSH1_ZoneRec_
63   {
64     FT_Fixed  scale;
65     FT_Fixed  delta;
66     FT_Pos    min;
67     FT_Pos    max;
68 
69   } PSH1_ZoneRec, *PSH1_Zone;
70 
71 
72   typedef struct  PSH1_Hint_TableRec_
73   {
74     FT_UInt        max_hints;
75     FT_UInt        num_hints;
76     PSH1_Hint      hints;
77     PSH1_Hint*     sort;
78     PSH1_Hint*     sort_global;
79     FT_UInt        num_zones;
80     PSH1_Zone      zones;
81     PSH1_Zone      zone;
82     PS_Mask_Table  hint_masks;
83     PS_Mask_Table  counter_masks;
84 
85   } PSH1_Hint_TableRec, *PSH1_Hint_Table;
86 
87 
88   extern FT_Error
89   ps1_hints_apply( PS_Hints        ps_hints,
90                    FT_Outline*     outline,
91                    PSH_Globals     globals,
92                    FT_Render_Mode  hint_mode );
93 
94 
95 #ifdef DEBUG_HINTER
96   extern  PSH1_Hint_Table  ps1_debug_hint_table;
97 
98   typedef void
99   (*PSH1_HintFunc)( PSH1_Hint  hint,
100                     FT_Bool    vertical );
101 
102   extern PSH1_HintFunc  ps1_debug_hint_func;
103 #endif
104 
105 FT_END_HEADER
106 
107 #endif /* __PSHALGO1_H__ */
108 
109 
110 /* END */
111