OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* ttinterp.h */ | 3 /* ttinterp.h */ |
4 /* */ | 4 /* */ |
5 /* TrueType bytecode interpreter (specification). */ | 5 /* TrueType bytecode interpreter (specification). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 1996-2007, 2010, 2012-2014 by */ | 7 /* Copyright 1996-2015 by */ |
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
9 /* */ | 9 /* */ |
10 /* This file is part of the FreeType project, and may only be used, */ | 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 */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
15 /* */ | 15 /* */ |
16 /***************************************************************************/ | 16 /***************************************************************************/ |
17 | 17 |
18 | 18 |
19 #ifndef __TTINTERP_H__ | 19 #ifndef __TTINTERP_H__ |
20 #define __TTINTERP_H__ | 20 #define __TTINTERP_H__ |
21 | 21 |
22 #include <ft2build.h> | 22 #include <ft2build.h> |
23 #include "ttobjs.h" | 23 #include "ttobjs.h" |
24 | 24 |
25 | 25 |
26 FT_BEGIN_HEADER | 26 FT_BEGIN_HEADER |
27 | 27 |
28 | 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 /*************************************************************************/ | 29 /*************************************************************************/ |
47 /* */ | 30 /* */ |
48 /* Rounding mode constants. */ | 31 /* Rounding mode constants. */ |
49 /* */ | 32 /* */ |
50 #define TT_Round_Off 5 | 33 #define TT_Round_Off 5 |
51 #define TT_Round_To_Half_Grid 0 | 34 #define TT_Round_To_Half_Grid 0 |
52 #define TT_Round_To_Grid 1 | 35 #define TT_Round_To_Grid 1 |
53 #define TT_Round_To_Double_Grid 2 | 36 #define TT_Round_To_Double_Grid 2 |
54 #define TT_Round_Up_To_Grid 4 | 37 #define TT_Round_Up_To_Grid 4 |
55 #define TT_Round_Down_To_Grid 3 | 38 #define TT_Round_Down_To_Grid 3 |
56 #define TT_Round_Super 6 | 39 #define TT_Round_Super 6 |
57 #define TT_Round_Super_45 7 | 40 #define TT_Round_Super_45 7 |
58 | 41 |
59 | 42 |
60 /*************************************************************************/ | 43 /*************************************************************************/ |
61 /* */ | 44 /* */ |
62 /* Function types used by the interpreter, depending on various modes */ | 45 /* Function types used by the interpreter, depending on various modes */ |
63 /* (e.g. the rounding mode, whether to render a vertical or horizontal */ | 46 /* (e.g. the rounding mode, whether to render a vertical or horizontal */ |
64 /* line etc). */ | 47 /* line etc). */ |
65 /* */ | 48 /* */ |
66 /*************************************************************************/ | 49 /*************************************************************************/ |
67 | 50 |
68 /* Rounding function */ | 51 /* Rounding function */ |
69 typedef FT_F26Dot6 | 52 typedef FT_F26Dot6 |
70 (*TT_Round_Func)( EXEC_OP_ FT_F26Dot6 distance, | 53 (*TT_Round_Func)( TT_ExecContext exc, |
71 FT_F26Dot6 compensation ); | 54 FT_F26Dot6 distance, |
| 55 FT_F26Dot6 compensation ); |
72 | 56 |
73 /* Point displacement along the freedom vector routine */ | 57 /* Point displacement along the freedom vector routine */ |
74 typedef void | 58 typedef void |
75 (*TT_Move_Func)( EXEC_OP_ TT_GlyphZone zone, | 59 (*TT_Move_Func)( TT_ExecContext exc, |
76 FT_UShort point, | 60 TT_GlyphZone zone, |
77 FT_F26Dot6 distance ); | 61 FT_UShort point, |
| 62 FT_F26Dot6 distance ); |
78 | 63 |
79 /* Distance projection along one of the projection vectors */ | 64 /* Distance projection along one of the projection vectors */ |
80 typedef FT_F26Dot6 | 65 typedef FT_F26Dot6 |
81 (*TT_Project_Func)( EXEC_OP_ FT_Pos dx, | 66 (*TT_Project_Func)( TT_ExecContext exc, |
82 FT_Pos dy ); | 67 FT_Pos dx, |
| 68 FT_Pos dy ); |
83 | 69 |
84 /* getting current ppem. Take care of non-square pixels if necessary */ | 70 /* getting current ppem. Take care of non-square pixels if necessary */ |
85 typedef FT_Long | 71 typedef FT_Long |
86 (*TT_Cur_Ppem_Func)( EXEC_OP ); | 72 (*TT_Cur_Ppem_Func)( TT_ExecContext exc ); |
87 | 73 |
88 /* reading a cvt value. Take care of non-square pixels if necessary */ | 74 /* reading a cvt value. Take care of non-square pixels if necessary */ |
89 typedef FT_F26Dot6 | 75 typedef FT_F26Dot6 |
90 (*TT_Get_CVT_Func)( EXEC_OP_ FT_ULong idx ); | 76 (*TT_Get_CVT_Func)( TT_ExecContext exc, |
| 77 FT_ULong idx ); |
91 | 78 |
92 /* setting or moving a cvt value. Take care of non-square pixels */ | 79 /* setting or moving a cvt value. Take care of non-square pixels */ |
93 /* if necessary */ | 80 /* if necessary */ |
94 typedef void | 81 typedef void |
95 (*TT_Set_CVT_Func)( EXEC_OP_ FT_ULong idx, | 82 (*TT_Set_CVT_Func)( TT_ExecContext exc, |
96 FT_F26Dot6 value ); | 83 FT_ULong idx, |
| 84 FT_F26Dot6 value ); |
97 | 85 |
98 | 86 |
99 /*************************************************************************/ | 87 /*************************************************************************/ |
100 /* */ | 88 /* */ |
101 /* This structure defines a call record, used to manage function calls. */ | 89 /* This structure defines a call record, used to manage function calls. */ |
102 /* */ | 90 /* */ |
103 typedef struct TT_CallRec_ | 91 typedef struct TT_CallRec_ |
104 { | 92 { |
105 FT_Int Caller_Range; | 93 FT_Int Caller_Range; |
106 FT_Long Caller_IP; | 94 FT_Long Caller_IP; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 TT_Face face; | 151 TT_Face face; |
164 TT_Size size; | 152 TT_Size size; |
165 FT_Memory memory; | 153 FT_Memory memory; |
166 | 154 |
167 /* instructions state */ | 155 /* instructions state */ |
168 | 156 |
169 FT_Error error; /* last execution error */ | 157 FT_Error error; /* last execution error */ |
170 | 158 |
171 FT_Long top; /* top of exec. stack */ | 159 FT_Long top; /* top of exec. stack */ |
172 | 160 |
173 FT_UInt stackSize; /* size of exec. stack */ | 161 FT_Long stackSize; /* size of exec. stack */ |
174 FT_Long* stack; /* current exec. stack */ | 162 FT_Long* stack; /* current exec. stack */ |
175 | 163 |
176 FT_Long args; | 164 FT_Long args; |
177 FT_UInt new_top; /* new top after exec. */ | 165 FT_Long new_top; /* new top after exec. */ |
178 | 166 |
179 TT_GlyphZoneRec zp0, /* zone records */ | 167 TT_GlyphZoneRec zp0, /* zone records */ |
180 zp1, | 168 zp1, |
181 zp2, | 169 zp2, |
182 pts, | 170 pts, |
183 twilight; | 171 twilight; |
184 | 172 |
185 FT_Size_Metrics metrics; | 173 FT_Size_Metrics metrics; |
186 TT_Size_Metrics tt_metrics; /* size metrics */ | 174 TT_Size_Metrics tt_metrics; /* size metrics */ |
187 | 175 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 245 |
258 TT_Get_CVT_Func func_read_cvt; /* read a cvt entry */ | 246 TT_Get_CVT_Func func_read_cvt; /* read a cvt entry */ |
259 TT_Set_CVT_Func func_write_cvt; /* write a cvt entry (in pixels) */ | 247 TT_Set_CVT_Func func_write_cvt; /* write a cvt entry (in pixels) */ |
260 TT_Set_CVT_Func func_move_cvt; /* incr a cvt entry (in pixels) */ | 248 TT_Set_CVT_Func func_move_cvt; /* incr a cvt entry (in pixels) */ |
261 | 249 |
262 FT_Bool grayscale; /* are we hinting for grayscale? */ | 250 FT_Bool grayscale; /* are we hinting for grayscale? */ |
263 | 251 |
264 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING | 252 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING |
265 TT_Round_Func func_round_sphn; /* subpixel rounding function */ | 253 TT_Round_Func func_round_sphn; /* subpixel rounding function */ |
266 | 254 |
267 FT_Bool subpixel; /* Using subpixel hinting? */ | 255 FT_Bool subpixel_hinting; /* Using subpixel hinting? */ |
268 FT_Bool ignore_x_mode; /* Standard rendering mode for */ | 256 FT_Bool ignore_x_mode; /* Standard rendering mode for */ |
269 /* subpixel hinting. On if gray */ | 257 /* subpixel hinting. On if gray */ |
270 /* or subpixel hinting is on. */ | 258 /* or subpixel hinting is on. */ |
271 | 259 |
272 /* The following 4 aren't fully implemented but here for MS rasterizer */ | 260 /* The following 6 aren't fully implemented but here for MS rasterizer */ |
273 /* compatibility. */ | 261 /* compatibility. */ |
274 FT_Bool compatible_widths; /* compatible widths? */ | 262 FT_Bool compatible_widths; /* compatible widths? */ |
275 FT_Bool symmetrical_smoothing; /* symmetrical_smoothing? */ | 263 FT_Bool symmetrical_smoothing; /* symmetrical_smoothing? */ |
276 FT_Bool bgr; /* bgr instead of rgb? */ | 264 FT_Bool bgr; /* bgr instead of rgb? */ |
| 265 FT_Bool vertical_lcd; /* long side of LCD subpixel */ |
| 266 /* rectangles is horizontal */ |
277 FT_Bool subpixel_positioned; /* subpixel positioned */ | 267 FT_Bool subpixel_positioned; /* subpixel positioned */ |
278 /* (DirectWrite ClearType)? */ | 268 /* (DirectWrite ClearType)? */ |
| 269 FT_Bool gray_cleartype; /* ClearType hinting but */ |
| 270 /* grayscale rendering */ |
279 | 271 |
280 FT_Int rasterizer_version; /* MS rasterizer version */ | 272 FT_Int rasterizer_version; /* MS rasterizer version */ |
281 | 273 |
282 FT_Bool iup_called; /* IUP called for glyph? */ | 274 FT_Bool iup_called; /* IUP called for glyph? */ |
283 | 275 |
284 FT_ULong sph_tweak_flags; /* flags to control */ | 276 FT_ULong sph_tweak_flags; /* flags to control */ |
285 /* hint tweaks */ | 277 /* hint tweaks */ |
286 | 278 |
287 FT_ULong sph_in_func_flags; /* flags to indicate if in */ | 279 FT_ULong sph_in_func_flags; /* flags to indicate if in */ |
288 /* special functions */ | 280 /* special functions */ |
(...skipping 19 matching lines...) Expand all Loading... |
308 FT_Long length ); | 300 FT_Long length ); |
309 | 301 |
310 FT_LOCAL( void ) | 302 FT_LOCAL( void ) |
311 TT_Clear_CodeRange( TT_ExecContext exec, | 303 TT_Clear_CodeRange( TT_ExecContext exec, |
312 FT_Int range ); | 304 FT_Int range ); |
313 | 305 |
314 | 306 |
315 FT_LOCAL( FT_Error ) | 307 FT_LOCAL( FT_Error ) |
316 Update_Max( FT_Memory memory, | 308 Update_Max( FT_Memory memory, |
317 FT_ULong* size, | 309 FT_ULong* size, |
318 FT_Long multiplier, | 310 FT_ULong multiplier, |
319 void* _pbuff, | 311 void* _pbuff, |
320 FT_ULong new_max ); | 312 FT_ULong new_max ); |
321 #endif /* TT_USE_BYTECODE_INTERPRETER */ | 313 #endif /* TT_USE_BYTECODE_INTERPRETER */ |
322 | 314 |
323 | 315 |
324 /*************************************************************************/ | 316 /*************************************************************************/ |
325 /* */ | 317 /* */ |
326 /* <Function> */ | 318 /* <Function> */ |
327 /* TT_New_Context */ | 319 /* TT_New_Context */ |
328 /* */ | 320 /* */ |
329 /* <Description> */ | 321 /* <Description> */ |
330 /* Queries the face context for a given font. Note that there is */ | 322 /* Queries the face context for a given font. Note that there is */ |
331 /* now a _single_ execution context in the TrueType driver which is */ | 323 /* now a _single_ execution context in the TrueType driver which is */ |
332 /* shared among faces. */ | 324 /* shared among faces. */ |
333 /* */ | 325 /* */ |
334 /* <Input> */ | 326 /* <Input> */ |
335 /* face :: A handle to the source face object. */ | 327 /* face :: A handle to the source face object. */ |
336 /* */ | 328 /* */ |
337 /* <Return> */ | 329 /* <Return> */ |
338 /* A handle to the execution context. Initialized for `face'. */ | 330 /* A handle to the execution context. Initialized for `face'. */ |
339 /* */ | 331 /* */ |
340 /* <Note> */ | 332 /* <Note> */ |
341 /* Only the glyph loader and debugger should call this function. */ | 333 /* Only the glyph loader and debugger should call this function. */ |
| 334 /* (And right now only the glyph loader uses it.) */ |
342 /* */ | 335 /* */ |
343 FT_EXPORT( TT_ExecContext ) | 336 FT_EXPORT( TT_ExecContext ) |
344 TT_New_Context( TT_Driver driver ); | 337 TT_New_Context( TT_Driver driver ); |
345 | 338 |
346 | 339 |
347 #ifdef TT_USE_BYTECODE_INTERPRETER | 340 #ifdef TT_USE_BYTECODE_INTERPRETER |
348 FT_LOCAL( void ) | 341 FT_LOCAL( void ) |
349 TT_Done_Context( TT_ExecContext exec ); | 342 TT_Done_Context( TT_ExecContext exec ); |
350 | 343 |
351 FT_LOCAL( FT_Error ) | 344 FT_LOCAL( FT_Error ) |
352 TT_Load_Context( TT_ExecContext exec, | 345 TT_Load_Context( TT_ExecContext exec, |
353 TT_Face face, | 346 TT_Face face, |
354 TT_Size size ); | 347 TT_Size size ); |
355 | 348 |
356 FT_LOCAL( void ) | 349 FT_LOCAL( void ) |
357 TT_Save_Context( TT_ExecContext exec, | 350 TT_Save_Context( TT_ExecContext exec, |
358 TT_Size ins ); | 351 TT_Size ins ); |
359 | 352 |
360 FT_LOCAL( FT_Error ) | 353 FT_LOCAL( FT_Error ) |
361 TT_Run_Context( TT_ExecContext exec, | 354 TT_Run_Context( TT_ExecContext exec ); |
362 FT_Bool debug ); | |
363 #endif /* TT_USE_BYTECODE_INTERPRETER */ | 355 #endif /* TT_USE_BYTECODE_INTERPRETER */ |
364 | 356 |
365 | 357 |
366 /*************************************************************************/ | 358 /*************************************************************************/ |
367 /* */ | 359 /* */ |
368 /* <Function> */ | 360 /* <Function> */ |
369 /* TT_RunIns */ | 361 /* TT_RunIns */ |
370 /* */ | 362 /* */ |
371 /* <Description> */ | 363 /* <Description> */ |
372 /* Executes one or more instruction in the execution context. This */ | 364 /* Executes one or more instruction in the execution context. This */ |
(...skipping 14 matching lines...) Expand all Loading... |
387 FT_EXPORT( FT_Error ) | 379 FT_EXPORT( FT_Error ) |
388 TT_RunIns( TT_ExecContext exec ); | 380 TT_RunIns( TT_ExecContext exec ); |
389 | 381 |
390 | 382 |
391 FT_END_HEADER | 383 FT_END_HEADER |
392 | 384 |
393 #endif /* __TTINTERP_H__ */ | 385 #endif /* __TTINTERP_H__ */ |
394 | 386 |
395 | 387 |
396 /* END */ | 388 /* END */ |
OLD | NEW |