1 /***************************************************************************/
5 /* FreeType simple types definitions (specification only). */
7 /* Copyright 1996-2001, 2002, 2004, 2006, 2007, 2008 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. */
84 /* FT_Generic_Finalizer */
92 /*************************************************************************/
95 /*************************************************************************/
101 /* A typedef of unsigned char, used for simple booleans. As usual, */
102 /* values 1 and~0 represent true and false, respectively. */
104 typedef unsigned char FT_Bool
;
107 /*************************************************************************/
113 /* A signed 16-bit integer used to store a distance in original font */
116 typedef signed short FT_FWord
; /* distance in FUnits */
119 /*************************************************************************/
125 /* An unsigned 16-bit integer used to store a distance in original */
128 typedef unsigned short FT_UFWord
; /* unsigned distance */
131 /*************************************************************************/
137 /* A simple typedef for the _signed_ char type. */
139 typedef signed char FT_Char
;
142 /*************************************************************************/
148 /* A simple typedef for the _unsigned_ char type. */
150 typedef unsigned char FT_Byte
;
153 /*************************************************************************/
159 /* A typedef for constant memory areas. */
161 typedef const FT_Byte
* FT_Bytes
;
164 /*************************************************************************/
170 /* A typedef for 32-bit tags (as used in the SFNT format). */
172 typedef FT_UInt32 FT_Tag
;
175 /*************************************************************************/
181 /* A simple typedef for the char type, usually used for strings. */
183 typedef char FT_String
;
186 /*************************************************************************/
192 /* A typedef for signed short. */
194 typedef signed short FT_Short
;
197 /*************************************************************************/
203 /* A typedef for unsigned short. */
205 typedef unsigned short FT_UShort
;
208 /*************************************************************************/
214 /* A typedef for the int type. */
216 typedef signed int FT_Int
;
219 /*************************************************************************/
225 /* A typedef for the unsigned int type. */
227 typedef unsigned int FT_UInt
;
230 /*************************************************************************/
236 /* A typedef for signed long. */
238 typedef signed long FT_Long
;
241 /*************************************************************************/
247 /* A typedef for unsigned long. */
249 typedef unsigned long FT_ULong
;
252 /*************************************************************************/
258 /* A signed 2.14 fixed float type used for unit vectors. */
260 typedef signed short FT_F2Dot14
;
263 /*************************************************************************/
269 /* A signed 26.6 fixed float type used for vectorial pixel */
272 typedef signed long FT_F26Dot6
;
275 /*************************************************************************/
281 /* This type is used to store 16.16 fixed float values, like scaling */
282 /* values or matrix coefficients. */
284 typedef signed long FT_Fixed
;
287 /*************************************************************************/
293 /* The FreeType error code type. A value of~0 is always interpreted */
294 /* as a successful operation. */
296 typedef int FT_Error
;
299 /*************************************************************************/
305 /* A simple typedef for a typeless pointer. */
307 typedef void* FT_Pointer
;
310 /*************************************************************************/
316 /* This is equivalent to the ANSI~C `size_t' type, i.e., the largest */
317 /* _unsigned_ integer type used to express a file size or position, */
318 /* or a memory block size. */
320 typedef size_t FT_Offset
;
323 /*************************************************************************/
329 /* This is equivalent to the ANSI~C `ptrdiff_t' type, i.e., the */
330 /* largest _signed_ integer type used to express the distance */
331 /* between two pointers. */
333 typedef ft_ptrdiff_t FT_PtrDist
;
336 /*************************************************************************/
342 /* A simple structure used to store a 2D vector unit vector. Uses */
343 /* FT_F2Dot14 types. */
346 /* x :: Horizontal coordinate. */
348 /* y :: Vertical coordinate. */
350 typedef struct FT_UnitVector_
358 /*************************************************************************/
364 /* A simple structure used to store a 2x2 matrix. Coefficients are */
365 /* in 16.16 fixed float format. The computation performed is: */
368 /* x' = x*xx + y*xy */
369 /* y' = x*yx + y*yy */
373 /* xx :: Matrix coefficient. */
375 /* xy :: Matrix coefficient. */
377 /* yx :: Matrix coefficient. */
379 /* yy :: Matrix coefficient. */
381 typedef struct FT_Matrix_
389 /*************************************************************************/
395 /* Read-only binary data represented as a pointer and a length. */
398 /* pointer :: The data. */
400 /* length :: The length of the data in bytes. */
402 typedef struct FT_Data_
404 const FT_Byte
* pointer
;
410 /*************************************************************************/
413 /* FT_Generic_Finalizer */
416 /* Describe a function used to destroy the `client' data of any */
417 /* FreeType object. See the description of the @FT_Generic type for */
418 /* details of usage. */
421 /* The address of the FreeType object which is under finalization. */
422 /* Its client data is accessed through its `generic' field. */
424 typedef void (*FT_Generic_Finalizer
)(void* object
);
427 /*************************************************************************/
433 /* Client applications often need to associate their own data to a */
434 /* variety of FreeType core objects. For example, a text layout API */
435 /* might want to associate a glyph cache to a given size object. */
437 /* Most FreeType object contains a `generic' field, of type */
438 /* FT_Generic, which usage is left to client applications and font */
441 /* It can be used to store a pointer to client-specific data, as well */
442 /* as the address of a `finalizer' function, which will be called by */
443 /* FreeType when the object is destroyed (for example, the previous */
444 /* client example would put the address of the glyph cache destructor */
445 /* in the `finalizer' field). */
448 /* data :: A typeless pointer to any client-specified data. This */
449 /* field is completely ignored by the FreeType library. */
451 /* finalizer :: A pointer to a `generic finalizer' function, which */
452 /* will be called when the object is destroyed. If this */
453 /* field is set to NULL, no code will be called. */
455 typedef struct FT_Generic_
458 FT_Generic_Finalizer finalizer
;
463 /*************************************************************************/
469 /* This macro converts four-letter tags which are used to label */
470 /* TrueType tables into an unsigned long to be used within FreeType. */
473 /* The produced values *must* be 32-bit integers. Don't redefine */
476 #define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
478 ( ( (FT_ULong)_x1 << 24 ) | \
479 ( (FT_ULong)_x2 << 16 ) | \
480 ( (FT_ULong)_x3 << 8 ) | \
484 /*************************************************************************/
485 /*************************************************************************/
487 /* L I S T M A N A G E M E N T */
489 /*************************************************************************/
490 /*************************************************************************/
493 /*************************************************************************/
496 /* list_processing */
498 /*************************************************************************/
501 /*************************************************************************/
507 /* Many elements and objects in FreeType are listed through an */
508 /* @FT_List record (see @FT_ListRec). As its name suggests, an */
509 /* FT_ListNode is a handle to a single list element. */
511 typedef struct FT_ListNodeRec_
* FT_ListNode
;
514 /*************************************************************************/
520 /* A handle to a list record (see @FT_ListRec). */
522 typedef struct FT_ListRec_
* FT_List
;
525 /*************************************************************************/
531 /* A structure used to hold a single list element. */
534 /* prev :: The previous element in the list. NULL if first. */
536 /* next :: The next element in the list. NULL if last. */
538 /* data :: A typeless pointer to the listed object. */
540 typedef struct FT_ListNodeRec_
549 /*************************************************************************/
555 /* A structure used to hold a simple doubly-linked list. These are */
556 /* used in many parts of FreeType. */
559 /* head :: The head (first element) of doubly-linked list. */
561 /* tail :: The tail (last element) of doubly-linked list. */
563 typedef struct FT_ListRec_
573 #define FT_IS_EMPTY( list ) ( (list).head == 0 )
575 /* return base error code (without module-specific prefix) */
576 #define FT_ERROR_BASE( x ) ( (x) & 0xFF )
578 /* return module error code */
579 #define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U )
581 #define FT_BOOL( x ) ( (FT_Bool)( x ) )
585 #endif /* __FTTYPES_H__ */