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