1 /***************************************************************************/
5 /* FreeType simple types definitions (specification only). */
7 /* Copyright 1996-2002, 2004, 2006-2009, 2012-2014 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. */
88 /* FT_Generic_Finalizer */
96 /*************************************************************************/
99 /*************************************************************************/
105 /* A typedef of unsigned char, used for simple booleans. As usual, */
106 /* values 1 and~0 represent true and false, respectively. */
108 typedef unsigned char FT_Bool;
111 /*************************************************************************/
117 /* A signed 16-bit integer used to store a distance in original font */
120 typedef signed short FT_FWord; /* distance in FUnits */
123 /*************************************************************************/
129 /* An unsigned 16-bit integer used to store a distance in original */
132 typedef unsigned short FT_UFWord; /* unsigned distance */
135 /*************************************************************************/
141 /* A simple typedef for the _signed_ char type. */
143 typedef signed char FT_Char;
146 /*************************************************************************/
152 /* A simple typedef for the _unsigned_ char type. */
154 typedef unsigned char FT_Byte;
157 /*************************************************************************/
163 /* A typedef for constant memory areas. */
165 typedef const FT_Byte* FT_Bytes;
168 /*************************************************************************/
174 /* A typedef for 32-bit tags (as used in the SFNT format). */
176 typedef FT_UInt32 FT_Tag;
179 /*************************************************************************/
185 /* A simple typedef for the char type, usually used for strings. */
187 typedef char FT_String;
190 /*************************************************************************/
196 /* A typedef for signed short. */
198 typedef signed short FT_Short;
201 /*************************************************************************/
207 /* A typedef for unsigned short. */
209 typedef unsigned short FT_UShort;
212 /*************************************************************************/
218 /* A typedef for the int type. */
220 typedef signed int FT_Int;
223 /*************************************************************************/
229 /* A typedef for the unsigned int type. */
231 typedef unsigned int FT_UInt;
234 /*************************************************************************/
240 /* A typedef for signed long. */
242 typedef signed long FT_Long;
245 /*************************************************************************/
251 /* A typedef for unsigned long. */
253 typedef unsigned long FT_ULong;
256 /*************************************************************************/
262 /* A signed 2.14 fixed-point type used for unit vectors. */
264 typedef signed short FT_F2Dot14;
267 /*************************************************************************/
273 /* A signed 26.6 fixed-point type used for vectorial pixel */
276 typedef signed long FT_F26Dot6;
279 /*************************************************************************/
285 /* This type is used to store 16.16 fixed-point values, like scaling */
286 /* values or matrix coefficients. */
288 typedef signed long FT_Fixed;
291 /*************************************************************************/
297 /* The FreeType error code type. A value of~0 is always interpreted */
298 /* as a successful operation. */
300 typedef int FT_Error;
303 /*************************************************************************/
309 /* A simple typedef for a typeless pointer. */
311 typedef void* FT_Pointer;
314 /*************************************************************************/
320 /* This is equivalent to the ANSI~C `size_t' type, i.e., the largest */
321 /* _unsigned_ integer type used to express a file size or position, */
322 /* or a memory block size. */
324 typedef size_t FT_Offset;
327 /*************************************************************************/
333 /* This is equivalent to the ANSI~C `ptrdiff_t' type, i.e., the */
334 /* largest _signed_ integer type used to express the distance */
335 /* between two pointers. */
337 typedef ft_ptrdiff_t FT_PtrDist;
340 /*************************************************************************/
346 /* A simple structure used to store a 2D vector unit vector. Uses */
347 /* FT_F2Dot14 types. */
350 /* x :: Horizontal coordinate. */
352 /* y :: Vertical coordinate. */
354 typedef struct FT_UnitVector_
362 /*************************************************************************/
368 /* A simple structure used to store a 2x2 matrix. Coefficients are */
369 /* in 16.16 fixed-point format. The computation performed is: */
372 /* x' = x*xx + y*xy */
373 /* y' = x*yx + y*yy */
377 /* xx :: Matrix coefficient. */
379 /* xy :: Matrix coefficient. */
381 /* yx :: Matrix coefficient. */
383 /* yy :: Matrix coefficient. */
385 typedef struct FT_Matrix_
393 /*************************************************************************/
399 /* Read-only binary data represented as a pointer and a length. */
402 /* pointer :: The data. */
404 /* length :: The length of the data in bytes. */
406 typedef struct FT_Data_
408 const FT_Byte* pointer;
414 /*************************************************************************/
417 /* FT_Generic_Finalizer */
420 /* Describe a function used to destroy the `client' data of any */
421 /* FreeType object. See the description of the @FT_Generic type for */
422 /* details of usage. */
425 /* The address of the FreeType object that is under finalization. */
426 /* Its client data is accessed through its `generic' field. */
428 typedef void (*FT_Generic_Finalizer)(void* object);
431 /*************************************************************************/
437 /* Client applications often need to associate their own data to a */
438 /* variety of FreeType core objects. For example, a text layout API */
439 /* might want to associate a glyph cache to a given size object. */
441 /* Some FreeType object contains a `generic' field, of type */
442 /* FT_Generic, which usage is left to client applications and font */
445 /* It can be used to store a pointer to client-specific data, as well */
446 /* as the address of a `finalizer' function, which will be called by */
447 /* FreeType when the object is destroyed (for example, the previous */
448 /* client example would put the address of the glyph cache destructor */
449 /* in the `finalizer' field). */
452 /* data :: A typeless pointer to any client-specified data. This */
453 /* field is completely ignored by the FreeType library. */
455 /* finalizer :: A pointer to a `generic finalizer' function, which */
456 /* will be called when the object is destroyed. If this */
457 /* field is set to NULL, no code will be called. */
459 typedef struct FT_Generic_
462 FT_Generic_Finalizer finalizer;
467 /*************************************************************************/
473 /* This macro converts four-letter tags that are used to label */
474 /* TrueType tables into an unsigned long, to be used within FreeType. */
477 /* The produced values *must* be 32-bit integers. Don't redefine */
480 #define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
482 ( ( (FT_ULong)_x1 << 24 ) | \
483 ( (FT_ULong)_x2 << 16 ) | \
484 ( (FT_ULong)_x3 << 8 ) | \
488 /*************************************************************************/
489 /*************************************************************************/
491 /* L I S T M A N A G E M E N T */
493 /*************************************************************************/
494 /*************************************************************************/
497 /*************************************************************************/
500 /* list_processing */
502 /*************************************************************************/
505 /*************************************************************************/
511 /* Many elements and objects in FreeType are listed through an */
512 /* @FT_List record (see @FT_ListRec). As its name suggests, an */
513 /* FT_ListNode is a handle to a single list element. */
515 typedef struct FT_ListNodeRec_* FT_ListNode;
518 /*************************************************************************/
524 /* A handle to a list record (see @FT_ListRec). */
526 typedef struct FT_ListRec_* FT_List;
529 /*************************************************************************/
535 /* A structure used to hold a single list element. */
538 /* prev :: The previous element in the list. NULL if first. */
540 /* next :: The next element in the list. NULL if last. */
542 /* data :: A typeless pointer to the listed object. */
544 typedef struct FT_ListNodeRec_
553 /*************************************************************************/
559 /* A structure used to hold a simple doubly-linked list. These are */
560 /* used in many parts of FreeType. */
563 /* head :: The head (first element) of doubly-linked list. */
565 /* tail :: The tail (last element) of doubly-linked list. */
567 typedef struct FT_ListRec_
577 #define FT_IS_EMPTY( list ) ( (list).head == 0 )
578 #define FT_BOOL( x ) ( (FT_Bool)( x ) )
580 /* concatenate C tokens */
581 #define FT_ERR_XCAT( x, y ) x ## y
582 #define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y )
584 /* see `ftmoderr.h' for descriptions of the following macros */
586 #define FT_ERR( e ) FT_ERR_CAT( FT_ERR_PREFIX, e )
588 #define FT_ERROR_BASE( x ) ( (x) & 0xFF )
589 #define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U )
591 #define FT_ERR_EQ( x, e ) \
592 ( FT_ERROR_BASE( x ) == FT_ERROR_BASE( FT_ERR( e ) ) )
593 #define FT_ERR_NEQ( x, e ) \
594 ( FT_ERROR_BASE( x ) != FT_ERROR_BASE( FT_ERR( e ) ) )
599 #endif /* __FTTYPES_H__ */