Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:38:12

0001 /****************************************************************************
0002  *
0003  * fttypes.h
0004  *
0005  *   FreeType simple types definitions (specification only).
0006  *
0007  * Copyright (C) 1996-2023 by
0008  * David Turner, Robert Wilhelm, and Werner Lemberg.
0009  *
0010  * This file is part of the FreeType project, and may only be used,
0011  * modified, and distributed under the terms of the FreeType project
0012  * license, LICENSE.TXT.  By continuing to use, modify, or distribute
0013  * this file you indicate that you have read the license and
0014  * understand and accept it fully.
0015  *
0016  */
0017 
0018 
0019 #ifndef FTTYPES_H_
0020 #define FTTYPES_H_
0021 
0022 
0023 #include <ft2build.h>
0024 #include FT_CONFIG_CONFIG_H
0025 #include <freetype/ftsystem.h>
0026 #include <freetype/ftimage.h>
0027 
0028 #include <stddef.h>
0029 
0030 
0031 FT_BEGIN_HEADER
0032 
0033 
0034   /**************************************************************************
0035    *
0036    * @section:
0037    *   basic_types
0038    *
0039    * @title:
0040    *   Basic Data Types
0041    *
0042    * @abstract:
0043    *   The basic data types defined by the library.
0044    *
0045    * @description:
0046    *   This section contains the basic data types defined by FreeType~2,
0047    *   ranging from simple scalar types to bitmap descriptors.  More
0048    *   font-specific structures are defined in a different section.  Note
0049    *   that FreeType does not use floating-point data types.  Fractional
0050    *   values are represented by fixed-point integers, with lower bits
0051    *   storing the fractional part.
0052    *
0053    * @order:
0054    *   FT_Byte
0055    *   FT_Bytes
0056    *   FT_Char
0057    *   FT_Int
0058    *   FT_UInt
0059    *   FT_Int16
0060    *   FT_UInt16
0061    *   FT_Int32
0062    *   FT_UInt32
0063    *   FT_Int64
0064    *   FT_UInt64
0065    *   FT_Short
0066    *   FT_UShort
0067    *   FT_Long
0068    *   FT_ULong
0069    *   FT_Bool
0070    *   FT_Offset
0071    *   FT_PtrDist
0072    *   FT_String
0073    *   FT_Tag
0074    *   FT_Error
0075    *   FT_Fixed
0076    *   FT_Pointer
0077    *   FT_Pos
0078    *   FT_Vector
0079    *   FT_BBox
0080    *   FT_Matrix
0081    *   FT_FWord
0082    *   FT_UFWord
0083    *   FT_F2Dot14
0084    *   FT_UnitVector
0085    *   FT_F26Dot6
0086    *   FT_Data
0087    *
0088    *   FT_MAKE_TAG
0089    *
0090    *   FT_Generic
0091    *   FT_Generic_Finalizer
0092    *
0093    *   FT_Bitmap
0094    *   FT_Pixel_Mode
0095    *   FT_Palette_Mode
0096    *   FT_Glyph_Format
0097    *   FT_IMAGE_TAG
0098    *
0099    */
0100 
0101 
0102   /**************************************************************************
0103    *
0104    * @type:
0105    *   FT_Bool
0106    *
0107    * @description:
0108    *   A typedef of unsigned char, used for simple booleans.  As usual,
0109    *   values 1 and~0 represent true and false, respectively.
0110    */
0111   typedef unsigned char  FT_Bool;
0112 
0113 
0114   /**************************************************************************
0115    *
0116    * @type:
0117    *   FT_FWord
0118    *
0119    * @description:
0120    *   A signed 16-bit integer used to store a distance in original font
0121    *   units.
0122    */
0123   typedef signed short  FT_FWord;   /* distance in FUnits */
0124 
0125 
0126   /**************************************************************************
0127    *
0128    * @type:
0129    *   FT_UFWord
0130    *
0131    * @description:
0132    *   An unsigned 16-bit integer used to store a distance in original font
0133    *   units.
0134    */
0135   typedef unsigned short  FT_UFWord;  /* unsigned distance */
0136 
0137 
0138   /**************************************************************************
0139    *
0140    * @type:
0141    *   FT_Char
0142    *
0143    * @description:
0144    *   A simple typedef for the _signed_ char type.
0145    */
0146   typedef signed char  FT_Char;
0147 
0148 
0149   /**************************************************************************
0150    *
0151    * @type:
0152    *   FT_Byte
0153    *
0154    * @description:
0155    *   A simple typedef for the _unsigned_ char type.
0156    */
0157   typedef unsigned char  FT_Byte;
0158 
0159 
0160   /**************************************************************************
0161    *
0162    * @type:
0163    *   FT_Bytes
0164    *
0165    * @description:
0166    *   A typedef for constant memory areas.
0167    */
0168   typedef const FT_Byte*  FT_Bytes;
0169 
0170 
0171   /**************************************************************************
0172    *
0173    * @type:
0174    *   FT_Tag
0175    *
0176    * @description:
0177    *   A typedef for 32-bit tags (as used in the SFNT format).
0178    */
0179   typedef FT_UInt32  FT_Tag;
0180 
0181 
0182   /**************************************************************************
0183    *
0184    * @type:
0185    *   FT_String
0186    *
0187    * @description:
0188    *   A simple typedef for the char type, usually used for strings.
0189    */
0190   typedef char  FT_String;
0191 
0192 
0193   /**************************************************************************
0194    *
0195    * @type:
0196    *   FT_Short
0197    *
0198    * @description:
0199    *   A typedef for signed short.
0200    */
0201   typedef signed short  FT_Short;
0202 
0203 
0204   /**************************************************************************
0205    *
0206    * @type:
0207    *   FT_UShort
0208    *
0209    * @description:
0210    *   A typedef for unsigned short.
0211    */
0212   typedef unsigned short  FT_UShort;
0213 
0214 
0215   /**************************************************************************
0216    *
0217    * @type:
0218    *   FT_Int
0219    *
0220    * @description:
0221    *   A typedef for the int type.
0222    */
0223   typedef signed int  FT_Int;
0224 
0225 
0226   /**************************************************************************
0227    *
0228    * @type:
0229    *   FT_UInt
0230    *
0231    * @description:
0232    *   A typedef for the unsigned int type.
0233    */
0234   typedef unsigned int  FT_UInt;
0235 
0236 
0237   /**************************************************************************
0238    *
0239    * @type:
0240    *   FT_Long
0241    *
0242    * @description:
0243    *   A typedef for signed long.
0244    */
0245   typedef signed long  FT_Long;
0246 
0247 
0248   /**************************************************************************
0249    *
0250    * @type:
0251    *   FT_ULong
0252    *
0253    * @description:
0254    *   A typedef for unsigned long.
0255    */
0256   typedef unsigned long  FT_ULong;
0257 
0258 
0259   /**************************************************************************
0260    *
0261    * @type:
0262    *   FT_F2Dot14
0263    *
0264    * @description:
0265    *   A signed 2.14 fixed-point type used for unit vectors.
0266    */
0267   typedef signed short  FT_F2Dot14;
0268 
0269 
0270   /**************************************************************************
0271    *
0272    * @type:
0273    *   FT_F26Dot6
0274    *
0275    * @description:
0276    *   A signed 26.6 fixed-point type used for vectorial pixel coordinates.
0277    */
0278   typedef signed long  FT_F26Dot6;
0279 
0280 
0281   /**************************************************************************
0282    *
0283    * @type:
0284    *   FT_Fixed
0285    *
0286    * @description:
0287    *   This type is used to store 16.16 fixed-point values, like scaling
0288    *   values or matrix coefficients.
0289    */
0290   typedef signed long  FT_Fixed;
0291 
0292 
0293   /**************************************************************************
0294    *
0295    * @type:
0296    *   FT_Error
0297    *
0298    * @description:
0299    *   The FreeType error code type.  A value of~0 is always interpreted as a
0300    *   successful operation.
0301    */
0302   typedef int  FT_Error;
0303 
0304 
0305   /**************************************************************************
0306    *
0307    * @type:
0308    *   FT_Pointer
0309    *
0310    * @description:
0311    *   A simple typedef for a typeless pointer.
0312    */
0313   typedef void*  FT_Pointer;
0314 
0315 
0316   /**************************************************************************
0317    *
0318    * @type:
0319    *   FT_Offset
0320    *
0321    * @description:
0322    *   This is equivalent to the ANSI~C `size_t` type, i.e., the largest
0323    *   _unsigned_ integer type used to express a file size or position, or a
0324    *   memory block size.
0325    */
0326   typedef size_t  FT_Offset;
0327 
0328 
0329   /**************************************************************************
0330    *
0331    * @type:
0332    *   FT_PtrDist
0333    *
0334    * @description:
0335    *   This is equivalent to the ANSI~C `ptrdiff_t` type, i.e., the largest
0336    *   _signed_ integer type used to express the distance between two
0337    *   pointers.
0338    */
0339   typedef ft_ptrdiff_t  FT_PtrDist;
0340 
0341 
0342   /**************************************************************************
0343    *
0344    * @struct:
0345    *   FT_UnitVector
0346    *
0347    * @description:
0348    *   A simple structure used to store a 2D vector unit vector.  Uses
0349    *   FT_F2Dot14 types.
0350    *
0351    * @fields:
0352    *   x ::
0353    *     Horizontal coordinate.
0354    *
0355    *   y ::
0356    *     Vertical coordinate.
0357    */
0358   typedef struct  FT_UnitVector_
0359   {
0360     FT_F2Dot14  x;
0361     FT_F2Dot14  y;
0362 
0363   } FT_UnitVector;
0364 
0365 
0366   /**************************************************************************
0367    *
0368    * @struct:
0369    *   FT_Matrix
0370    *
0371    * @description:
0372    *   A simple structure used to store a 2x2 matrix.  Coefficients are in
0373    *   16.16 fixed-point format.  The computation performed is:
0374    *
0375    *   ```
0376    *     x' = x*xx + y*xy
0377    *     y' = x*yx + y*yy
0378    *   ```
0379    *
0380    * @fields:
0381    *   xx ::
0382    *     Matrix coefficient.
0383    *
0384    *   xy ::
0385    *     Matrix coefficient.
0386    *
0387    *   yx ::
0388    *     Matrix coefficient.
0389    *
0390    *   yy ::
0391    *     Matrix coefficient.
0392    */
0393   typedef struct  FT_Matrix_
0394   {
0395     FT_Fixed  xx, xy;
0396     FT_Fixed  yx, yy;
0397 
0398   } FT_Matrix;
0399 
0400 
0401   /**************************************************************************
0402    *
0403    * @struct:
0404    *   FT_Data
0405    *
0406    * @description:
0407    *   Read-only binary data represented as a pointer and a length.
0408    *
0409    * @fields:
0410    *   pointer ::
0411    *     The data.
0412    *
0413    *   length ::
0414    *     The length of the data in bytes.
0415    */
0416   typedef struct  FT_Data_
0417   {
0418     const FT_Byte*  pointer;
0419     FT_UInt         length;
0420 
0421   } FT_Data;
0422 
0423 
0424   /**************************************************************************
0425    *
0426    * @functype:
0427    *   FT_Generic_Finalizer
0428    *
0429    * @description:
0430    *   Describe a function used to destroy the 'client' data of any FreeType
0431    *   object.  See the description of the @FT_Generic type for details of
0432    *   usage.
0433    *
0434    * @input:
0435    *   The address of the FreeType object that is under finalization.  Its
0436    *   client data is accessed through its `generic` field.
0437    */
0438   typedef void  (*FT_Generic_Finalizer)( void*  object );
0439 
0440 
0441   /**************************************************************************
0442    *
0443    * @struct:
0444    *   FT_Generic
0445    *
0446    * @description:
0447    *   Client applications often need to associate their own data to a
0448    *   variety of FreeType core objects.  For example, a text layout API
0449    *   might want to associate a glyph cache to a given size object.
0450    *
0451    *   Some FreeType object contains a `generic` field, of type `FT_Generic`,
0452    *   which usage is left to client applications and font servers.
0453    *
0454    *   It can be used to store a pointer to client-specific data, as well as
0455    *   the address of a 'finalizer' function, which will be called by
0456    *   FreeType when the object is destroyed (for example, the previous
0457    *   client example would put the address of the glyph cache destructor in
0458    *   the `finalizer` field).
0459    *
0460    * @fields:
0461    *   data ::
0462    *     A typeless pointer to any client-specified data. This field is
0463    *     completely ignored by the FreeType library.
0464    *
0465    *   finalizer ::
0466    *     A pointer to a 'generic finalizer' function, which will be called
0467    *     when the object is destroyed.  If this field is set to `NULL`, no
0468    *     code will be called.
0469    */
0470   typedef struct  FT_Generic_
0471   {
0472     void*                 data;
0473     FT_Generic_Finalizer  finalizer;
0474 
0475   } FT_Generic;
0476 
0477 
0478   /**************************************************************************
0479    *
0480    * @macro:
0481    *   FT_MAKE_TAG
0482    *
0483    * @description:
0484    *   This macro converts four-letter tags that are used to label TrueType
0485    *   tables into an `FT_Tag` type, to be used within FreeType.
0486    *
0487    * @note:
0488    *   The produced values **must** be 32-bit integers.  Don't redefine this
0489    *   macro.
0490    */
0491 #define FT_MAKE_TAG( _x1, _x2, _x3, _x4 )                  \
0492           ( ( FT_STATIC_BYTE_CAST( FT_Tag, _x1 ) << 24 ) | \
0493             ( FT_STATIC_BYTE_CAST( FT_Tag, _x2 ) << 16 ) | \
0494             ( FT_STATIC_BYTE_CAST( FT_Tag, _x3 ) <<  8 ) | \
0495               FT_STATIC_BYTE_CAST( FT_Tag, _x4 )         )
0496 
0497 
0498   /*************************************************************************/
0499   /*************************************************************************/
0500   /*                                                                       */
0501   /*                    L I S T   M A N A G E M E N T                      */
0502   /*                                                                       */
0503   /*************************************************************************/
0504   /*************************************************************************/
0505 
0506 
0507   /**************************************************************************
0508    *
0509    * @section:
0510    *   list_processing
0511    *
0512    */
0513 
0514 
0515   /**************************************************************************
0516    *
0517    * @type:
0518    *   FT_ListNode
0519    *
0520    * @description:
0521    *    Many elements and objects in FreeType are listed through an @FT_List
0522    *    record (see @FT_ListRec).  As its name suggests, an FT_ListNode is a
0523    *    handle to a single list element.
0524    */
0525   typedef struct FT_ListNodeRec_*  FT_ListNode;
0526 
0527 
0528   /**************************************************************************
0529    *
0530    * @type:
0531    *   FT_List
0532    *
0533    * @description:
0534    *   A handle to a list record (see @FT_ListRec).
0535    */
0536   typedef struct FT_ListRec_*  FT_List;
0537 
0538 
0539   /**************************************************************************
0540    *
0541    * @struct:
0542    *   FT_ListNodeRec
0543    *
0544    * @description:
0545    *   A structure used to hold a single list element.
0546    *
0547    * @fields:
0548    *   prev ::
0549    *     The previous element in the list.  `NULL` if first.
0550    *
0551    *   next ::
0552    *     The next element in the list.  `NULL` if last.
0553    *
0554    *   data ::
0555    *     A typeless pointer to the listed object.
0556    */
0557   typedef struct  FT_ListNodeRec_
0558   {
0559     FT_ListNode  prev;
0560     FT_ListNode  next;
0561     void*        data;
0562 
0563   } FT_ListNodeRec;
0564 
0565 
0566   /**************************************************************************
0567    *
0568    * @struct:
0569    *   FT_ListRec
0570    *
0571    * @description:
0572    *   A structure used to hold a simple doubly-linked list.  These are used
0573    *   in many parts of FreeType.
0574    *
0575    * @fields:
0576    *   head ::
0577    *     The head (first element) of doubly-linked list.
0578    *
0579    *   tail ::
0580    *     The tail (last element) of doubly-linked list.
0581    */
0582   typedef struct  FT_ListRec_
0583   {
0584     FT_ListNode  head;
0585     FT_ListNode  tail;
0586 
0587   } FT_ListRec;
0588 
0589   /* */
0590 
0591 
0592 #define FT_IS_EMPTY( list )  ( (list).head == 0 )
0593 #define FT_BOOL( x )         FT_STATIC_CAST( FT_Bool, (x) != 0 )
0594 
0595   /* concatenate C tokens */
0596 #define FT_ERR_XCAT( x, y )  x ## y
0597 #define FT_ERR_CAT( x, y )   FT_ERR_XCAT( x, y )
0598 
0599   /* see `ftmoderr.h` for descriptions of the following macros */
0600 
0601 #define FT_ERR( e )  FT_ERR_CAT( FT_ERR_PREFIX, e )
0602 
0603 #define FT_ERROR_BASE( x )    ( (x) & 0xFF )
0604 #define FT_ERROR_MODULE( x )  ( (x) & 0xFF00U )
0605 
0606 #define FT_ERR_EQ( x, e )                                        \
0607           ( FT_ERROR_BASE( x ) == FT_ERROR_BASE( FT_ERR( e ) ) )
0608 #define FT_ERR_NEQ( x, e )                                       \
0609           ( FT_ERROR_BASE( x ) != FT_ERROR_BASE( FT_ERR( e ) ) )
0610 
0611 
0612 FT_END_HEADER
0613 
0614 #endif /* FTTYPES_H_ */
0615 
0616 
0617 /* END */