ReactOS  0.4.14-dev-358-gbef841c
ttobjs.h
Go to the documentation of this file.
1 /***************************************************************************/
2 /* */
3 /* ttobjs.h */
4 /* */
5 /* Objects manager (specification). */
6 /* */
7 /* Copyright 1996-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 TTOBJS_H_
20 #define TTOBJS_H_
21 
22 
23 #include <ft2build.h>
24 #include FT_INTERNAL_OBJECTS_H
25 #include FT_INTERNAL_TRUETYPE_TYPES_H
26 
27 
29 
30 
31  /*************************************************************************/
32  /* */
33  /* <Type> */
34  /* TT_Driver */
35  /* */
36  /* <Description> */
37  /* A handle to a TrueType driver object. */
38  /* */
39  typedef struct TT_DriverRec_* TT_Driver;
40 
41 
42  /*************************************************************************/
43  /* */
44  /* <Type> */
45  /* TT_GlyphSlot */
46  /* */
47  /* <Description> */
48  /* A handle to a TrueType glyph slot object. */
49  /* */
50  /* <Note> */
51  /* This is a direct typedef of FT_GlyphSlot, as there is nothing */
52  /* specific about the TrueType glyph slot. */
53  /* */
55 
56 
57  /*************************************************************************/
58  /* */
59  /* <Struct> */
60  /* TT_GraphicsState */
61  /* */
62  /* <Description> */
63  /* The TrueType graphics state used during bytecode interpretation. */
64  /* */
65  typedef struct TT_GraphicsState_
66  {
70 
74 
78 
85 
87  /* According to Greg Hitchcock from Microsoft, the `scan_control' */
88  /* variable as documented in the TrueType specification is a 32-bit */
89  /* integer; the high-word part holds the SCANTYPE value, the low-word */
90  /* part the SCANCTRL value. We separate it into two fields. */
93 
97 
99 
100 
101 #ifdef TT_USE_BYTECODE_INTERPRETER
102 
103  FT_LOCAL( void )
104  tt_glyphzone_done( TT_GlyphZone zone );
105 
106  FT_LOCAL( FT_Error )
107  tt_glyphzone_new( FT_Memory memory,
108  FT_UShort maxPoints,
109  FT_Short maxContours,
110  TT_GlyphZone zone );
111 
112 #endif /* TT_USE_BYTECODE_INTERPRETER */
113 
114 
115 
116  /*************************************************************************/
117  /* */
118  /* EXECUTION SUBTABLES */
119  /* */
120  /* These sub-tables relate to instruction execution. */
121  /* */
122  /*************************************************************************/
123 
124 
125 #define TT_MAX_CODE_RANGES 3
126 
127 
128  /*************************************************************************/
129  /* */
130  /* There can only be 3 active code ranges at once: */
131  /* - the Font Program */
132  /* - the CVT Program */
133  /* - a glyph's instructions set */
134  /* */
135  typedef enum TT_CodeRange_Tag_
136  {
141 
143 
144 
145  typedef struct TT_CodeRange_
146  {
149 
150  } TT_CodeRange;
151 
153 
154 
155  /*************************************************************************/
156  /* */
157  /* Defines a function/instruction definition record. */
158  /* */
159  typedef struct TT_DefRecord_
160  {
161  FT_Int range; /* in which code range is it located? */
162  FT_Long start; /* where does it start? */
163  FT_Long end; /* where does it end? */
164  FT_UInt opc; /* function #, or instruction code */
165  FT_Bool active; /* is it active? */
166  FT_Bool inline_delta; /* is function that defines inline delta? */
167  FT_ULong sph_fdef_flags; /* flags to identify special functions */
168 
170 
171 
172  /*************************************************************************/
173  /* */
174  /* Subglyph transformation record. */
175  /* */
176  typedef struct TT_Transform_
177  {
178  FT_Fixed xx, xy; /* transformation matrix coefficients */
180  FT_F26Dot6 ox, oy; /* offsets */
181 
182  } TT_Transform;
183 
184 
185  /*************************************************************************/
186  /* */
187  /* A note regarding non-squared pixels: */
188  /* */
189  /* (This text will probably go into some docs at some time; for now, it */
190  /* is kept here to explain some definitions in the TT_Size_Metrics */
191  /* record). */
192  /* */
193  /* The CVT is a one-dimensional array containing values that control */
194  /* certain important characteristics in a font, like the height of all */
195  /* capitals, all lowercase letter, default spacing or stem width/height. */
196  /* */
197  /* These values are found in FUnits in the font file, and must be scaled */
198  /* to pixel coordinates before being used by the CVT and glyph programs. */
199  /* Unfortunately, when using distinct x and y resolutions (or distinct x */
200  /* and y pointsizes), there are two possible scalings. */
201  /* */
202  /* A first try was to implement a `lazy' scheme where all values were */
203  /* scaled when first used. However, while some values are always used */
204  /* in the same direction, some others are used under many different */
205  /* circumstances and orientations. */
206  /* */
207  /* I have found a simpler way to do the same, and it even seems to work */
208  /* in most of the cases: */
209  /* */
210  /* - All CVT values are scaled to the maximum ppem size. */
211  /* */
212  /* - When performing a read or write in the CVT, a ratio factor is used */
213  /* to perform adequate scaling. Example: */
214  /* */
215  /* x_ppem = 14 */
216  /* y_ppem = 10 */
217  /* */
218  /* We choose ppem = x_ppem = 14 as the CVT scaling size. All cvt */
219  /* entries are scaled to it. */
220  /* */
221  /* x_ratio = 1.0 */
222  /* y_ratio = y_ppem/ppem (< 1.0) */
223  /* */
224  /* We compute the current ratio like: */
225  /* */
226  /* - If projVector is horizontal, */
227  /* ratio = x_ratio = 1.0 */
228  /* */
229  /* - if projVector is vertical, */
230  /* ratio = y_ratio */
231  /* */
232  /* - else, */
233  /* ratio = sqrt( (proj.x * x_ratio) ^ 2 + (proj.y * y_ratio) ^ 2 ) */
234  /* */
235  /* Reading a cvt value returns */
236  /* ratio * cvt[index] */
237  /* */
238  /* Writing a cvt value in pixels: */
239  /* cvt[index] / ratio */
240  /* */
241  /* The current ppem is simply */
242  /* ratio * ppem */
243  /* */
244  /*************************************************************************/
245 
246 
247  /*************************************************************************/
248  /* */
249  /* Metrics used by the TrueType size and context objects. */
250  /* */
251  typedef struct TT_Size_Metrics_
252  {
253  /* for non-square pixels */
256 
257  FT_UShort ppem; /* maximum ppem size */
258  FT_Long ratio; /* current ratio */
260 
261  FT_F26Dot6 compensations[4]; /* device-specific compensations */
262 
264 
265  FT_Bool rotated; /* `is the glyph rotated?'-flag */
266  FT_Bool stretched; /* `is the glyph stretched?'-flag */
267 
268  } TT_Size_Metrics;
269 
270 
271  /*************************************************************************/
272  /* */
273  /* TrueType size class. */
274  /* */
275  typedef struct TT_SizeRec_
276  {
278 
279  /* we have our own copy of metrics so that we can modify */
280  /* it without affecting auto-hinting (when used) */
281  FT_Size_Metrics* metrics; /* for the current rendering mode */
282  FT_Size_Metrics hinted_metrics; /* for the hinted rendering mode */
283 
285 
286  FT_ULong strike_index; /* 0xFFFFFFFF to indicate invalid */
287 
288 #ifdef TT_USE_BYTECODE_INTERPRETER
289 
290  FT_Long point_size; /* for the `MPS' bytecode instruction */
291 
292  FT_UInt num_function_defs; /* number of function definitions */
293  FT_UInt max_function_defs;
294  TT_DefArray function_defs; /* table of function definitions */
295 
296  FT_UInt num_instruction_defs; /* number of ins. definitions */
297  FT_UInt max_instruction_defs;
298  TT_DefArray instruction_defs; /* table of ins. definitions */
299 
300  FT_UInt max_func;
301  FT_UInt max_ins;
302 
303  TT_CodeRangeTable codeRangeTable;
304 
306 
307  FT_ULong cvt_size; /* the scaled control value table */
308  FT_Long* cvt;
309 
310  FT_UShort storage_size; /* The storage area is now part of */
311  FT_Long* storage; /* the instance */
312 
313  TT_GlyphZoneRec twilight; /* The instance's twilight zone */
314 
316 
317  /* if negative, `fpgm' (resp. `prep'), wasn't executed yet; */
318  /* otherwise it is the returned error code */
319  FT_Error bytecode_ready;
320  FT_Error cvt_ready;
321 
322 #endif /* TT_USE_BYTECODE_INTERPRETER */
323 
324  } TT_SizeRec;
325 
326 
327  /*************************************************************************/
328  /* */
329  /* TrueType driver class. */
330  /* */
331  typedef struct TT_DriverRec_
332  {
334 
335  TT_GlyphZoneRec zone; /* glyph loader points zone */
336 
338 
339  } TT_DriverRec;
340 
341 
342  /* Note: All of the functions below (except tt_size_reset()) are used */
343  /* as function pointers in a FT_Driver_ClassRec. Therefore their */
344  /* parameters are of types FT_Face, FT_Size, etc., rather than TT_Face, */
345  /* TT_Size, etc., so that the compiler can confirm that the types and */
346  /* number of parameters are correct. In all cases the FT_xxx types are */
347  /* cast to their TT_xxx counterparts inside the functions since FreeType */
348  /* will always use the TT driver to create them. */
349 
350 
351  /*************************************************************************/
352  /* */
353  /* Face functions */
354  /* */
355  FT_LOCAL( FT_Error )
357  FT_Face ttface, /* TT_Face */
358  FT_Int face_index,
359  FT_Int num_params,
360  FT_Parameter* params );
361 
362  FT_LOCAL( void )
363  tt_face_done( FT_Face ttface ); /* TT_Face */
364 
365 
366  /*************************************************************************/
367  /* */
368  /* Size functions */
369  /* */
370  FT_LOCAL( FT_Error )
371  tt_size_init( FT_Size ttsize ); /* TT_Size */
372 
373  FT_LOCAL( void )
374  tt_size_done( FT_Size ttsize ); /* TT_Size */
375 
376 #ifdef TT_USE_BYTECODE_INTERPRETER
377 
378  FT_LOCAL( FT_Error )
379  tt_size_run_fpgm( TT_Size size,
380  FT_Bool pedantic );
381 
382  FT_LOCAL( FT_Error )
383  tt_size_run_prep( TT_Size size,
384  FT_Bool pedantic );
385 
386  FT_LOCAL( FT_Error )
387  tt_size_ready_bytecode( TT_Size size,
388  FT_Bool pedantic );
389 
390 #endif /* TT_USE_BYTECODE_INTERPRETER */
391 
392  FT_LOCAL( FT_Error )
394  FT_Bool only_height );
395 
396 
397  /*************************************************************************/
398  /* */
399  /* Driver functions */
400  /* */
401  FT_LOCAL( FT_Error )
402  tt_driver_init( FT_Module ttdriver ); /* TT_Driver */
403 
404  FT_LOCAL( void )
405  tt_driver_done( FT_Module ttdriver ); /* TT_Driver */
406 
407 
408  /*************************************************************************/
409  /* */
410  /* Slot functions */
411  /* */
412  FT_LOCAL( FT_Error )
414 
415 
416  /* auxiliary */
417 #define IS_HINTED( flags ) ( ( flags & FT_LOAD_NO_HINTING ) == 0 )
418 
419 
421 
422 #endif /* TTOBJS_H_ */
423 
424 
425 /* END */
FT_F26Dot6 control_value_cutin
Definition: ttobjs.h:80
enum TT_CodeRange_Tag_ TT_CodeRange_Tag
FT_F26Dot6 minimum_distance
Definition: ttobjs.h:76
int FT_Error
Definition: fttypes.h:300
FT_Long size
Definition: ttobjs.h:148
FT_Int scan_type
Definition: ttobjs.h:92
signed long FT_Long
Definition: fttypes.h:242
unsigned long FT_ULong
Definition: fttypes.h:253
struct TT_Transform_ TT_Transform
FT_Fixed scale
Definition: ttobjs.h:259
#define FT_END_HEADER
Definition: ftheader.h:54
FT_ULong sph_fdef_flags
Definition: ttobjs.h:167
Definition: http.c:6587
FT_UInt interpreter_version
Definition: ttobjs.h:337
FT_SizeRec root
Definition: ttobjs.h:277
signed int FT_Int
Definition: fttypes.h:220
FT_Fixed yx
Definition: ttobjs.h:179
FT_F26Dot6 single_width_value
Definition: ttobjs.h:82
FT_F26Dot6 compensations[4]
Definition: ttobjs.h:261
FT_Byte instruct_control
Definition: ttobjs.h:86
FT_UnitVector dualVector
Definition: ttobjs.h:71
FT_F26Dot6 single_width_cutin
Definition: ttobjs.h:81
typedefFT_BEGIN_HEADER struct TT_DriverRec_ * TT_Driver
Definition: ttobjs.h:39
tt_slot_init(FT_GlyphSlot slot)
Definition: ttobjs.c:1416
FT_Int range
Definition: ttobjs.h:161
static char memory[1024 *256]
Definition: process.c:116
tt_face_init(FT_Stream stream, FT_Face ttface, FT_Int face_index, FT_Int num_params, FT_Parameter *params)
Definition: ttobjs.c:578
FT_UInt opc
Definition: ttobjs.h:164
FT_Bool valid
Definition: ttobjs.h:263
struct TT_DriverRec_ TT_DriverRec
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
FT_GlyphSlot TT_GlyphSlot
Definition: ttobjs.h:54
struct TT_DefRecord_ TT_DefRecord
FT_UShort delta_shift
Definition: ttobjs.h:84
GLenum const GLfloat * params
Definition: glext.h:5645
FT_Long ratio
Definition: ttobjs.h:258
unsigned char FT_Byte
Definition: fttypes.h:154
#define FT_BEGIN_HEADER
Definition: ftheader.h:36
FT_Byte * base
Definition: ttobjs.h:147
FT_Fixed xx
Definition: ttobjs.h:178
#define FT_LOCAL(x)
Definition: ftconfig.h:387
struct TT_GraphicsState_ TT_GraphicsState
FT_UnitVector projVector
Definition: ttobjs.h:72
FT_Bool rotated
Definition: ttobjs.h:265
FT_Bool scan_control
Definition: ttobjs.h:91
FT_DriverRec root
Definition: ttobjs.h:333
FT_UShort rp1
Definition: ttobjs.h:68
FT_Int round_state
Definition: ttobjs.h:77
FT_Bool auto_flip
Definition: ttobjs.h:79
GLsizeiptr size
Definition: glext.h:5919
FT_UShort gep0
Definition: ttobjs.h:94
FT_Bool stretched
Definition: ttobjs.h:266
TT_Size_Metrics ttmetrics
Definition: ttobjs.h:284
FT_UShort rp0
Definition: ttobjs.h:67
TT_CodeRange_Tag_
Definition: ttobjs.h:135
FT_Size_Metrics * metrics
Definition: ttobjs.h:281
TT_GlyphZoneRec zone
Definition: ttobjs.h:335
TT_CodeRange TT_CodeRangeTable[TT_MAX_CODE_RANGES]
Definition: ttobjs.h:152
FT_UnitVector freeVector
Definition: ttobjs.h:73
FT_Long start
Definition: ttobjs.h:162
FT_Long end
Definition: ttobjs.h:163
Definition: parse.h:22
FT_Fixed yy
Definition: ttobjs.h:179
signed short FT_Short
Definition: fttypes.h:198
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
tt_driver_init(FT_Module ttdriver)
Definition: ttobjs.c:1358
tt_size_done(FT_Size ttsize)
Definition: ttobjs.c:1221
FT_Long x_ratio
Definition: ttobjs.h:254
FT_Long y_ratio
Definition: ttobjs.h:255
FT_F26Dot6 oy
Definition: ttobjs.h:180
signed long FT_F26Dot6
Definition: fttypes.h:276
Definition: vfat.h:184
struct TT_DefRecord_ * TT_DefArray
DWORD zone
Definition: sec_mgr.c:1760
struct TT_SizeRec_ TT_SizeRec
Definition: i386_sup.c:15
signed long FT_Fixed
Definition: fttypes.h:288
static char * cvt(double arg, int ndigits, int *decpt, int *sign, char *buf, int eflag)
Definition: fcvtbuf.c:45
FT_ULong strike_index
Definition: ttobjs.h:286
tt_driver_done(FT_Module ttdriver)
Definition: ttobjs.c:1395
FT_Size_Metrics hinted_metrics
Definition: ttobjs.h:282
unsigned int FT_UInt
Definition: fttypes.h:231
FT_Bool active
Definition: ttobjs.h:165
int pedantic
Definition: widl.c:113
FT_Bool inline_delta
Definition: ttobjs.h:166
tt_size_init(FT_Size ttsize)
Definition: ttobjs.c:1191
FT_UShort gep2
Definition: ttobjs.h:96
FT_UShort delta_base
Definition: ttobjs.h:83
tt_face_done(FT_Face ttface)
Definition: ttobjs.c:740
FT_UShort ppem
Definition: ttobjs.h:257
FT_Fixed xy
Definition: ttobjs.h:178
FT_F26Dot6 ox
Definition: ttobjs.h:180
struct TT_CodeRange_ TT_CodeRange
unsigned short FT_UShort
Definition: fttypes.h:209
struct TT_Size_Metrics_ TT_Size_Metrics
FT_UShort gep1
Definition: ttobjs.h:95
tt_size_reset(TT_Size size, FT_Bool only_height)
Definition: ttobjs.c:1251
FT_UShort rp2
Definition: ttobjs.h:69
#define TT_MAX_CODE_RANGES
Definition: ttobjs.h:125
FT_Long loop
Definition: ttobjs.h:75