1 /***************************************************************************/
5 /* FreeType simple types definitions (specification only). */
7 /* Copyright 1996-2001, 2002, 2004 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
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. */
16 /***************************************************************************/
24 #include FT_CONFIG_CONFIG_H
34 /*************************************************************************/
40 /* Basic Data Types */
43 /* The basic data types defined by the library. */
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. */
80 /* FT_Generic_Finalizer */
88 /*************************************************************************/
91 /*************************************************************************/
97 /* A typedef of unsigned char, used for simple booleans. */
99 typedef unsigned char FT_Bool;
102 /*************************************************************************/
108 /* A signed 16-bit integer used to store a distance in original font */
111 typedef signed short FT_FWord; /* distance in FUnits */
114 /*************************************************************************/
120 /* An unsigned 16-bit integer used to store a distance in original */
123 typedef unsigned short FT_UFWord; /* unsigned distance */
126 /*************************************************************************/
132 /* A simple typedef for the _signed_ char type. */
134 typedef signed char FT_Char;
137 /*************************************************************************/
143 /* A simple typedef for the _unsigned_ char type. */
145 typedef unsigned char FT_Byte;
148 /*************************************************************************/
154 /* A typedef for constant memory areas. */
156 typedef const FT_Byte* FT_Bytes;
159 /*************************************************************************/
165 /* A typedef for 32bit tags (as used in the SFNT format). */
167 typedef FT_UInt32 FT_Tag;
170 /*************************************************************************/
176 /* A simple typedef for the char type, usually used for strings. */
178 typedef char FT_String;
181 /*************************************************************************/
187 /* A typedef for signed short. */
189 typedef signed short FT_Short;
192 /*************************************************************************/
198 /* A typedef for unsigned short. */
200 typedef unsigned short FT_UShort;
203 /*************************************************************************/
209 /* A typedef for the int type. */
211 typedef signed int FT_Int;
214 /*************************************************************************/
220 /* A typedef for the unsigned int type. */
222 typedef unsigned int FT_UInt;
225 /*************************************************************************/
231 /* A typedef for signed long. */
233 typedef signed long FT_Long;
236 /*************************************************************************/
242 /* A typedef for unsigned long. */
244 typedef unsigned long FT_ULong;
247 /*************************************************************************/
253 /* A signed 2.14 fixed float type used for unit vectors. */
255 typedef signed short FT_F2Dot14;
258 /*************************************************************************/
264 /* A signed 26.6 fixed float type used for vectorial pixel */
267 typedef signed long FT_F26Dot6;
270 /*************************************************************************/
276 /* This type is used to store 16.16 fixed float values, like scales */
277 /* or matrix coefficients. */
279 typedef signed long FT_Fixed;
282 /*************************************************************************/
288 /* The FreeType error code type. A value of 0 is always interpreted */
289 /* as a successful operation. */
291 typedef int FT_Error;
294 /*************************************************************************/
300 /* A simple typedef for a typeless pointer. */
302 typedef void* FT_Pointer;
305 /*************************************************************************/
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. */
315 typedef size_t FT_Offset;
318 /*************************************************************************/
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. */
328 typedef ft_ptrdiff_t FT_PtrDist;
331 /*************************************************************************/
337 /* A simple structure used to store a 2D vector unit vector. Uses */
338 /* FT_F2Dot14 types. */
341 /* x :: Horizontal coordinate. */
343 /* y :: Vertical coordinate. */
345 typedef struct FT_UnitVector_
353 /*************************************************************************/
359 /* A simple structure used to store a 2x2 matrix. Coefficients are */
360 /* in 16.16 fixed float format. The computation performed is: */
363 /* x' = x*xx + y*xy */
364 /* y' = x*yx + y*yy */
368 /* xx :: Matrix coefficient. */
370 /* xy :: Matrix coefficient. */
372 /* yx :: Matrix coefficient. */
374 /* yy :: Matrix coefficient. */
376 typedef struct FT_Matrix_
384 /*************************************************************************/
390 /* Read-only binary data represented as a pointer and a length. */
393 /* pointer :: The data. */
395 /* length :: The length of the data in bytes. */
397 typedef struct FT_Data_
399 const FT_Byte* pointer;
405 /*************************************************************************/
408 /* FT_Generic_Finalizer */
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. */
416 /* The address of the FreeType object which is under finalization. */
417 /* Its client data is accessed through its `generic' field. */
419 typedef void (*FT_Generic_Finalizer)(void* object);
422 /*************************************************************************/
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. */
432 /* Most FreeType object contains a `generic' field, of type */
433 /* FT_Generic, which usage is left to client applications and font */
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). */
443 /* data :: A typeless pointer to any client-specified data. This */
444 /* field is completely ignored by the FreeType library. */
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. */
450 typedef struct FT_Generic_
453 FT_Generic_Finalizer finalizer;
458 /*************************************************************************/
464 /* This macro converts four letter tags which are used to label */
465 /* TrueType tables into an unsigned long to be used within FreeType. */
468 /* The produced values *must* be 32bit integers. Don't redefine this */
471 #define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
472 ( ( (FT_ULong)_x1 << 24 ) | \
473 ( (FT_ULong)_x2 << 16 ) | \
474 ( (FT_ULong)_x3 << 8 ) | \
478 /*************************************************************************/
479 /*************************************************************************/
481 /* L I S T M A N A G E M E N T */
483 /*************************************************************************/
484 /*************************************************************************/
487 /*************************************************************************/
490 /* list_processing */
492 /*************************************************************************/
495 /*************************************************************************/
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. */
505 typedef struct FT_ListNodeRec_* FT_ListNode;
508 /*************************************************************************/
514 /* A handle to a list record (see FT_ListRec). */
516 typedef struct FT_ListRec_* FT_List;
519 /*************************************************************************/
525 /* A structure used to hold a single list element. */
528 /* prev :: The previous element in the list. NULL if first. */
530 /* next :: The next element in the list. NULL if last. */
532 /* data :: A typeless pointer to the listed object. */
534 typedef struct FT_ListNodeRec_
543 /*************************************************************************/
549 /* A structure used to hold a simple doubly-linked list. These are */
550 /* used in many parts of FreeType. */
553 /* head :: The head (first element) of doubly-linked list. */
555 /* tail :: The tail (last element) of doubly-linked list. */
557 typedef struct FT_ListRec_
567 #define FT_IS_EMPTY( list ) ( (list).head == 0 )
569 /* return base error code (without module-specific prefix) */
570 #define FT_ERROR_BASE( x ) ( (x) & 0xFF )
572 /* return module error code */
573 #define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U )
575 #define FT_BOOL( x ) ( (FT_Bool)( x ) )
579 #endif /* __FTTYPES_H__ */