home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: SysTools / SysTools.zip / ft-beta.zip / freetype / lib / tttypes.h < prev   
C/C++ Source or Header  |  1997-10-06  |  4KB  |  173 lines

  1. /*******************************************************************
  2.  *
  3.  *  tttypes.h
  4.  *
  5.  *    Freetype engine's common types specification
  6.  *    (this spec has no associated body).
  7.  *
  8.  *  Copyright 1996, 1997 by
  9.  *  David Turner, Robert Wilhelm, and Werner Lemberg.
  10.  *
  11.  *  This file is part of the FreeType project, and may only be used
  12.  *  modified and distributed under the terms of the FreeType project
  13.  *  license, LICENSE.TXT. By continuing to use, modify or distribute 
  14.  *  this file you indicate that you have read the license and
  15.  *  understand and accept it fully.
  16.  *
  17.  *  NOTE : 
  18.  *
  19.  *   All these declarations are library internals, and *not* part
  20.  *   of the high-level interface. See also 'freetype.h'.
  21.  *
  22.  ******************************************************************/
  23.  
  24. #ifndef TTTYPES_H
  25. #define TTTYPES_H
  26.  
  27. #include "ttconfig.h"
  28. #include "freetype.h"
  29.  
  30. #ifdef DEBUG
  31. #ifndef ARM_1212
  32. #include <stdlib.h>
  33. #include <stdio.h>
  34. #else
  35. #include "std.h"
  36. #endif
  37. #endif
  38.  
  39.   typedef unsigned char   Byte;
  40.  
  41.   typedef unsigned short  UShort;
  42.   typedef signed   short  Short;
  43.  
  44.   typedef unsigned long   ULong;
  45.   typedef signed   long   Long;
  46.  
  47. #if SIZEOF_INT == 4
  48.   typedef int             Fixed;    /* signed fixed 16.16 float */
  49.  
  50. #elif SIZEOF_LONG == 4
  51.   typedef long            Fixed;    /* signed fixed 16.16 float */
  52.  
  53. #else
  54.   #error "no 32bit type found"
  55. #endif
  56.  
  57.   typedef int             Int;
  58.  
  59.   typedef long            Integer;
  60.   
  61.   /* Simple access types: pointers and tables */
  62.  
  63.   typedef Byte*    PByte;
  64.   typedef UShort*  PUShort;
  65.   typedef Short*   PShort;
  66.   typedef ULong*   PULong;
  67.   typedef Long*    PLong;
  68.  
  69.   typedef Fixed*   PFixed;
  70.  
  71.   typedef Int*     PInt;
  72.  
  73.   typedef void*    Pointer;
  74.  
  75.   typedef TT_F26Dot6*     PCoordinates;
  76.   typedef unsigned char*  PTouchTable;
  77.  
  78.   typedef struct  _TVecRecord
  79.   {
  80.     int              n;      /* number of points in zone    */
  81.  
  82.     PCoordinates  org_x;  /* original points coordinates */
  83.     PCoordinates  org_y;  /* original points coordinates */
  84.     PCoordinates  cur_x;  /* current points coordinates  */
  85.     PCoordinates  cur_y;  /* current points coordinates  */
  86.  
  87.     PTouchTable   touch;  /* current touch flags         */
  88.  
  89.   } TVecRecord;
  90.  
  91.   /* This type defining a set of glyph points will be used to represent */
  92.   /* each zone (regular and twilight) during instructions decoding.     */
  93.   typedef TVecRecord*  PVecRecord;
  94.  
  95.  
  96.  
  97.  
  98. #ifndef Bool
  99.   typedef int  Bool;        /* No boolean type in C */
  100. #endif
  101.  
  102. #ifndef TRUE
  103. #define TRUE  1
  104. #endif
  105.  
  106. #ifndef FALSE
  107. #define FALSE  0
  108. #endif
  109.  
  110. #ifndef NULL
  111. #define NULL  (void*)0
  112. #endif
  113.  
  114.   typedef long*  PStorage;
  115.  
  116.  
  117. /* Rounding mode constants */
  118.  
  119. #define TT_Round_Off             5
  120. #define TT_Round_To_Half_Grid    0
  121. #define TT_Round_To_Grid         1
  122. #define TT_Round_To_Double_Grid  2
  123. #define TT_Round_Up_To_Grid      4
  124. #define TT_Round_Down_To_Grid    3
  125. #define TT_Round_Super           6
  126. #define TT_Round_Super_45        7
  127.  
  128.  
  129. /* Touch flag masks */
  130.  
  131. #define TT_Flag_On_Curve      1
  132. #define TT_Flag_Touched_X     2
  133. #define TT_Flag_Touched_Y     4
  134. #define TT_Flag_Touched_Both  6
  135.  
  136.  
  137. /* Error management constants :) */
  138.  
  139. #define SUCCESS  0
  140. #define FAILURE  -1
  141.  
  142.  
  143. /* The min and max functions missing in C. As usual, be careful not to
  144.    write things like MIN( a++, b++ ) to avoid side effects.            */
  145.  
  146. #ifndef MIN
  147. #define MIN( a, b )  ( (a) < (b) ? (a) : (b) )
  148. #endif
  149.  
  150. #ifndef MAX
  151. #define MAX( a, b )  ( (a) > (b) ? (a) : (b) )
  152. #endif
  153.  
  154. /* conversion macros for the handles defined in freetype.h */
  155.  
  156. #define HANDLE_Val(handle)  ((handle).z)
  157.  
  158. #define HANDLE_Face(handle) ((PFace)HANDLE_Val(handle))
  159.  
  160. #define HANDLE_Instance(handle) ((PInstance)HANDLE_Val(handle))
  161.  
  162. /* HANDLE_Stream(handle) must be defined in ttfile.c */
  163.  
  164. #define HANDLE_Glyph(handle)    ((PGlyph)HANDLE_Val(handle))
  165.  
  166. #define HANDLE_CharMap(handle)  ((PCMapTable)HANDLE_Val(handle))
  167.  
  168. #define HANDLE_Set(handle,val)  ((handle).z = (void*)(val))
  169.  
  170. #endif /* TTTYPES_H */
  171.  
  172. /* End */
  173.