ReactOS 0.4.15-dev-5664-g3bf4ef6
pshalgo.h
Go to the documentation of this file.
1/***************************************************************************/
2/* */
3/* pshalgo.h */
4/* */
5/* PostScript hinting algorithm (specification). */
6/* */
7/* Copyright 2001-2018 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 PSHALGO_H_
20#define PSHALGO_H_
21
22
23#include "pshrec.h"
24#include "pshglob.h"
25
26
28
29
30 /* handle to Hint structure */
31 typedef struct PSH_HintRec_* PSH_Hint;
32
33
34 /* hint bit-flags */
35#define PSH_HINT_GHOST PS_HINT_FLAG_GHOST
36#define PSH_HINT_BOTTOM PS_HINT_FLAG_BOTTOM
37#define PSH_HINT_ACTIVE 4U
38#define PSH_HINT_FITTED 8U
39
40
41#define psh_hint_is_active( x ) ( ( (x)->flags & PSH_HINT_ACTIVE ) != 0 )
42#define psh_hint_is_ghost( x ) ( ( (x)->flags & PSH_HINT_GHOST ) != 0 )
43#define psh_hint_is_fitted( x ) ( ( (x)->flags & PSH_HINT_FITTED ) != 0 )
44
45#define psh_hint_activate( x ) (x)->flags |= PSH_HINT_ACTIVE
46#define psh_hint_deactivate( x ) (x)->flags &= ~PSH_HINT_ACTIVE
47#define psh_hint_set_fitted( x ) (x)->flags |= PSH_HINT_FITTED
48
49
50 /* hint structure */
51 typedef struct PSH_HintRec_
52 {
60
62
63
64 /* this is an interpolation zone used for strong points; */
65 /* weak points are interpolated according to their strong */
66 /* neighbours */
67 typedef struct PSH_ZoneRec_
68 {
73
75
76
77 typedef struct PSH_Hint_TableRec_
78 {
89
91
92
93 typedef struct PSH_PointRec_* PSH_Point;
95
96 enum
97 {
102 PSH_DIR_RIGHT = 2
103 };
104
105#define PSH_DIR_HORIZONTAL 2
106#define PSH_DIR_VERTICAL 1
107
108#define PSH_DIR_COMPARE( d1, d2 ) ( (d1) == (d2) || (d1) == -(d2) )
109#define PSH_DIR_IS_HORIZONTAL( d ) PSH_DIR_COMPARE( d, PSH_DIR_HORIZONTAL )
110#define PSH_DIR_IS_VERTICAL( d ) PSH_DIR_COMPARE( d, PSH_DIR_VERTICAL )
111
112
113 /* the following bit-flags are computed once by the glyph */
114 /* analyzer, for both dimensions */
115#define PSH_POINT_OFF 1U /* point is off the curve */
116#define PSH_POINT_SMOOTH 2U /* point is smooth */
117#define PSH_POINT_INFLEX 4U /* point is inflection */
118
119
120#define psh_point_is_smooth( p ) ( (p)->flags & PSH_POINT_SMOOTH )
121#define psh_point_is_off( p ) ( (p)->flags & PSH_POINT_OFF )
122#define psh_point_is_inflex( p ) ( (p)->flags & PSH_POINT_INFLEX )
123
124#define psh_point_set_smooth( p ) (p)->flags |= PSH_POINT_SMOOTH
125#define psh_point_set_off( p ) (p)->flags |= PSH_POINT_OFF
126#define psh_point_set_inflex( p ) (p)->flags |= PSH_POINT_INFLEX
127
128
129 /* the following bit-flags are re-computed for each dimension */
130#define PSH_POINT_STRONG 16U /* point is strong */
131#define PSH_POINT_FITTED 32U /* point is already fitted */
132#define PSH_POINT_EXTREMUM 64U /* point is local extremum */
133#define PSH_POINT_POSITIVE 128U /* extremum has positive contour flow */
134#define PSH_POINT_NEGATIVE 256U /* extremum has negative contour flow */
135#define PSH_POINT_EDGE_MIN 512U /* point is aligned to left/bottom stem edge */
136#define PSH_POINT_EDGE_MAX 1024U /* point is aligned to top/right stem edge */
137
138
139#define psh_point_is_strong( p ) ( (p)->flags2 & PSH_POINT_STRONG )
140#define psh_point_is_fitted( p ) ( (p)->flags2 & PSH_POINT_FITTED )
141#define psh_point_is_extremum( p ) ( (p)->flags2 & PSH_POINT_EXTREMUM )
142#define psh_point_is_positive( p ) ( (p)->flags2 & PSH_POINT_POSITIVE )
143#define psh_point_is_negative( p ) ( (p)->flags2 & PSH_POINT_NEGATIVE )
144#define psh_point_is_edge_min( p ) ( (p)->flags2 & PSH_POINT_EDGE_MIN )
145#define psh_point_is_edge_max( p ) ( (p)->flags2 & PSH_POINT_EDGE_MAX )
146
147#define psh_point_set_strong( p ) (p)->flags2 |= PSH_POINT_STRONG
148#define psh_point_set_fitted( p ) (p)->flags2 |= PSH_POINT_FITTED
149#define psh_point_set_extremum( p ) (p)->flags2 |= PSH_POINT_EXTREMUM
150#define psh_point_set_positive( p ) (p)->flags2 |= PSH_POINT_POSITIVE
151#define psh_point_set_negative( p ) (p)->flags2 |= PSH_POINT_NEGATIVE
152#define psh_point_set_edge_min( p ) (p)->flags2 |= PSH_POINT_EDGE_MIN
153#define psh_point_set_edge_max( p ) (p)->flags2 |= PSH_POINT_EDGE_MAX
154
155
156 typedef struct PSH_PointRec_
157 {
169#ifdef DEBUG_HINTER
170 FT_Pos org_x;
171 FT_Pos cur_x;
172 FT_Pos org_y;
173 FT_Pos cur_y;
174 FT_UInt flags_x;
175 FT_UInt flags_y;
176#endif
177
179
180
181 typedef struct PSH_ContourRec_
182 {
185
187
188
189 typedef struct PSH_GlyphRec_
190 {
193
196
201
205
211
213
214
215#ifdef DEBUG_HINTER
216 extern PSH_Hint_Table ps_debug_hint_table;
217
218 typedef void
219 (*PSH_HintFunc)( PSH_Hint hint,
220 FT_Bool vertical );
221
222 extern PSH_HintFunc ps_debug_hint_func;
223
224 extern PSH_Glyph ps_debug_glyph;
225#endif
226
227
228 extern FT_Error
229 ps_hints_apply( PS_Hints ps_hints,
231 PSH_Globals globals,
232 FT_Render_Mode hint_mode );
233
234
236
237
238#endif /* PSHALGO_H_ */
239
240
241/* END */
enum FT_Render_Mode_ FT_Render_Mode
#define FT_END_HEADER
Definition: ftheader.h:54
#define FT_BEGIN_HEADER
Definition: ftheader.h:36
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:58
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
signed char FT_Char
Definition: fttypes.h:143
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
signed long FT_Fixed
Definition: fttypes.h:288
int FT_Error
Definition: fttypes.h:300
unsigned int FT_UInt
Definition: fttypes.h:231
signed int FT_Int
Definition: fttypes.h:220
typedefFT_BEGIN_HEADER struct PSH_GlobalsRec_ * PSH_Globals
Definition: pshints.h:41
struct PSH_ContourRec_ PSH_ContourRec
struct PSH_ZoneRec_ * PSH_Zone
struct PSH_PointRec_ PSH_PointRec
typedefFT_BEGIN_HEADER struct PSH_HintRec_ * PSH_Hint
Definition: pshalgo.h:31
struct PSH_Hint_TableRec_ * PSH_Hint_Table
struct PSH_GlyphRec_ PSH_GlyphRec
@ PSH_DIR_LEFT
Definition: pshalgo.h:101
@ PSH_DIR_UP
Definition: pshalgo.h:99
@ PSH_DIR_RIGHT
Definition: pshalgo.h:102
@ PSH_DIR_DOWN
Definition: pshalgo.h:100
@ PSH_DIR_NONE
Definition: pshalgo.h:98
struct PSH_HintRec_ PSH_HintRec
struct PSH_GlyphRec_ * PSH_Glyph
FT_Error ps_hints_apply(PS_Hints ps_hints, FT_Outline *outline, PSH_Globals globals, FT_Render_Mode hint_mode)
Definition: pshalgo.c:2070
struct PSH_PointRec_ * PSH_Point
Definition: pshalgo.h:93
struct PSH_ContourRec_ * PSH_Contour
Definition: pshalgo.h:94
struct PSH_ZoneRec_ PSH_ZoneRec
struct PSH_Hint_TableRec_ PSH_Hint_TableRec
FT_UInt count
Definition: pshalgo.h:184
PSH_Point start
Definition: pshalgo.h:183
FT_Int minor_dir
Definition: pshalgo.h:204
PSH_Point points
Definition: pshalgo.h:194
FT_Memory memory
Definition: pshalgo.h:197
FT_UInt num_points
Definition: pshalgo.h:191
FT_UInt num_contours
Definition: pshalgo.h:192
FT_Outline * outline
Definition: pshalgo.h:198
FT_Bool vertical
Definition: pshalgo.h:202
FT_Int major_dir
Definition: pshalgo.h:203
FT_Bool do_vert_snapping
Definition: pshalgo.h:209
FT_Bool do_horz_hints
Definition: pshalgo.h:206
FT_Bool do_stem_adjust
Definition: pshalgo.h:210
FT_Bool do_vert_hints
Definition: pshalgo.h:207
PSH_Contour contours
Definition: pshalgo.h:195
FT_Bool do_horz_snapping
Definition: pshalgo.h:208
PSH_Globals globals
Definition: pshalgo.h:199
PSH_Hint_TableRec hint_tables[2]
Definition: pshalgo.h:200
FT_Pos cur_pos
Definition: pshalgo.h:55
FT_UInt flags
Definition: pshalgo.h:57
FT_Int order
Definition: pshalgo.h:59
FT_Int org_pos
Definition: pshalgo.h:53
FT_Pos cur_len
Definition: pshalgo.h:56
PSH_Hint parent
Definition: pshalgo.h:58
FT_Int org_len
Definition: pshalgo.h:54
FT_UInt max_hints
Definition: pshalgo.h:79
PSH_Hint * sort_global
Definition: pshalgo.h:83
FT_UInt num_hints
Definition: pshalgo.h:80
PS_Mask_Table hint_masks
Definition: pshalgo.h:87
PSH_ZoneRec * zones
Definition: pshalgo.h:85
PSH_Hint hints
Definition: pshalgo.h:81
PSH_Hint * sort
Definition: pshalgo.h:82
PS_Mask_Table counter_masks
Definition: pshalgo.h:88
FT_UInt num_zones
Definition: pshalgo.h:84
PSH_Zone zone
Definition: pshalgo.h:86
PSH_Hint hint
Definition: pshalgo.h:165
FT_Pos org_u
Definition: pshalgo.h:166
PSH_Point prev
Definition: pshalgo.h:158
FT_UInt flags
Definition: pshalgo.h:161
FT_Char dir_out
Definition: pshalgo.h:164
FT_Pos cur_u
Definition: pshalgo.h:168
FT_Pos org_v
Definition: pshalgo.h:167
PSH_Point next
Definition: pshalgo.h:159
FT_Char dir_in
Definition: pshalgo.h:163
PSH_Contour contour
Definition: pshalgo.h:160
FT_UInt flags2
Definition: pshalgo.h:162
FT_Pos max
Definition: pshalgo.h:72
FT_Pos min
Definition: pshalgo.h:71
FT_Fixed scale
Definition: pshalgo.h:69
FT_Fixed delta
Definition: pshalgo.h:70
Definition: mesh.c:5330
DWORD hint
Definition: vfdcmd.c:88