zenilib: zenilib/jni/external/freetype2/src/truetype/ttinterp.h Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ttinterp.h
Go to the documentation of this file.
1 /***************************************************************************/
2 /* */
3 /* ttinterp.h */
4 /* */
5 /* TrueType bytecode interpreter (specification). */
6 /* */
7 /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010 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 __TTINTERP_H__
20 #define __TTINTERP_H__
21
22 #include <ft2build.h>
23 #include "ttobjs.h"
24
25
26 FT_BEGIN_HEADER
27
28
29 #ifndef TT_CONFIG_OPTION_STATIC_INTERPRETER /* indirect implementation */
30
31 #define EXEC_OP_ TT_ExecContext exc,
32 #define EXEC_OP TT_ExecContext exc
33 #define EXEC_ARG_ exc,
34 #define EXEC_ARG exc
35
36 #else /* static implementation */
37
38 #define EXEC_OP_ /* void */
39 #define EXEC_OP /* void */
40 #define EXEC_ARG_ /* void */
41 #define EXEC_ARG /* void */
42
43 #endif /* TT_CONFIG_OPTION_STATIC_INTERPRETER */
44
45
46 /*************************************************************************/
47 /* */
48 /* Rounding mode constants. */
49 /* */
50 #define TT_Round_Off 5
51 #define TT_Round_To_Half_Grid 0
52 #define TT_Round_To_Grid 1
53 #define TT_Round_To_Double_Grid 2
54 #define TT_Round_Up_To_Grid 4
55 #define TT_Round_Down_To_Grid 3
56 #define TT_Round_Super 6
57 #define TT_Round_Super_45 7
58
59
60 /*************************************************************************/
61 /* */
62 /* Function types used by the interpreter, depending on various modes */
63 /* (e.g. the rounding mode, whether to render a vertical or horizontal */
64 /* line etc). */
65 /* */
66 /*************************************************************************/
67
68 /* Rounding function */
69 typedef FT_F26Dot6
70 (*TT_Round_Func)( EXEC_OP_ FT_F26Dot6 distance,
71 FT_F26Dot6 compensation );
72
73 /* Point displacement along the freedom vector routine */
74 typedef void
75 (*TT_Move_Func)( EXEC_OP_ TT_GlyphZone zone,
76 FT_UShort point,
77 FT_F26Dot6 distance );
78
79 /* Distance projection along one of the projection vectors */
80 typedef FT_F26Dot6
81 (*TT_Project_Func)( EXEC_OP_ FT_Pos dx,
82 FT_Pos dy );
83
84 /* reading a cvt value. Take care of non-square pixels if necessary */
85 typedef FT_F26Dot6
86 (*TT_Get_CVT_Func)( EXEC_OP_ FT_ULong idx );
87
88 /* setting or moving a cvt value. Take care of non-square pixels */
89 /* if necessary */
90 typedef void
91 (*TT_Set_CVT_Func)( EXEC_OP_ FT_ULong idx,
92 FT_F26Dot6 value );
93
94
95 /*************************************************************************/
96 /* */
97 /* This structure defines a call record, used to manage function calls. */
98 /* */
99 typedef struct TT_CallRec_
100 {
101 FT_Int Caller_Range;
102 FT_Long Caller_IP;
103 FT_Long Cur_Count;
104 FT_Long Cur_Restart;
105 FT_Long Cur_End;
106
107 } TT_CallRec, *TT_CallStack;
108
109
110 /*************************************************************************/
111 /* */
112 /* The main structure for the interpreter which collects all necessary */
113 /* variables and states. */
114 /* */
115 typedef struct TT_ExecContextRec_
116 {
117 TT_Face face;
118 TT_Size size;
119 FT_Memory memory;
120
121 /* instructions state */
122
123 FT_Error error; /* last execution error */
124
125 FT_Long top; /* top of exec. stack */
126
127 FT_UInt stackSize; /* size of exec. stack */
128 FT_Long* stack; /* current exec. stack */
129
130 FT_Long args;
131 FT_UInt new_top; /* new top after exec. */
132
133 TT_GlyphZoneRec zp0, /* zone records */
134 zp1,
135 zp2,
136 pts,
137 twilight;
138
139 FT_Size_Metrics metrics;
140 TT_Size_Metrics tt_metrics; /* size metrics */
141
142 TT_GraphicsState GS; /* current graphics state */
143
144 FT_Int curRange; /* current code range number */
145 FT_Byte* code; /* current code range */
146 FT_Long IP; /* current instruction pointer */
147 FT_Long codeSize; /* size of current range */
148
149 FT_Byte opcode; /* current opcode */
150 FT_Int length; /* length of current opcode */
151
152 FT_Bool step_ins; /* true if the interpreter must */
153 /* increment IP after ins. exec */
154 FT_ULong cvtSize;
155 FT_Long* cvt;
156
157 FT_UInt glyphSize; /* glyph instructions buffer size */
158 FT_Byte* glyphIns; /* glyph instructions buffer */
159
160 FT_UInt numFDefs; /* number of function defs */
161 FT_UInt maxFDefs; /* maximum number of function defs */
162 TT_DefArray FDefs; /* table of FDefs entries */
163
164 FT_UInt numIDefs; /* number of instruction defs */
165 FT_UInt maxIDefs; /* maximum number of ins defs */
166 TT_DefArray IDefs; /* table of IDefs entries */
167
168 FT_UInt maxFunc; /* maximum function index */
169 FT_UInt maxIns; /* maximum instruction index */
170
171 FT_Int callTop, /* top of call stack during execution */
172 callSize; /* size of call stack */
173 TT_CallStack callStack; /* call stack */
174
175 FT_UShort maxPoints; /* capacity of this context's `pts' */
176 FT_Short maxContours; /* record, expressed in points and */
177 /* contours. */
178
179 TT_CodeRangeTable codeRangeTable; /* table of valid code ranges */
180 /* useful for the debugger */
181
182 FT_UShort storeSize; /* size of current storage */
183 FT_Long* storage; /* storage area */
184
185 FT_F26Dot6 period; /* values used for the */
186 FT_F26Dot6 phase; /* `SuperRounding' */
187 FT_F26Dot6 threshold;
188
189 #if 0
190 /* this seems to be unused */
191 FT_Int cur_ppem; /* ppem along the current proj vector */
192 #endif
193
194 FT_Bool instruction_trap; /* If `True', the interpreter will */
195 /* exit after each instruction */
196
197 TT_GraphicsState default_GS; /* graphics state resulting from */
198 /* the prep program */
199 FT_Bool is_composite; /* true if the glyph is composite */
200 FT_Bool pedantic_hinting; /* true if pedantic interpretation */
201
202 /* latest interpreter additions */
203
204 FT_Long F_dot_P; /* dot product of freedom and projection */
205 /* vectors */
206 TT_Round_Func func_round; /* current rounding function */
207
208 TT_Project_Func func_project, /* current projection function */
209 func_dualproj, /* current dual proj. function */
210 func_freeProj; /* current freedom proj. func */
211
212 TT_Move_Func func_move; /* current point move function */
213 TT_Move_Func func_move_orig; /* move original position function */
214
215 TT_Get_CVT_Func func_read_cvt; /* read a cvt entry */
216 TT_Set_CVT_Func func_write_cvt; /* write a cvt entry (in pixels) */
217 TT_Set_CVT_Func func_move_cvt; /* incr a cvt entry (in pixels) */
218
219 FT_Bool grayscale; /* are we hinting for grayscale? */
220
221 } TT_ExecContextRec;
222
223
224 extern const TT_GraphicsState tt_default_graphics_state;
225
226
227 FT_LOCAL( FT_Error )
228 TT_Goto_CodeRange( TT_ExecContext exec,
229 FT_Int range,
230 FT_Long IP );
231
232 FT_LOCAL( FT_Error )
233 TT_Set_CodeRange( TT_ExecContext exec,
234 FT_Int range,
235 void* base,
236 FT_Long length );
237
238 FT_LOCAL( FT_Error )
239 TT_Clear_CodeRange( TT_ExecContext exec,
240 FT_Int range );
241
242
243 FT_LOCAL( FT_Error )
244 Update_Max( FT_Memory memory,
245 FT_ULong* size,
246 FT_Long multiplier,
247 void* _pbuff,
248 FT_ULong new_max );
249
250
251 /*************************************************************************/
252 /* */
253 /* <Function> */
254 /* TT_New_Context */
255 /* */
256 /* <Description> */
257 /* Queries the face context for a given font. Note that there is */
258 /* now a _single_ execution context in the TrueType driver which is */
259 /* shared among faces. */
260 /* */
261 /* <Input> */
262 /* face :: A handle to the source face object. */
263 /* */
264 /* <Return> */
265 /* A handle to the execution context. Initialized for `face'. */
266 /* */
267 /* <Note> */
268 /* Only the glyph loader and debugger should call this function. */
269 /* */
270 FT_EXPORT( TT_ExecContext )
271 TT_New_Context( TT_Driver driver );
272
273 FT_LOCAL( FT_Error )
274 TT_Done_Context( TT_ExecContext exec );
275
276 FT_LOCAL( FT_Error )
277 TT_Load_Context( TT_ExecContext exec,
278 TT_Face face,
279 TT_Size size );
280
281 FT_LOCAL( FT_Error )
282 TT_Save_Context( TT_ExecContext exec,
283 TT_Size ins );
284
285 FT_LOCAL( FT_Error )
286 TT_Run_Context( TT_ExecContext exec,
287 FT_Bool debug );
288
289
290 /*************************************************************************/
291 /* */
292 /* <Function> */
293 /* TT_RunIns */
294 /* */
295 /* <Description> */
296 /* Executes one or more instruction in the execution context. This */
297 /* is the main function of the TrueType opcode interpreter. */
298 /* */
299 /* <Input> */
300 /* exec :: A handle to the target execution context. */
301 /* */
302 /* <Return> */
303 /* FreeType error code. 0 means success. */
304 /* */
305 /* <Note> */
306 /* Only the object manager and debugger should call this function. */
307 /* */
308 /* This function is publicly exported because it is directly */
309 /* invoked by the TrueType debugger. */
310 /* */
311 FT_EXPORT( FT_Error )
312 TT_RunIns( TT_ExecContext exec );
313
314
315 FT_END_HEADER
316
317 #endif /* __TTINTERP_H__ */
318
319
320 /* END */
ttobjs.h
tt_default_graphics_state
const TT_GraphicsState tt_default_graphics_state
FT_Error
int FT_Error
Definition: fttypes.h:296
TT_ExecContextRec_::func_move_cvt
TT_Set_CVT_Func func_move_cvt
Definition: ttinterp.h:217
TT_ExecContextRec_::func_write_cvt
TT_Set_CVT_Func func_write_cvt
Definition: ttinterp.h:216
FT_Long
signed long FT_Long
Definition: fttypes.h:238
TT_Size_Metrics_
Definition: ttobjs.h:264
FT_ULong
unsigned long FT_ULong
Definition: fttypes.h:249
TT_ExecContextRec_::glyphSize
FT_UInt glyphSize
Definition: ttinterp.h:157
FT_Pos
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:59
void
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
Definition: glew.h:1824
TT_ExecContextRec_::func_read_cvt
TT_Get_CVT_Func func_read_cvt
Definition: ttinterp.h:215
FT_END_HEADER
#define FT_END_HEADER
Definition: ftheader.h:54
TT_ExecContextRec_::zp1
TT_GlyphZoneRec zp1
Definition: ttinterp.h:133
TT_ExecContextRec_::F_dot_P
FT_Long F_dot_P
Definition: ttinterp.h:204
TT_Round_Func
FT_F26Dot6(* TT_Round_Func)(EXEC_OP_ FT_F26Dot6 distance, FT_F26Dot6 compensation)
Definition: ttinterp.h:70
FT_Int
signed int FT_Int
Definition: fttypes.h:216
TT_Load_Context
TT_Load_Context(TT_ExecContext exec, TT_Face face, TT_Size size)
TT_ExecContextRec_::IP
FT_Long IP
Definition: ttinterp.h:146
TT_ExecContextRec_::memory
FT_Memory memory
Definition: ttinterp.h:119
TT_CallRec_::Caller_Range
FT_Int Caller_Range
Definition: ttinterp.h:101
TT_ExecContextRec_::IDefs
TT_DefArray IDefs
Definition: ttinterp.h:166
TT_ExecContextRec_::args
FT_Long args
Definition: ttinterp.h:130
TT_ExecContextRec_::maxFunc
FT_UInt maxFunc
Definition: ttinterp.h:168
TT_ExecContextRec_::stack
FT_Long * stack
Definition: ttinterp.h:128
TT_ExecContextRec_::curRange
FT_Int curRange
Definition: ttinterp.h:144
TT_CallRec_::Cur_Restart
FT_Long Cur_Restart
Definition: ttinterp.h:104
TT_ExecContextRec_::phase
FT_F26Dot6 phase
Definition: ttinterp.h:186
TT_ExecContextRec_::twilight
TT_GlyphZoneRec twilight
Definition: ttinterp.h:133
TT_Driver
typedefFT_BEGIN_HEADER struct TT_DriverRec_ * TT_Driver
Definition: ttobjs.h:39
TT_New_Context
TT_New_Context(TT_Driver driver)
TT_ExecContextRec_::tt_metrics
TT_Size_Metrics tt_metrics
Definition: ttinterp.h:140
FT_Bool
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:104
TT_Goto_CodeRange
TT_Goto_CodeRange(TT_ExecContext exec, FT_Int range, FT_Long IP)
TT_Set_CVT_Func
void(* TT_Set_CVT_Func)(EXEC_OP_ FT_ULong idx, FT_F26Dot6 value)
Definition: ttinterp.h:91
TT_ExecContextRec_::codeSize
FT_Long codeSize
Definition: ttinterp.h:147
TT_Clear_CodeRange
TT_Clear_CodeRange(TT_ExecContext exec, FT_Int range)
FT_Byte
unsigned char FT_Byte
Definition: fttypes.h:150
FT_BEGIN_HEADER
#define FT_BEGIN_HEADER
Definition: ftheader.h:36
TT_ExecContextRec_
Definition: ttinterp.h:115
FT_LOCAL
#define FT_LOCAL(x)
Definition: ftconfig.h:466
TT_ExecContextRec_::top
FT_Long top
Definition: ttinterp.h:125
TT_ExecContextRec_::cvtSize
FT_ULong cvtSize
Definition: ttinterp.h:154
range
GLenum GLint * range
Definition: glew.h:3391
TT_ExecContextRec_::codeRangeTable
TT_CodeRangeTable codeRangeTable
Definition: ttinterp.h:179
TT_ExecContextRec_::maxContours
FT_Short maxContours
Definition: ttinterp.h:176
TT_ExecContextRec_::maxIDefs
FT_UInt maxIDefs
Definition: ttinterp.h:165
TT_ExecContextRec_::storage
FT_Long * storage
Definition: ttinterp.h:183
TT_Run_Context
TT_Run_Context(TT_ExecContext exec, FT_Bool debug)
TT_CallRec_::Cur_End
FT_Long Cur_End
Definition: ttinterp.h:105
TT_Move_Func
void(* TT_Move_Func)(EXEC_OP_ TT_GlyphZone zone, FT_UShort point, FT_F26Dot6 distance)
Definition: ttinterp.h:75
TT_CallRec_::Caller_IP
FT_Long Caller_IP
Definition: ttinterp.h:102
TT_ExecContextRec_::cvt
FT_Long * cvt
Definition: ttinterp.h:155
Update_Max
Update_Max(FT_Memory memory, FT_ULong *size, FT_Long multiplier, void *_pbuff, FT_ULong new_max)
TT_ExecContextRec_::numIDefs
FT_UInt numIDefs
Definition: ttinterp.h:164
TT_ExecContextRec_::step_ins
FT_Bool step_ins
Definition: ttinterp.h:152
idx
FT_UInt idx
Definition: cffcmap.c:125
TT_ExecContextRec_::period
FT_F26Dot6 period
Definition: ttinterp.h:185
length
GLsizei GLsizei * length
Definition: gl2ext.h:792
TT_ExecContextRec_::metrics
FT_Size_Metrics metrics
Definition: ttinterp.h:139
TT_GlyphZoneRec_
Definition: tttypes.h:1465
TT_ExecContextRec_::func_project
TT_Project_Func func_project
Definition: ttinterp.h:208
TT_ExecContextRec_::zp2
TT_GlyphZoneRec zp2
Definition: ttinterp.h:133
TT_ExecContextRec_::error
FT_Error error
Definition: ttinterp.h:123
TT_ExecContextRec_::threshold
FT_F26Dot6 threshold
Definition: ttinterp.h:187
face
GLenum face
Definition: gl2ext.h:1490
TT_CallRec_
Definition: ttinterp.h:99
TT_Get_CVT_Func
FT_F26Dot6(* TT_Get_CVT_Func)(EXEC_OP_ FT_ULong idx)
Definition: ttinterp.h:86
TT_ExecContextRec_::func_dualproj
TT_Project_Func func_dualproj
Definition: ttinterp.h:208
distance
GLsizei GLsizei GLfloat distance
Definition: glew.h:12423
TT_CallRec_::Cur_Count
FT_Long Cur_Count
Definition: ttinterp.h:103
TT_GraphicsState_
Definition: ttobjs.h:76
TT_Project_Func
FT_F26Dot6(* TT_Project_Func)(EXEC_OP_ FT_Pos dx, FT_Pos dy)
Definition: ttinterp.h:81
TT_Save_Context
TT_Save_Context(TT_ExecContext exec, TT_Size ins)
TT_CodeRangeTable
TT_CodeRange TT_CodeRangeTable[TT_MAX_CODE_RANGES]
Definition: ttobjs.h:167
TT_ExecContextRec_::callTop
FT_Int callTop
Definition: ttinterp.h:171
TT_ExecContextRec_::length
FT_Int length
Definition: ttinterp.h:150
TT_ExecContextRec_::grayscale
FT_Bool grayscale
Definition: ttinterp.h:219
TT_ExecContextRec_::storeSize
FT_UShort storeSize
Definition: ttinterp.h:182
TT_CallStack
struct TT_CallRec_ * TT_CallStack
FT_Short
signed short FT_Short
Definition: fttypes.h:194
FT_Memory
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
TT_ExecContextRec_::pedantic_hinting
FT_Bool pedantic_hinting
Definition: ttinterp.h:200
TT_ExecContextRec_::opcode
FT_Byte opcode
Definition: ttinterp.h:149
TT_SizeRec_
Definition: ttobjs.h:288
FT_F26Dot6
signed long FT_F26Dot6
Definition: fttypes.h:272
TT_ExecContextRec_::func_round
TT_Round_Func func_round
Definition: ttinterp.h:206
TT_ExecContextRec_::maxIns
FT_UInt maxIns
Definition: ttinterp.h:169
TT_ExecContextRec_::maxPoints
FT_UShort maxPoints
Definition: ttinterp.h:175
value
EGLSurface EGLint void ** value
Definition: eglext.h:301
ft2build.h
TT_ExecContextRec_::callSize
FT_Int callSize
Definition: ttinterp.h:171
TT_ExecContextRec_::maxFDefs
FT_UInt maxFDefs
Definition: ttinterp.h:161
TT_ExecContextRec_::GS
TT_GraphicsState GS
Definition: ttinterp.h:142
FT_UInt
unsigned int FT_UInt
Definition: fttypes.h:227
TT_ExecContextRec_::size
TT_Size size
Definition: ttinterp.h:118
FT_EXPORT
#define FT_EXPORT(x)
Definition: ftconfig.h:500
TT_ExecContextRec_::is_composite
FT_Bool is_composite
Definition: ttinterp.h:199
FT_Size_Metrics_
Definition: freetype.h:1360
TT_Done_Context
TT_Done_Context(TT_ExecContext exec)
TT_ExecContextRec_::FDefs
TT_DefArray FDefs
Definition: ttinterp.h:162
TT_ExecContextRec_::new_top
FT_UInt new_top
Definition: ttinterp.h:131
TT_ExecContextRec_::func_move
TT_Move_Func func_move
Definition: ttinterp.h:212
TT_DefRecord_
Definition: ttobjs.h:174
TT_ExecContextRec_::numFDefs
FT_UInt numFDefs
Definition: ttinterp.h:160
TT_ExecContextRec_::glyphIns
FT_Byte * glyphIns
Definition: ttinterp.h:158
FT_UShort
unsigned short FT_UShort
Definition: fttypes.h:205
TT_ExecContextRec_::default_GS
TT_GraphicsState default_GS
Definition: ttinterp.h:197
TT_ExecContextRec_::zp0
TT_GlyphZoneRec zp0
Definition: ttinterp.h:133
TT_ExecContextRec_::func_move_orig
TT_Move_Func func_move_orig
Definition: ttinterp.h:213
TT_FaceRec_
Definition: tttypes.h:1258
TT_ExecContextRec_::func_freeProj
TT_Project_Func func_freeProj
Definition: ttinterp.h:208
TT_ExecContextRec_::code
FT_Byte * code
Definition: ttinterp.h:145
TT_ExecContextRec_::callStack
TT_CallStack callStack
Definition: ttinterp.h:173
TT_ExecContextRec_::face
TT_Face face
Definition: ttinterp.h:117
TT_ExecContextRec_::pts
TT_GlyphZoneRec pts
Definition: ttinterp.h:133
TT_ExecContextRec
struct TT_ExecContextRec_ TT_ExecContextRec
TT_Set_CodeRange
TT_Set_CodeRange(TT_ExecContext exec, FT_Int range, void *base, FT_Long length)
TT_ExecContextRec_::stackSize
FT_UInt stackSize
Definition: ttinterp.h:127
TT_CallRec
struct TT_CallRec_ TT_CallRec
TT_ExecContextRec_::instruction_trap
FT_Bool instruction_trap
Definition: ttinterp.h:194
EXEC_OP_
#define EXEC_OP_
Definition: ttinterp.h:31
size
GLsizei size
Definition: gl2ext.h:1467
TT_RunIns
TT_RunIns(TT_ExecContext exec)