michael@0: /***************************************************************************/ michael@0: /* */ michael@0: /* fttypes.h */ michael@0: /* */ michael@0: /* FreeType simple types definitions (specification only). */ michael@0: /* */ michael@0: /* Copyright 1996-2002, 2004, 2006-2009, 2012, 2013 by */ michael@0: /* David Turner, Robert Wilhelm, and Werner Lemberg. */ michael@0: /* */ michael@0: /* This file is part of the FreeType project, and may only be used, */ michael@0: /* modified, and distributed under the terms of the FreeType project */ michael@0: /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ michael@0: /* this file you indicate that you have read the license and */ michael@0: /* understand and accept it fully. */ michael@0: /* */ michael@0: /***************************************************************************/ michael@0: michael@0: michael@0: #ifndef __FTTYPES_H__ michael@0: #define __FTTYPES_H__ michael@0: michael@0: michael@0: #include michael@0: #include FT_CONFIG_CONFIG_H michael@0: #include FT_SYSTEM_H michael@0: #include FT_IMAGE_H michael@0: michael@0: #include michael@0: michael@0: michael@0: FT_BEGIN_HEADER michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /*
*/ michael@0: /* basic_types */ michael@0: /* */ michael@0: /* */ michael@0: /* Basic Data Types */ michael@0: /* */ michael@0: /* <Abstract> */ michael@0: /* The basic data types defined by the library. */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* This section contains the basic data types defined by FreeType~2, */ michael@0: /* ranging from simple scalar types to bitmap descriptors. More */ michael@0: /* font-specific structures are defined in a different section. */ michael@0: /* */ michael@0: /* <Order> */ michael@0: /* FT_Byte */ michael@0: /* FT_Bytes */ michael@0: /* FT_Char */ michael@0: /* FT_Int */ michael@0: /* FT_UInt */ michael@0: /* FT_Int16 */ michael@0: /* FT_UInt16 */ michael@0: /* FT_Int32 */ michael@0: /* FT_UInt32 */ michael@0: /* FT_Short */ michael@0: /* FT_UShort */ michael@0: /* FT_Long */ michael@0: /* FT_ULong */ michael@0: /* FT_Bool */ michael@0: /* FT_Offset */ michael@0: /* FT_PtrDist */ michael@0: /* FT_String */ michael@0: /* FT_Tag */ michael@0: /* FT_Error */ michael@0: /* FT_Fixed */ michael@0: /* FT_Pointer */ michael@0: /* FT_Pos */ michael@0: /* FT_Vector */ michael@0: /* FT_BBox */ michael@0: /* FT_Matrix */ michael@0: /* FT_FWord */ michael@0: /* FT_UFWord */ michael@0: /* FT_F2Dot14 */ michael@0: /* FT_UnitVector */ michael@0: /* FT_F26Dot6 */ michael@0: /* */ michael@0: /* */ michael@0: /* FT_Generic */ michael@0: /* FT_Generic_Finalizer */ michael@0: /* */ michael@0: /* FT_Bitmap */ michael@0: /* FT_Pixel_Mode */ michael@0: /* FT_Palette_Mode */ michael@0: /* FT_Glyph_Format */ michael@0: /* FT_IMAGE_TAG */ michael@0: /* */ michael@0: /*************************************************************************/ michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_Bool */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A typedef of unsigned char, used for simple booleans. As usual, */ michael@0: /* values 1 and~0 represent true and false, respectively. */ michael@0: /* */ michael@0: typedef unsigned char FT_Bool; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_FWord */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A signed 16-bit integer used to store a distance in original font */ michael@0: /* units. */ michael@0: /* */ michael@0: typedef signed short FT_FWord; /* distance in FUnits */ michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_UFWord */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* An unsigned 16-bit integer used to store a distance in original */ michael@0: /* font units. */ michael@0: /* */ michael@0: typedef unsigned short FT_UFWord; /* unsigned distance */ michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_Char */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A simple typedef for the _signed_ char type. */ michael@0: /* */ michael@0: typedef signed char FT_Char; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_Byte */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A simple typedef for the _unsigned_ char type. */ michael@0: /* */ michael@0: typedef unsigned char FT_Byte; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_Bytes */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A typedef for constant memory areas. */ michael@0: /* */ michael@0: typedef const FT_Byte* FT_Bytes; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_Tag */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A typedef for 32-bit tags (as used in the SFNT format). */ michael@0: /* */ michael@0: typedef FT_UInt32 FT_Tag; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_String */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A simple typedef for the char type, usually used for strings. */ michael@0: /* */ michael@0: typedef char FT_String; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_Short */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A typedef for signed short. */ michael@0: /* */ michael@0: typedef signed short FT_Short; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_UShort */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A typedef for unsigned short. */ michael@0: /* */ michael@0: typedef unsigned short FT_UShort; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_Int */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A typedef for the int type. */ michael@0: /* */ michael@0: typedef signed int FT_Int; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_UInt */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A typedef for the unsigned int type. */ michael@0: /* */ michael@0: typedef unsigned int FT_UInt; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_Long */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A typedef for signed long. */ michael@0: /* */ michael@0: typedef signed long FT_Long; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_ULong */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A typedef for unsigned long. */ michael@0: /* */ michael@0: typedef unsigned long FT_ULong; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_F2Dot14 */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A signed 2.14 fixed-point type used for unit vectors. */ michael@0: /* */ michael@0: typedef signed short FT_F2Dot14; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_F26Dot6 */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A signed 26.6 fixed-point type used for vectorial pixel */ michael@0: /* coordinates. */ michael@0: /* */ michael@0: typedef signed long FT_F26Dot6; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_Fixed */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* This type is used to store 16.16 fixed-point values, like scaling */ michael@0: /* values or matrix coefficients. */ michael@0: /* */ michael@0: typedef signed long FT_Fixed; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_Error */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* The FreeType error code type. A value of~0 is always interpreted */ michael@0: /* as a successful operation. */ michael@0: /* */ michael@0: typedef int FT_Error; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_Pointer */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A simple typedef for a typeless pointer. */ michael@0: /* */ michael@0: typedef void* FT_Pointer; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_Offset */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* This is equivalent to the ANSI~C `size_t' type, i.e., the largest */ michael@0: /* _unsigned_ integer type used to express a file size or position, */ michael@0: /* or a memory block size. */ michael@0: /* */ michael@0: typedef size_t FT_Offset; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_PtrDist */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* This is equivalent to the ANSI~C `ptrdiff_t' type, i.e., the */ michael@0: /* largest _signed_ integer type used to express the distance */ michael@0: /* between two pointers. */ michael@0: /* */ michael@0: typedef ft_ptrdiff_t FT_PtrDist; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Struct> */ michael@0: /* FT_UnitVector */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A simple structure used to store a 2D vector unit vector. Uses */ michael@0: /* FT_F2Dot14 types. */ michael@0: /* */ michael@0: /* <Fields> */ michael@0: /* x :: Horizontal coordinate. */ michael@0: /* */ michael@0: /* y :: Vertical coordinate. */ michael@0: /* */ michael@0: typedef struct FT_UnitVector_ michael@0: { michael@0: FT_F2Dot14 x; michael@0: FT_F2Dot14 y; michael@0: michael@0: } FT_UnitVector; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Struct> */ michael@0: /* FT_Matrix */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A simple structure used to store a 2x2 matrix. Coefficients are */ michael@0: /* in 16.16 fixed-point format. The computation performed is: */ michael@0: /* */ michael@0: /* { */ michael@0: /* x' = x*xx + y*xy */ michael@0: /* y' = x*yx + y*yy */ michael@0: /* } */ michael@0: /* */ michael@0: /* <Fields> */ michael@0: /* xx :: Matrix coefficient. */ michael@0: /* */ michael@0: /* xy :: Matrix coefficient. */ michael@0: /* */ michael@0: /* yx :: Matrix coefficient. */ michael@0: /* */ michael@0: /* yy :: Matrix coefficient. */ michael@0: /* */ michael@0: typedef struct FT_Matrix_ michael@0: { michael@0: FT_Fixed xx, xy; michael@0: FT_Fixed yx, yy; michael@0: michael@0: } FT_Matrix; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Struct> */ michael@0: /* FT_Data */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* Read-only binary data represented as a pointer and a length. */ michael@0: /* */ michael@0: /* <Fields> */ michael@0: /* pointer :: The data. */ michael@0: /* */ michael@0: /* length :: The length of the data in bytes. */ michael@0: /* */ michael@0: typedef struct FT_Data_ michael@0: { michael@0: const FT_Byte* pointer; michael@0: FT_Int length; michael@0: michael@0: } FT_Data; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <FuncType> */ michael@0: /* FT_Generic_Finalizer */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* Describe a function used to destroy the `client' data of any */ michael@0: /* FreeType object. See the description of the @FT_Generic type for */ michael@0: /* details of usage. */ michael@0: /* */ michael@0: /* <Input> */ michael@0: /* The address of the FreeType object that is under finalization. */ michael@0: /* Its client data is accessed through its `generic' field. */ michael@0: /* */ michael@0: typedef void (*FT_Generic_Finalizer)(void* object); michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Struct> */ michael@0: /* FT_Generic */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* Client applications often need to associate their own data to a */ michael@0: /* variety of FreeType core objects. For example, a text layout API */ michael@0: /* might want to associate a glyph cache to a given size object. */ michael@0: /* */ michael@0: /* Some FreeType object contains a `generic' field, of type */ michael@0: /* FT_Generic, which usage is left to client applications and font */ michael@0: /* servers. */ michael@0: /* */ michael@0: /* It can be used to store a pointer to client-specific data, as well */ michael@0: /* as the address of a `finalizer' function, which will be called by */ michael@0: /* FreeType when the object is destroyed (for example, the previous */ michael@0: /* client example would put the address of the glyph cache destructor */ michael@0: /* in the `finalizer' field). */ michael@0: /* */ michael@0: /* <Fields> */ michael@0: /* data :: A typeless pointer to any client-specified data. This */ michael@0: /* field is completely ignored by the FreeType library. */ michael@0: /* */ michael@0: /* finalizer :: A pointer to a `generic finalizer' function, which */ michael@0: /* will be called when the object is destroyed. If this */ michael@0: /* field is set to NULL, no code will be called. */ michael@0: /* */ michael@0: typedef struct FT_Generic_ michael@0: { michael@0: void* data; michael@0: FT_Generic_Finalizer finalizer; michael@0: michael@0: } FT_Generic; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Macro> */ michael@0: /* FT_MAKE_TAG */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* This macro converts four-letter tags that are used to label */ michael@0: /* TrueType tables into an unsigned long, to be used within FreeType. */ michael@0: /* */ michael@0: /* <Note> */ michael@0: /* The produced values *must* be 32-bit integers. Don't redefine */ michael@0: /* this macro. */ michael@0: /* */ michael@0: #define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \ michael@0: (FT_Tag) \ michael@0: ( ( (FT_ULong)_x1 << 24 ) | \ michael@0: ( (FT_ULong)_x2 << 16 ) | \ michael@0: ( (FT_ULong)_x3 << 8 ) | \ michael@0: (FT_ULong)_x4 ) michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* L I S T M A N A G E M E N T */ michael@0: /* */ michael@0: /*************************************************************************/ michael@0: /*************************************************************************/ michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Section> */ michael@0: /* list_processing */ michael@0: /* */ michael@0: /*************************************************************************/ michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_ListNode */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* Many elements and objects in FreeType are listed through an */ michael@0: /* @FT_List record (see @FT_ListRec). As its name suggests, an */ michael@0: /* FT_ListNode is a handle to a single list element. */ michael@0: /* */ michael@0: typedef struct FT_ListNodeRec_* FT_ListNode; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Type> */ michael@0: /* FT_List */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A handle to a list record (see @FT_ListRec). */ michael@0: /* */ michael@0: typedef struct FT_ListRec_* FT_List; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Struct> */ michael@0: /* FT_ListNodeRec */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A structure used to hold a single list element. */ michael@0: /* */ michael@0: /* <Fields> */ michael@0: /* prev :: The previous element in the list. NULL if first. */ michael@0: /* */ michael@0: /* next :: The next element in the list. NULL if last. */ michael@0: /* */ michael@0: /* data :: A typeless pointer to the listed object. */ michael@0: /* */ michael@0: typedef struct FT_ListNodeRec_ michael@0: { michael@0: FT_ListNode prev; michael@0: FT_ListNode next; michael@0: void* data; michael@0: michael@0: } FT_ListNodeRec; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Struct> */ michael@0: /* FT_ListRec */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A structure used to hold a simple doubly-linked list. These are */ michael@0: /* used in many parts of FreeType. */ michael@0: /* */ michael@0: /* <Fields> */ michael@0: /* head :: The head (first element) of doubly-linked list. */ michael@0: /* */ michael@0: /* tail :: The tail (last element) of doubly-linked list. */ michael@0: /* */ michael@0: typedef struct FT_ListRec_ michael@0: { michael@0: FT_ListNode head; michael@0: FT_ListNode tail; michael@0: michael@0: } FT_ListRec; michael@0: michael@0: michael@0: /* */ michael@0: michael@0: #define FT_IS_EMPTY( list ) ( (list).head == 0 ) michael@0: #define FT_BOOL( x ) ( (FT_Bool)( x ) ) michael@0: michael@0: /* concatenate C tokens */ michael@0: #define FT_ERR_XCAT( x, y ) x ## y michael@0: #define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y ) michael@0: michael@0: /* see `ftmoderr.h' for descriptions of the following macros */ michael@0: michael@0: #define FT_ERR( e ) FT_ERR_CAT( FT_ERR_PREFIX, e ) michael@0: michael@0: #define FT_ERROR_BASE( x ) ( (x) & 0xFF ) michael@0: #define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U ) michael@0: michael@0: #define FT_ERR_EQ( x, e ) \ michael@0: ( FT_ERROR_BASE( x ) == FT_ERROR_BASE( FT_ERR( e ) ) ) michael@0: #define FT_ERR_NEQ( x, e ) \ michael@0: ( FT_ERROR_BASE( x ) != FT_ERROR_BASE( FT_ERR( e ) ) ) michael@0: michael@0: michael@0: FT_END_HEADER michael@0: michael@0: #endif /* __FTTYPES_H__ */ michael@0: michael@0: michael@0: /* END */