add SDL2_ttf support
[platform/upstream/SDL.git] / extension / SDL2_ttf-2.0.14 / external / freetype-2.4.12 / include / freetype / fttypes.h
1 /***************************************************************************/
2 /*                                                                         */
3 /*  fttypes.h                                                              */
4 /*                                                                         */
5 /*    FreeType simple types definitions (specification only).              */
6 /*                                                                         */
7 /*  Copyright 1996-2002, 2004, 2006-2009, 2012, 2013 by                    */
8 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
9 /*                                                                         */
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.                                        */
15 /*                                                                         */
16 /***************************************************************************/
17
18
19 #ifndef __FTTYPES_H__
20 #define __FTTYPES_H__
21
22
23 #include <ft2build.h>
24 #include FT_CONFIG_CONFIG_H
25 #include FT_SYSTEM_H
26 #include FT_IMAGE_H
27
28 #include <stddef.h>
29
30
31 FT_BEGIN_HEADER
32
33
34   /*************************************************************************/
35   /*                                                                       */
36   /* <Section>                                                             */
37   /*    basic_types                                                        */
38   /*                                                                       */
39   /* <Title>                                                               */
40   /*    Basic Data Types                                                   */
41   /*                                                                       */
42   /* <Abstract>                                                            */
43   /*    The basic data types defined by the library.                       */
44   /*                                                                       */
45   /* <Description>                                                         */
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.       */
49   /*                                                                       */
50   /* <Order>                                                               */
51   /*    FT_Byte                                                            */
52   /*    FT_Bytes                                                           */
53   /*    FT_Char                                                            */
54   /*    FT_Int                                                             */
55   /*    FT_UInt                                                            */
56   /*    FT_Int16                                                           */
57   /*    FT_UInt16                                                          */
58   /*    FT_Int32                                                           */
59   /*    FT_UInt32                                                          */
60   /*    FT_Short                                                           */
61   /*    FT_UShort                                                          */
62   /*    FT_Long                                                            */
63   /*    FT_ULong                                                           */
64   /*    FT_Bool                                                            */
65   /*    FT_Offset                                                          */
66   /*    FT_PtrDist                                                         */
67   /*    FT_String                                                          */
68   /*    FT_Tag                                                             */
69   /*    FT_Error                                                           */
70   /*    FT_Fixed                                                           */
71   /*    FT_Pointer                                                         */
72   /*    FT_Pos                                                             */
73   /*    FT_Vector                                                          */
74   /*    FT_BBox                                                            */
75   /*    FT_Matrix                                                          */
76   /*    FT_FWord                                                           */
77   /*    FT_UFWord                                                          */
78   /*    FT_F2Dot14                                                         */
79   /*    FT_UnitVector                                                      */
80   /*    FT_F26Dot6                                                         */
81   /*                                                                       */
82   /*                                                                       */
83   /*    FT_Generic                                                         */
84   /*    FT_Generic_Finalizer                                               */
85   /*                                                                       */
86   /*    FT_Bitmap                                                          */
87   /*    FT_Pixel_Mode                                                      */
88   /*    FT_Palette_Mode                                                    */
89   /*    FT_Glyph_Format                                                    */
90   /*    FT_IMAGE_TAG                                                       */
91   /*                                                                       */
92   /*************************************************************************/
93
94
95   /*************************************************************************/
96   /*                                                                       */
97   /* <Type>                                                                */
98   /*    FT_Bool                                                            */
99   /*                                                                       */
100   /* <Description>                                                         */
101   /*    A typedef of unsigned char, used for simple booleans.  As usual,   */
102   /*    values 1 and~0 represent true and false, respectively.             */
103   /*                                                                       */
104   typedef unsigned char  FT_Bool;
105
106
107   /*************************************************************************/
108   /*                                                                       */
109   /* <Type>                                                                */
110   /*    FT_FWord                                                           */
111   /*                                                                       */
112   /* <Description>                                                         */
113   /*    A signed 16-bit integer used to store a distance in original font  */
114   /*    units.                                                             */
115   /*                                                                       */
116   typedef signed short  FT_FWord;   /* distance in FUnits */
117
118
119   /*************************************************************************/
120   /*                                                                       */
121   /* <Type>                                                                */
122   /*    FT_UFWord                                                          */
123   /*                                                                       */
124   /* <Description>                                                         */
125   /*    An unsigned 16-bit integer used to store a distance in original    */
126   /*    font units.                                                        */
127   /*                                                                       */
128   typedef unsigned short  FT_UFWord;  /* unsigned distance */
129
130
131   /*************************************************************************/
132   /*                                                                       */
133   /* <Type>                                                                */
134   /*    FT_Char                                                            */
135   /*                                                                       */
136   /* <Description>                                                         */
137   /*    A simple typedef for the _signed_ char type.                       */
138   /*                                                                       */
139   typedef signed char  FT_Char;
140
141
142   /*************************************************************************/
143   /*                                                                       */
144   /* <Type>                                                                */
145   /*    FT_Byte                                                            */
146   /*                                                                       */
147   /* <Description>                                                         */
148   /*    A simple typedef for the _unsigned_ char type.                     */
149   /*                                                                       */
150   typedef unsigned char  FT_Byte;
151
152
153   /*************************************************************************/
154   /*                                                                       */
155   /* <Type>                                                                */
156   /*    FT_Bytes                                                           */
157   /*                                                                       */
158   /* <Description>                                                         */
159   /*    A typedef for constant memory areas.                               */
160   /*                                                                       */
161   typedef const FT_Byte*  FT_Bytes;
162
163
164   /*************************************************************************/
165   /*                                                                       */
166   /* <Type>                                                                */
167   /*    FT_Tag                                                             */
168   /*                                                                       */
169   /* <Description>                                                         */
170   /*    A typedef for 32-bit tags (as used in the SFNT format).            */
171   /*                                                                       */
172   typedef FT_UInt32  FT_Tag;
173
174
175   /*************************************************************************/
176   /*                                                                       */
177   /* <Type>                                                                */
178   /*    FT_String                                                          */
179   /*                                                                       */
180   /* <Description>                                                         */
181   /*    A simple typedef for the char type, usually used for strings.      */
182   /*                                                                       */
183   typedef char  FT_String;
184
185
186   /*************************************************************************/
187   /*                                                                       */
188   /* <Type>                                                                */
189   /*    FT_Short                                                           */
190   /*                                                                       */
191   /* <Description>                                                         */
192   /*    A typedef for signed short.                                        */
193   /*                                                                       */
194   typedef signed short  FT_Short;
195
196
197   /*************************************************************************/
198   /*                                                                       */
199   /* <Type>                                                                */
200   /*    FT_UShort                                                          */
201   /*                                                                       */
202   /* <Description>                                                         */
203   /*    A typedef for unsigned short.                                      */
204   /*                                                                       */
205   typedef unsigned short  FT_UShort;
206
207
208   /*************************************************************************/
209   /*                                                                       */
210   /* <Type>                                                                */
211   /*    FT_Int                                                             */
212   /*                                                                       */
213   /* <Description>                                                         */
214   /*    A typedef for the int type.                                        */
215   /*                                                                       */
216   typedef signed int  FT_Int;
217
218
219   /*************************************************************************/
220   /*                                                                       */
221   /* <Type>                                                                */
222   /*    FT_UInt                                                            */
223   /*                                                                       */
224   /* <Description>                                                         */
225   /*    A typedef for the unsigned int type.                               */
226   /*                                                                       */
227   typedef unsigned int  FT_UInt;
228
229
230   /*************************************************************************/
231   /*                                                                       */
232   /* <Type>                                                                */
233   /*    FT_Long                                                            */
234   /*                                                                       */
235   /* <Description>                                                         */
236   /*    A typedef for signed long.                                         */
237   /*                                                                       */
238   typedef signed long  FT_Long;
239
240
241   /*************************************************************************/
242   /*                                                                       */
243   /* <Type>                                                                */
244   /*    FT_ULong                                                           */
245   /*                                                                       */
246   /* <Description>                                                         */
247   /*    A typedef for unsigned long.                                       */
248   /*                                                                       */
249   typedef unsigned long  FT_ULong;
250
251
252   /*************************************************************************/
253   /*                                                                       */
254   /* <Type>                                                                */
255   /*    FT_F2Dot14                                                         */
256   /*                                                                       */
257   /* <Description>                                                         */
258   /*    A signed 2.14 fixed-point type used for unit vectors.              */
259   /*                                                                       */
260   typedef signed short  FT_F2Dot14;
261
262
263   /*************************************************************************/
264   /*                                                                       */
265   /* <Type>                                                                */
266   /*    FT_F26Dot6                                                         */
267   /*                                                                       */
268   /* <Description>                                                         */
269   /*    A signed 26.6 fixed-point type used for vectorial pixel            */
270   /*    coordinates.                                                       */
271   /*                                                                       */
272   typedef signed long  FT_F26Dot6;
273
274
275   /*************************************************************************/
276   /*                                                                       */
277   /* <Type>                                                                */
278   /*    FT_Fixed                                                           */
279   /*                                                                       */
280   /* <Description>                                                         */
281   /*    This type is used to store 16.16 fixed-point values, like scaling  */
282   /*    values or matrix coefficients.                                     */
283   /*                                                                       */
284   typedef signed long  FT_Fixed;
285
286
287   /*************************************************************************/
288   /*                                                                       */
289   /* <Type>                                                                */
290   /*    FT_Error                                                           */
291   /*                                                                       */
292   /* <Description>                                                         */
293   /*    The FreeType error code type.  A value of~0 is always interpreted  */
294   /*    as a successful operation.                                         */
295   /*                                                                       */
296   typedef int  FT_Error;
297
298
299   /*************************************************************************/
300   /*                                                                       */
301   /* <Type>                                                                */
302   /*    FT_Pointer                                                         */
303   /*                                                                       */
304   /* <Description>                                                         */
305   /*    A simple typedef for a typeless pointer.                           */
306   /*                                                                       */
307   typedef void*  FT_Pointer;
308
309
310   /*************************************************************************/
311   /*                                                                       */
312   /* <Type>                                                                */
313   /*    FT_Offset                                                          */
314   /*                                                                       */
315   /* <Description>                                                         */
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.                                            */
319   /*                                                                       */
320   typedef size_t  FT_Offset;
321
322
323   /*************************************************************************/
324   /*                                                                       */
325   /* <Type>                                                                */
326   /*    FT_PtrDist                                                         */
327   /*                                                                       */
328   /* <Description>                                                         */
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.                                              */
332   /*                                                                       */
333   typedef ft_ptrdiff_t  FT_PtrDist;
334
335
336   /*************************************************************************/
337   /*                                                                       */
338   /* <Struct>                                                              */
339   /*    FT_UnitVector                                                      */
340   /*                                                                       */
341   /* <Description>                                                         */
342   /*    A simple structure used to store a 2D vector unit vector.  Uses    */
343   /*    FT_F2Dot14 types.                                                  */
344   /*                                                                       */
345   /* <Fields>                                                              */
346   /*    x :: Horizontal coordinate.                                        */
347   /*                                                                       */
348   /*    y :: Vertical coordinate.                                          */
349   /*                                                                       */
350   typedef struct  FT_UnitVector_
351   {
352     FT_F2Dot14  x;
353     FT_F2Dot14  y;
354
355   } FT_UnitVector;
356
357
358   /*************************************************************************/
359   /*                                                                       */
360   /* <Struct>                                                              */
361   /*    FT_Matrix                                                          */
362   /*                                                                       */
363   /* <Description>                                                         */
364   /*    A simple structure used to store a 2x2 matrix.  Coefficients are   */
365   /*    in 16.16 fixed-point format.  The computation performed is:        */
366   /*                                                                       */
367   /*       {                                                               */
368   /*          x' = x*xx + y*xy                                             */
369   /*          y' = x*yx + y*yy                                             */
370   /*       }                                                               */
371   /*                                                                       */
372   /* <Fields>                                                              */
373   /*    xx :: Matrix coefficient.                                          */
374   /*                                                                       */
375   /*    xy :: Matrix coefficient.                                          */
376   /*                                                                       */
377   /*    yx :: Matrix coefficient.                                          */
378   /*                                                                       */
379   /*    yy :: Matrix coefficient.                                          */
380   /*                                                                       */
381   typedef struct  FT_Matrix_
382   {
383     FT_Fixed  xx, xy;
384     FT_Fixed  yx, yy;
385
386   } FT_Matrix;
387
388
389   /*************************************************************************/
390   /*                                                                       */
391   /* <Struct>                                                              */
392   /*    FT_Data                                                            */
393   /*                                                                       */
394   /* <Description>                                                         */
395   /*    Read-only binary data represented as a pointer and a length.       */
396   /*                                                                       */
397   /* <Fields>                                                              */
398   /*    pointer :: The data.                                               */
399   /*                                                                       */
400   /*    length  :: The length of the data in bytes.                        */
401   /*                                                                       */
402   typedef struct  FT_Data_
403   {
404     const FT_Byte*  pointer;
405     FT_Int          length;
406
407   } FT_Data;
408
409
410   /*************************************************************************/
411   /*                                                                       */
412   /* <FuncType>                                                            */
413   /*    FT_Generic_Finalizer                                               */
414   /*                                                                       */
415   /* <Description>                                                         */
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.                                                  */
419   /*                                                                       */
420   /* <Input>                                                               */
421   /*    The address of the FreeType object which is under finalization.    */
422   /*    Its client data is accessed through its `generic' field.           */
423   /*                                                                       */
424   typedef void  (*FT_Generic_Finalizer)(void*  object);
425
426
427   /*************************************************************************/
428   /*                                                                       */
429   /* <Struct>                                                              */
430   /*    FT_Generic                                                         */
431   /*                                                                       */
432   /* <Description>                                                         */
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.      */
436   /*                                                                       */
437   /*    Some FreeType object contains a `generic' field, of type           */
438   /*    FT_Generic, which usage is left to client applications and font    */
439   /*    servers.                                                           */
440   /*                                                                       */
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).                                         */
446   /*                                                                       */
447   /* <Fields>                                                              */
448   /*    data      :: A typeless pointer to any client-specified data. This */
449   /*                 field is completely ignored by the FreeType library.  */
450   /*                                                                       */
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.         */
454   /*                                                                       */
455   typedef struct  FT_Generic_
456   {
457     void*                 data;
458     FT_Generic_Finalizer  finalizer;
459
460   } FT_Generic;
461
462
463   /*************************************************************************/
464   /*                                                                       */
465   /* <Macro>                                                               */
466   /*    FT_MAKE_TAG                                                        */
467   /*                                                                       */
468   /* <Description>                                                         */
469   /*    This macro converts four-letter tags which are used to label       */
470   /*    TrueType tables into an unsigned long to be used within FreeType.  */
471   /*                                                                       */
472   /* <Note>                                                                */
473   /*    The produced values *must* be 32-bit integers.  Don't redefine     */
474   /*    this macro.                                                        */
475   /*                                                                       */
476 #define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
477           (FT_Tag)                        \
478           ( ( (FT_ULong)_x1 << 24 ) |     \
479             ( (FT_ULong)_x2 << 16 ) |     \
480             ( (FT_ULong)_x3 <<  8 ) |     \
481               (FT_ULong)_x4         )
482
483
484   /*************************************************************************/
485   /*************************************************************************/
486   /*                                                                       */
487   /*                    L I S T   M A N A G E M E N T                      */
488   /*                                                                       */
489   /*************************************************************************/
490   /*************************************************************************/
491
492
493   /*************************************************************************/
494   /*                                                                       */
495   /* <Section>                                                             */
496   /*    list_processing                                                    */
497   /*                                                                       */
498   /*************************************************************************/
499
500
501   /*************************************************************************/
502   /*                                                                       */
503   /* <Type>                                                                */
504   /*    FT_ListNode                                                        */
505   /*                                                                       */
506   /* <Description>                                                         */
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.                 */
510   /*                                                                       */
511   typedef struct FT_ListNodeRec_*  FT_ListNode;
512
513
514   /*************************************************************************/
515   /*                                                                       */
516   /* <Type>                                                                */
517   /*    FT_List                                                            */
518   /*                                                                       */
519   /* <Description>                                                         */
520   /*    A handle to a list record (see @FT_ListRec).                       */
521   /*                                                                       */
522   typedef struct FT_ListRec_*  FT_List;
523
524
525   /*************************************************************************/
526   /*                                                                       */
527   /* <Struct>                                                              */
528   /*    FT_ListNodeRec                                                     */
529   /*                                                                       */
530   /* <Description>                                                         */
531   /*    A structure used to hold a single list element.                    */
532   /*                                                                       */
533   /* <Fields>                                                              */
534   /*    prev :: The previous element in the list.  NULL if first.          */
535   /*                                                                       */
536   /*    next :: The next element in the list.  NULL if last.               */
537   /*                                                                       */
538   /*    data :: A typeless pointer to the listed object.                   */
539   /*                                                                       */
540   typedef struct  FT_ListNodeRec_
541   {
542     FT_ListNode  prev;
543     FT_ListNode  next;
544     void*        data;
545
546   } FT_ListNodeRec;
547
548
549   /*************************************************************************/
550   /*                                                                       */
551   /* <Struct>                                                              */
552   /*    FT_ListRec                                                         */
553   /*                                                                       */
554   /* <Description>                                                         */
555   /*    A structure used to hold a simple doubly-linked list.  These are   */
556   /*    used in many parts of FreeType.                                    */
557   /*                                                                       */
558   /* <Fields>                                                              */
559   /*    head :: The head (first element) of doubly-linked list.            */
560   /*                                                                       */
561   /*    tail :: The tail (last element) of doubly-linked list.             */
562   /*                                                                       */
563   typedef struct  FT_ListRec_
564   {
565     FT_ListNode  head;
566     FT_ListNode  tail;
567
568   } FT_ListRec;
569
570
571   /* */
572
573 #define FT_IS_EMPTY( list )  ( (list).head == 0 )
574 #define FT_BOOL( x )  ( (FT_Bool)( x ) )
575
576   /* concatenate C tokens */
577 #define FT_ERR_XCAT( x, y )  x ## y
578 #define FT_ERR_CAT( x, y )   FT_ERR_XCAT( x, y )
579
580   /* see `ftmoderr.h' for descriptions of the following macros */
581
582 #define FT_ERR( e )  FT_ERR_CAT( FT_ERR_PREFIX, e )
583
584 #define FT_ERROR_BASE( x )    ( (x) & 0xFF )
585 #define FT_ERROR_MODULE( x )  ( (x) & 0xFF00U )
586
587 #define FT_ERR_EQ( x, e )                                        \
588           ( FT_ERROR_BASE( x ) == FT_ERROR_BASE( FT_ERR( e ) ) )
589 #define FT_ERR_NEQ( x, e )                                       \
590           ( FT_ERROR_BASE( x ) != FT_ERROR_BASE( FT_ERR( e ) ) )
591
592
593 FT_END_HEADER
594
595 #endif /* __FTTYPES_H__ */
596
597
598 /* END */