1 | /***************************************************************************/
|
---|
2 | /* */
|
---|
3 | /* fttypes.h */
|
---|
4 | /* */
|
---|
5 | /* FreeType simple types definitions (specification only). */
|
---|
6 | /* */
|
---|
7 | /* Copyright 1996-2001, 2002, 2004 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 __FTTYPES_H__
|
---|
20 | #define __FTTYPES_H__
|
---|
21 |
|
---|
22 |
|
---|
23 | #include <ft2build.h>
|
---|
24 | #include FT_CONFIG_CONFIG_H
|
---|
25 | #include FT_SYSTEM_H
|
---|
26 | #include FT_IMAGE_H
|
---|
27 |
|
---|
28 | #include <stddef.h>
|
---|
29 |
|
---|
30 |
|
---|
31 | FT_BEGIN_HEADER
|
---|
32 |
|
---|
33 |
|
---|
34 | /*************************************************************************/
|
---|
35 | /* */
|
---|
36 | /* <Section> */
|
---|
37 | /* basic_types */
|
---|
38 | /* */
|
---|
39 | /* <Title> */
|
---|
40 | /* Basic Data Types */
|
---|
41 | /* */
|
---|
42 | /* <Abstract> */
|
---|
43 | /* The basic data types defined by the library. */
|
---|
44 | /* */
|
---|
45 | /* <Description> */
|
---|
46 | /* This section contains the basic data types defined by FreeType 2, */
|
---|
47 | /* ranging from simple scalar types to bitmap descriptors. More */
|
---|
48 | /* font-specific structures are defined in a different section. */
|
---|
49 | /* */
|
---|
50 | /* <Order> */
|
---|
51 | /* FT_Byte */
|
---|
52 | /* FT_Bytes */
|
---|
53 | /* FT_Char */
|
---|
54 | /* FT_Int */
|
---|
55 | /* FT_UInt */
|
---|
56 | /* FT_Short */
|
---|
57 | /* FT_UShort */
|
---|
58 | /* FT_Long */
|
---|
59 | /* FT_ULong */
|
---|
60 | /* FT_Bool */
|
---|
61 | /* FT_Offset */
|
---|
62 | /* FT_PtrDist */
|
---|
63 | /* FT_String */
|
---|
64 | /* FT_Tag */
|
---|
65 | /* FT_Error */
|
---|
66 | /* FT_Fixed */
|
---|
67 | /* FT_Pointer */
|
---|
68 | /* FT_Pos */
|
---|
69 | /* FT_Vector */
|
---|
70 | /* FT_BBox */
|
---|
71 | /* FT_Matrix */
|
---|
72 | /* FT_FWord */
|
---|
73 | /* FT_UFWord */
|
---|
74 | /* FT_F2Dot14 */
|
---|
75 | /* FT_UnitVector */
|
---|
76 | /* FT_F26Dot6 */
|
---|
77 | /* */
|
---|
78 | /* */
|
---|
79 | /* FT_Generic */
|
---|
80 | /* FT_Generic_Finalizer */
|
---|
81 | /* */
|
---|
82 | /* FT_Bitmap */
|
---|
83 | /* FT_Pixel_Mode */
|
---|
84 | /* FT_Palette_Mode */
|
---|
85 | /* FT_Glyph_Format */
|
---|
86 | /* FT_IMAGE_TAG */
|
---|
87 | /* */
|
---|
88 | /*************************************************************************/
|
---|
89 |
|
---|
90 |
|
---|
91 | /*************************************************************************/
|
---|
92 | /* */
|
---|
93 | /* <Type> */
|
---|
94 | /* FT_Bool */
|
---|
95 | /* */
|
---|
96 | /* <Description> */
|
---|
97 | /* A typedef of unsigned char, used for simple booleans. */
|
---|
98 | /* */
|
---|
99 | typedef unsigned char FT_Bool;
|
---|
100 |
|
---|
101 |
|
---|
102 | /*************************************************************************/
|
---|
103 | /* */
|
---|
104 | /* <Type> */
|
---|
105 | /* FT_FWord */
|
---|
106 | /* */
|
---|
107 | /* <Description> */
|
---|
108 | /* A signed 16-bit integer used to store a distance in original font */
|
---|
109 | /* units. */
|
---|
110 | /* */
|
---|
111 | typedef signed short FT_FWord; /* distance in FUnits */
|
---|
112 |
|
---|
113 |
|
---|
114 | /*************************************************************************/
|
---|
115 | /* */
|
---|
116 | /* <Type> */
|
---|
117 | /* FT_UFWord */
|
---|
118 | /* */
|
---|
119 | /* <Description> */
|
---|
120 | /* An unsigned 16-bit integer used to store a distance in original */
|
---|
121 | /* font units. */
|
---|
122 | /* */
|
---|
123 | typedef unsigned short FT_UFWord; /* unsigned distance */
|
---|
124 |
|
---|
125 |
|
---|
126 | /*************************************************************************/
|
---|
127 | /* */
|
---|
128 | /* <Type> */
|
---|
129 | /* FT_Char */
|
---|
130 | /* */
|
---|
131 | /* <Description> */
|
---|
132 | /* A simple typedef for the _signed_ char type. */
|
---|
133 | /* */
|
---|
134 | typedef signed char FT_Char;
|
---|
135 |
|
---|
136 |
|
---|
137 | /*************************************************************************/
|
---|
138 | /* */
|
---|
139 | /* <Type> */
|
---|
140 | /* FT_Byte */
|
---|
141 | /* */
|
---|
142 | /* <Description> */
|
---|
143 | /* A simple typedef for the _unsigned_ char type. */
|
---|
144 | /* */
|
---|
145 | typedef unsigned char FT_Byte;
|
---|
146 |
|
---|
147 |
|
---|
148 | /*************************************************************************/
|
---|
149 | /* */
|
---|
150 | /* <Type> */
|
---|
151 | /* FT_Bytes */
|
---|
152 | /* */
|
---|
153 | /* <Description> */
|
---|
154 | /* A typedef for constant memory areas. */
|
---|
155 | /* */
|
---|
156 | typedef const FT_Byte* FT_Bytes;
|
---|
157 |
|
---|
158 |
|
---|
159 | /*************************************************************************/
|
---|
160 | /* */
|
---|
161 | /* <Type> */
|
---|
162 | /* FT_Tag */
|
---|
163 | /* */
|
---|
164 | /* <Description> */
|
---|
165 | /* A typedef for 32bit tags (as used in the SFNT format). */
|
---|
166 | /* */
|
---|
167 | typedef FT_UInt32 FT_Tag;
|
---|
168 |
|
---|
169 |
|
---|
170 | /*************************************************************************/
|
---|
171 | /* */
|
---|
172 | /* <Type> */
|
---|
173 | /* FT_String */
|
---|
174 | /* */
|
---|
175 | /* <Description> */
|
---|
176 | /* A simple typedef for the char type, usually used for strings. */
|
---|
177 | /* */
|
---|
178 | typedef char FT_String;
|
---|
179 |
|
---|
180 |
|
---|
181 | /*************************************************************************/
|
---|
182 | /* */
|
---|
183 | /* <Type> */
|
---|
184 | /* FT_Short */
|
---|
185 | /* */
|
---|
186 | /* <Description> */
|
---|
187 | /* A typedef for signed short. */
|
---|
188 | /* */
|
---|
189 | typedef signed short FT_Short;
|
---|
190 |
|
---|
191 |
|
---|
192 | /*************************************************************************/
|
---|
193 | /* */
|
---|
194 | /* <Type> */
|
---|
195 | /* FT_UShort */
|
---|
196 | /* */
|
---|
197 | /* <Description> */
|
---|
198 | /* A typedef for unsigned short. */
|
---|
199 | /* */
|
---|
200 | typedef unsigned short FT_UShort;
|
---|
201 |
|
---|
202 |
|
---|
203 | /*************************************************************************/
|
---|
204 | /* */
|
---|
205 | /* <Type> */
|
---|
206 | /* FT_Int */
|
---|
207 | /* */
|
---|
208 | /* <Description> */
|
---|
209 | /* A typedef for the int type. */
|
---|
210 | /* */
|
---|
211 | typedef signed int FT_Int;
|
---|
212 |
|
---|
213 |
|
---|
214 | /*************************************************************************/
|
---|
215 | /* */
|
---|
216 | /* <Type> */
|
---|
217 | /* FT_UInt */
|
---|
218 | /* */
|
---|
219 | /* <Description> */
|
---|
220 | /* A typedef for the unsigned int type. */
|
---|
221 | /* */
|
---|
222 | typedef unsigned int FT_UInt;
|
---|
223 |
|
---|
224 |
|
---|
225 | /*************************************************************************/
|
---|
226 | /* */
|
---|
227 | /* <Type> */
|
---|
228 | /* FT_Long */
|
---|
229 | /* */
|
---|
230 | /* <Description> */
|
---|
231 | /* A typedef for signed long. */
|
---|
232 | /* */
|
---|
233 | typedef signed long FT_Long;
|
---|
234 |
|
---|
235 |
|
---|
236 | /*************************************************************************/
|
---|
237 | /* */
|
---|
238 | /* <Type> */
|
---|
239 | /* FT_ULong */
|
---|
240 | /* */
|
---|
241 | /* <Description> */
|
---|
242 | /* A typedef for unsigned long. */
|
---|
243 | /* */
|
---|
244 | typedef unsigned long FT_ULong;
|
---|
245 |
|
---|
246 |
|
---|
247 | /*************************************************************************/
|
---|
248 | /* */
|
---|
249 | /* <Type> */
|
---|
250 | /* FT_F2Dot14 */
|
---|
251 | /* */
|
---|
252 | /* <Description> */
|
---|
253 | /* A signed 2.14 fixed float type used for unit vectors. */
|
---|
254 | /* */
|
---|
255 | typedef signed short FT_F2Dot14;
|
---|
256 |
|
---|
257 |
|
---|
258 | /*************************************************************************/
|
---|
259 | /* */
|
---|
260 | /* <Type> */
|
---|
261 | /* FT_F26Dot6 */
|
---|
262 | /* */
|
---|
263 | /* <Description> */
|
---|
264 | /* A signed 26.6 fixed float type used for vectorial pixel */
|
---|
265 | /* coordinates. */
|
---|
266 | /* */
|
---|
267 | typedef signed long FT_F26Dot6;
|
---|
268 |
|
---|
269 |
|
---|
270 | /*************************************************************************/
|
---|
271 | /* */
|
---|
272 | /* <Type> */
|
---|
273 | /* FT_Fixed */
|
---|
274 | /* */
|
---|
275 | /* <Description> */
|
---|
276 | /* This type is used to store 16.16 fixed float values, like scales */
|
---|
277 | /* or matrix coefficients. */
|
---|
278 | /* */
|
---|
279 | typedef signed long FT_Fixed;
|
---|
280 |
|
---|
281 |
|
---|
282 | /*************************************************************************/
|
---|
283 | /* */
|
---|
284 | /* <Type> */
|
---|
285 | /* FT_Error */
|
---|
286 | /* */
|
---|
287 | /* <Description> */
|
---|
288 | /* The FreeType error code type. A value of 0 is always interpreted */
|
---|
289 | /* as a successful operation. */
|
---|
290 | /* */
|
---|
291 | typedef int FT_Error;
|
---|
292 |
|
---|
293 |
|
---|
294 | /*************************************************************************/
|
---|
295 | /* */
|
---|
296 | /* <Type> */
|
---|
297 | /* FT_Pointer */
|
---|
298 | /* */
|
---|
299 | /* <Description> */
|
---|
300 | /* A simple typedef for a typeless pointer. */
|
---|
301 | /* */
|
---|
302 | typedef void* FT_Pointer;
|
---|
303 |
|
---|
304 |
|
---|
305 | /*************************************************************************/
|
---|
306 | /* */
|
---|
307 | /* <Type> */
|
---|
308 | /* FT_Offset */
|
---|
309 | /* */
|
---|
310 | /* <Description> */
|
---|
311 | /* This is equivalent to the ANSI C `size_t' type, i.e. the largest */
|
---|
312 | /* _unsigned_ integer type used to express a file size or position, */
|
---|
313 | /* or a memory block size. */
|
---|
314 | /* */
|
---|
315 | typedef size_t FT_Offset;
|
---|
316 |
|
---|
317 |
|
---|
318 | /*************************************************************************/
|
---|
319 | /* */
|
---|
320 | /* <Type> */
|
---|
321 | /* FT_PtrDist */
|
---|
322 | /* */
|
---|
323 | /* <Description> */
|
---|
324 | /* This is equivalent to the ANSI C `ptrdiff_t' type, i.e. the */
|
---|
325 | /* largest _signed_ integer type used to express the distance */
|
---|
326 | /* between two pointers. */
|
---|
327 | /* */
|
---|
328 | typedef ft_ptrdiff_t FT_PtrDist;
|
---|
329 |
|
---|
330 |
|
---|
331 | /*************************************************************************/
|
---|
332 | /* */
|
---|
333 | /* <Struct> */
|
---|
334 | /* FT_UnitVector */
|
---|
335 | /* */
|
---|
336 | /* <Description> */
|
---|
337 | /* A simple structure used to store a 2D vector unit vector. Uses */
|
---|
338 | /* FT_F2Dot14 types. */
|
---|
339 | /* */
|
---|
340 | /* <Fields> */
|
---|
341 | /* x :: Horizontal coordinate. */
|
---|
342 | /* */
|
---|
343 | /* y :: Vertical coordinate. */
|
---|
344 | /* */
|
---|
345 | typedef struct FT_UnitVector_
|
---|
346 | {
|
---|
347 | FT_F2Dot14 x;
|
---|
348 | FT_F2Dot14 y;
|
---|
349 |
|
---|
350 | } FT_UnitVector;
|
---|
351 |
|
---|
352 |
|
---|
353 | /*************************************************************************/
|
---|
354 | /* */
|
---|
355 | /* <Struct> */
|
---|
356 | /* FT_Matrix */
|
---|
357 | /* */
|
---|
358 | /* <Description> */
|
---|
359 | /* A simple structure used to store a 2x2 matrix. Coefficients are */
|
---|
360 | /* in 16.16 fixed float format. The computation performed is: */
|
---|
361 | /* */
|
---|
362 | /* { */
|
---|
363 | /* x' = x*xx + y*xy */
|
---|
364 | /* y' = x*yx + y*yy */
|
---|
365 | /* } */
|
---|
366 | /* */
|
---|
367 | /* <Fields> */
|
---|
368 | /* xx :: Matrix coefficient. */
|
---|
369 | /* */
|
---|
370 | /* xy :: Matrix coefficient. */
|
---|
371 | /* */
|
---|
372 | /* yx :: Matrix coefficient. */
|
---|
373 | /* */
|
---|
374 | /* yy :: Matrix coefficient. */
|
---|
375 | /* */
|
---|
376 | typedef struct FT_Matrix_
|
---|
377 | {
|
---|
378 | FT_Fixed xx, xy;
|
---|
379 | FT_Fixed yx, yy;
|
---|
380 |
|
---|
381 | } FT_Matrix;
|
---|
382 |
|
---|
383 |
|
---|
384 | /*************************************************************************/
|
---|
385 | /* */
|
---|
386 | /* <Struct> */
|
---|
387 | /* FT_Data */
|
---|
388 | /* */
|
---|
389 | /* <Description> */
|
---|
390 | /* Read-only binary data represented as a pointer and a length. */
|
---|
391 | /* */
|
---|
392 | /* <Fields> */
|
---|
393 | /* pointer :: The data. */
|
---|
394 | /* */
|
---|
395 | /* length :: The length of the data in bytes. */
|
---|
396 | /* */
|
---|
397 | typedef struct FT_Data_
|
---|
398 | {
|
---|
399 | const FT_Byte* pointer;
|
---|
400 | FT_Int length;
|
---|
401 |
|
---|
402 | } FT_Data;
|
---|
403 |
|
---|
404 |
|
---|
405 | /*************************************************************************/
|
---|
406 | /* */
|
---|
407 | /* <FuncType> */
|
---|
408 | /* FT_Generic_Finalizer */
|
---|
409 | /* */
|
---|
410 | /* <Description> */
|
---|
411 | /* Describes a function used to destroy the `client' data of any */
|
---|
412 | /* FreeType object. See the description of the FT_Generic type for */
|
---|
413 | /* details of usage. */
|
---|
414 | /* */
|
---|
415 | /* <Input> */
|
---|
416 | /* The address of the FreeType object which is under finalization. */
|
---|
417 | /* Its client data is accessed through its `generic' field. */
|
---|
418 | /* */
|
---|
419 | typedef void (*FT_Generic_Finalizer)(void* object);
|
---|
420 |
|
---|
421 |
|
---|
422 | /*************************************************************************/
|
---|
423 | /* */
|
---|
424 | /* <Struct> */
|
---|
425 | /* FT_Generic */
|
---|
426 | /* */
|
---|
427 | /* <Description> */
|
---|
428 | /* Client applications often need to associate their own data to a */
|
---|
429 | /* variety of FreeType core objects. For example, a text layout API */
|
---|
430 | /* might want to associate a glyph cache to a given size object. */
|
---|
431 | /* */
|
---|
432 | /* Most FreeType object contains a `generic' field, of type */
|
---|
433 | /* FT_Generic, which usage is left to client applications and font */
|
---|
434 | /* servers. */
|
---|
435 | /* */
|
---|
436 | /* It can be used to store a pointer to client-specific data, as well */
|
---|
437 | /* as the address of a `finalizer' function, which will be called by */
|
---|
438 | /* FreeType when the object is destroyed (for example, the previous */
|
---|
439 | /* client example would put the address of the glyph cache destructor */
|
---|
440 | /* in the `finalizer' field). */
|
---|
441 | /* */
|
---|
442 | /* <Fields> */
|
---|
443 | /* data :: A typeless pointer to any client-specified data. This */
|
---|
444 | /* field is completely ignored by the FreeType library. */
|
---|
445 | /* */
|
---|
446 | /* finalizer :: A pointer to a `generic finalizer' function, which */
|
---|
447 | /* will be called when the object is destroyed. If this */
|
---|
448 | /* field is set to NULL, no code will be called. */
|
---|
449 | /* */
|
---|
450 | typedef struct FT_Generic_
|
---|
451 | {
|
---|
452 | void* data;
|
---|
453 | FT_Generic_Finalizer finalizer;
|
---|
454 |
|
---|
455 | } FT_Generic;
|
---|
456 |
|
---|
457 |
|
---|
458 | /*************************************************************************/
|
---|
459 | /* */
|
---|
460 | /* <Macro> */
|
---|
461 | /* FT_MAKE_TAG */
|
---|
462 | /* */
|
---|
463 | /* <Description> */
|
---|
464 | /* This macro converts four letter tags which are used to label */
|
---|
465 | /* TrueType tables into an unsigned long to be used within FreeType. */
|
---|
466 | /* */
|
---|
467 | /* <Note> */
|
---|
468 | /* The produced values *must* be 32bit integers. Don't redefine this */
|
---|
469 | /* macro. */
|
---|
470 | /* */
|
---|
471 | #define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
|
---|
472 | ( ( (FT_ULong)_x1 << 24 ) | \
|
---|
473 | ( (FT_ULong)_x2 << 16 ) | \
|
---|
474 | ( (FT_ULong)_x3 << 8 ) | \
|
---|
475 | (FT_ULong)_x4 )
|
---|
476 |
|
---|
477 |
|
---|
478 | /*************************************************************************/
|
---|
479 | /*************************************************************************/
|
---|
480 | /* */
|
---|
481 | /* L I S T M A N A G E M E N T */
|
---|
482 | /* */
|
---|
483 | /*************************************************************************/
|
---|
484 | /*************************************************************************/
|
---|
485 |
|
---|
486 |
|
---|
487 | /*************************************************************************/
|
---|
488 | /* */
|
---|
489 | /* <Section> */
|
---|
490 | /* list_processing */
|
---|
491 | /* */
|
---|
492 | /*************************************************************************/
|
---|
493 |
|
---|
494 |
|
---|
495 | /*************************************************************************/
|
---|
496 | /* */
|
---|
497 | /* <Type> */
|
---|
498 | /* FT_ListNode */
|
---|
499 | /* */
|
---|
500 | /* <Description> */
|
---|
501 | /* Many elements and objects in FreeType are listed through a */
|
---|
502 | /* FT_List record (see FT_ListRec). As its name suggests, a */
|
---|
503 | /* FT_ListNode is a handle to a single list element. */
|
---|
504 | /* */
|
---|
505 | typedef struct FT_ListNodeRec_* FT_ListNode;
|
---|
506 |
|
---|
507 |
|
---|
508 | /*************************************************************************/
|
---|
509 | /* */
|
---|
510 | /* <Type> */
|
---|
511 | /* FT_List */
|
---|
512 | /* */
|
---|
513 | /* <Description> */
|
---|
514 | /* A handle to a list record (see FT_ListRec). */
|
---|
515 | /* */
|
---|
516 | typedef struct FT_ListRec_* FT_List;
|
---|
517 |
|
---|
518 |
|
---|
519 | /*************************************************************************/
|
---|
520 | /* */
|
---|
521 | /* <Struct> */
|
---|
522 | /* FT_ListNodeRec */
|
---|
523 | /* */
|
---|
524 | /* <Description> */
|
---|
525 | /* A structure used to hold a single list element. */
|
---|
526 | /* */
|
---|
527 | /* <Fields> */
|
---|
528 | /* prev :: The previous element in the list. NULL if first. */
|
---|
529 | /* */
|
---|
530 | /* next :: The next element in the list. NULL if last. */
|
---|
531 | /* */
|
---|
532 | /* data :: A typeless pointer to the listed object. */
|
---|
533 | /* */
|
---|
534 | typedef struct FT_ListNodeRec_
|
---|
535 | {
|
---|
536 | FT_ListNode prev;
|
---|
537 | FT_ListNode next;
|
---|
538 | void* data;
|
---|
539 |
|
---|
540 | } FT_ListNodeRec;
|
---|
541 |
|
---|
542 |
|
---|
543 | /*************************************************************************/
|
---|
544 | /* */
|
---|
545 | /* <Struct> */
|
---|
546 | /* FT_ListRec */
|
---|
547 | /* */
|
---|
548 | /* <Description> */
|
---|
549 | /* A structure used to hold a simple doubly-linked list. These are */
|
---|
550 | /* used in many parts of FreeType. */
|
---|
551 | /* */
|
---|
552 | /* <Fields> */
|
---|
553 | /* head :: The head (first element) of doubly-linked list. */
|
---|
554 | /* */
|
---|
555 | /* tail :: The tail (last element) of doubly-linked list. */
|
---|
556 | /* */
|
---|
557 | typedef struct FT_ListRec_
|
---|
558 | {
|
---|
559 | FT_ListNode head;
|
---|
560 | FT_ListNode tail;
|
---|
561 |
|
---|
562 | } FT_ListRec;
|
---|
563 |
|
---|
564 |
|
---|
565 | /* */
|
---|
566 |
|
---|
567 | #define FT_IS_EMPTY( list ) ( (list).head == 0 )
|
---|
568 |
|
---|
569 | /* return base error code (without module-specific prefix) */
|
---|
570 | #define FT_ERROR_BASE( x ) ( (x) & 0xFF )
|
---|
571 |
|
---|
572 | /* return module error code */
|
---|
573 | #define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U )
|
---|
574 |
|
---|
575 | #define FT_BOOL( x ) ( (FT_Bool)( x ) )
|
---|
576 |
|
---|
577 | FT_END_HEADER
|
---|
578 |
|
---|
579 | #endif /* __FTTYPES_H__ */
|
---|
580 |
|
---|
581 |
|
---|
582 | /* END */
|
---|