1 /****************************************************************************
5 * FreeType simple types definitions (specification only).
7 * Copyright (C) 1996-2020 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.
24 #include FT_CONFIG_CONFIG_H
25 #include <freetype/ftsystem.h>
26 #include <freetype/ftimage.h>
34 /**************************************************************************
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
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 font
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 coordinates.
275 typedef signed long FT_F26Dot6;
278 /**************************************************************************
284 * This type is used to store 16.16 fixed-point values, like scaling
285 * values or matrix coefficients.
287 typedef signed long FT_Fixed;
290 /**************************************************************************
296 * The FreeType error code type. A value of~0 is always interpreted as a
297 * successful operation.
299 typedef int FT_Error;
302 /**************************************************************************
308 * A simple typedef for a typeless pointer.
310 typedef void* FT_Pointer;
313 /**************************************************************************
319 * This is equivalent to the ANSI~C `size_t` type, i.e., the largest
320 * _unsigned_ integer type used to express a file size or position, or a
323 typedef size_t FT_Offset;
326 /**************************************************************************
332 * This is equivalent to the ANSI~C `ptrdiff_t` type, i.e., the largest
333 * _signed_ integer type used to express the distance between two
336 typedef ft_ptrdiff_t FT_PtrDist;
339 /**************************************************************************
345 * A simple structure used to store a 2D vector unit vector. Uses
350 * Horizontal coordinate.
353 * Vertical coordinate.
355 typedef struct FT_UnitVector_
363 /**************************************************************************
369 * A simple structure used to store a 2x2 matrix. Coefficients are in
370 * 16.16 fixed-point format. The computation performed is:
379 * Matrix coefficient.
382 * Matrix coefficient.
385 * Matrix coefficient.
388 * Matrix coefficient.
390 typedef struct FT_Matrix_
398 /**************************************************************************
404 * Read-only binary data represented as a pointer and a length.
411 * The length of the data in bytes.
413 typedef struct FT_Data_
415 const FT_Byte* pointer;
421 /**************************************************************************
424 * FT_Generic_Finalizer
427 * Describe a function used to destroy the 'client' data of any FreeType
428 * object. See the description of the @FT_Generic type for details of
432 * The address of the FreeType object that is under finalization. Its
433 * client data is accessed through its `generic` field.
435 typedef void (*FT_Generic_Finalizer)( void* object );
438 /**************************************************************************
444 * Client applications often need to associate their own data to a
445 * variety of FreeType core objects. For example, a text layout API
446 * might want to associate a glyph cache to a given size object.
448 * Some FreeType object contains a `generic` field, of type `FT_Generic`,
449 * which usage is left to client applications and font servers.
451 * It can be used to store a pointer to client-specific data, as well as
452 * the address of a 'finalizer' function, which will be called by
453 * FreeType when the object is destroyed (for example, the previous
454 * client example would put the address of the glyph cache destructor in
455 * the `finalizer` field).
459 * A typeless pointer to any client-specified data. This field is
460 * completely ignored by the FreeType library.
463 * A pointer to a 'generic finalizer' function, which will be called
464 * when the object is destroyed. If this field is set to `NULL`, no
465 * code will be called.
467 typedef struct FT_Generic_
470 FT_Generic_Finalizer finalizer;
475 /**************************************************************************
481 * This macro converts four-letter tags that are used to label TrueType
482 * tables into an unsigned long, to be used within FreeType.
485 * The produced values **must** be 32-bit integers. Don't redefine this
488 #define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
490 ( ( (FT_ULong)_x1 << 24 ) | \
491 ( (FT_ULong)_x2 << 16 ) | \
492 ( (FT_ULong)_x3 << 8 ) | \
496 /*************************************************************************/
497 /*************************************************************************/
499 /* L I S T M A N A G E M E N T */
501 /*************************************************************************/
502 /*************************************************************************/
505 /**************************************************************************
513 /**************************************************************************
519 * Many elements and objects in FreeType are listed through an @FT_List
520 * record (see @FT_ListRec). As its name suggests, an FT_ListNode is a
521 * handle to a single list element.
523 typedef struct FT_ListNodeRec_* FT_ListNode;
526 /**************************************************************************
532 * A handle to a list record (see @FT_ListRec).
534 typedef struct FT_ListRec_* FT_List;
537 /**************************************************************************
543 * A structure used to hold a single list element.
547 * The previous element in the list. `NULL` if first.
550 * The next element in the list. `NULL` if last.
553 * A typeless pointer to the listed object.
555 typedef struct FT_ListNodeRec_
564 /**************************************************************************
570 * A structure used to hold a simple doubly-linked list. These are used
571 * in many parts of FreeType.
575 * The head (first element) of doubly-linked list.
578 * The tail (last element) of doubly-linked list.
580 typedef struct FT_ListRec_
590 #define FT_IS_EMPTY( list ) ( (list).head == 0 )
591 #define FT_BOOL( x ) ( (FT_Bool)( (x) != 0 ) )
593 /* concatenate C tokens */
594 #define FT_ERR_XCAT( x, y ) x ## y
595 #define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y )
597 /* see `ftmoderr.h` for descriptions of the following macros */
599 #define FT_ERR( e ) FT_ERR_CAT( FT_ERR_PREFIX, e )
601 #define FT_ERROR_BASE( x ) ( (x) & 0xFF )
602 #define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U )
604 #define FT_ERR_EQ( x, e ) \
605 ( FT_ERROR_BASE( x ) == FT_ERROR_BASE( FT_ERR( e ) ) )
606 #define FT_ERR_NEQ( x, e ) \
607 ( FT_ERROR_BASE( x ) != FT_ERROR_BASE( FT_ERR( e ) ) )
612 #endif /* FTTYPES_H_ */