1 /* Copyright (C) 2003 Aladdin Enterprises. All rights reserved. 2 3 This software is provided AS-IS with no warranty, either express or 4 implied. 5 6 This software is distributed under license and may not be copied, 7 modified or distributed except as expressly authorized under the terms 8 of the license contained in the file LICENSE in this distribution. 9 10 For more information about licensing, please refer to 11 http://www.ghostscript.com/licensing/. For information on 12 commercial licensing, go to http://www.artifex.com/licensing/ or 13 contact Artifex Software, Inc., 101 Lucas Valley Road #110, 14 San Rafael, CA 94903, U.S.A., +1(415)492-9861. 15 */ 16 17 /* $Id: tttypes.h,v 1.2 2005/05/31 13:05:20 igor Exp $ */ 18 19 /* Changes after FreeType: cut out the TrueType instruction interpreter. */ 20 21 22 /******************************************************************* 23 * 24 * tttypes.h 25 * 26 * Freetype engine's common types specification 27 * (this spec has no associated body). 28 * 29 * Copyright 1996-1998 by 30 * David Turner, Robert Wilhelm, and Werner Lemberg. 31 * 32 * This file is part of the FreeType project, and may only be used 33 * modified and distributed under the terms of the FreeType project 34 * license, LICENSE.TXT. By continuing to use, modify, or distribute 35 * this file you indicate that you have read the license and 36 * understand and accept it fully. 37 * 38 * NOTE: 39 * 40 * All these declarations are library internals, and *not* part 41 * of the high-level interface. See also 'freetype.h'. 42 * 43 ******************************************************************/ 44 45 #ifndef TTTYPES_H 46 #define TTTYPES_H 47 48 #include "ttconfig.h" 49 #include "tttype.h" 50 51 #ifdef DEBUG 52 #ifndef ARM_1212 53 #include <stdlib.h> 54 #include <stdio.h> 55 #else 56 #include "std.h" 57 #endif 58 #endif 59 60 typedef unsigned char Byte; 61 62 typedef unsigned short UShort; 63 typedef signed short Short; 64 65 typedef unsigned long ULong; 66 typedef signed long Long; 67 68 #if SIZEOF_INT == 4 69 70 typedef signed int Fixed; /* signed fixed 16.16 float */ 71 72 #elif SIZEOF_LONG == 4 73 74 typedef signed long Fixed; /* signed fixed 16.16 float */ 75 76 #else 77 78 #error "no 32bit type found" 79 80 #endif 81 82 typedef int Int; 83 84 typedef long Integer; 85 86 /* Simple access types: pointers and tables */ 87 88 typedef Byte* PByte; 89 typedef UShort* PUShort; 90 typedef Short* PShort; 91 typedef ULong* PULong; 92 typedef Long* PLong; 93 94 typedef Fixed* PFixed; 95 96 typedef Int* PInt; 97 98 typedef void* Pointer; 99 100 typedef TT_F26Dot6* PCoordinates; 101 typedef unsigned char* PTouchTable; 102 103 104 #ifndef Bool 105 typedef int Bool; /* No boolean type in C */ 106 #endif 107 108 #ifndef TRUE 109 #define TRUE 1 110 #endif 111 112 #ifndef FALSE 113 #define FALSE 0 114 #endif 115 116 #ifndef NULL 117 #define NULL (void*)0 118 #endif 119 120 #ifdef Plan9 121 #ifdef Tamd64 122 typedef unsigned long long* PStorage; 123 #else 124 typedef unsigned int* PStorage; 125 #endif 126 #elif ARCH_SIZEOF_PTR == SIZEOF_LONG 127 typedef long* PStorage; 128 #elif ARCH_SIZEOF_PTR == SIZEOF_INT 129 typedef int* PStorage; 130 #else 131 #error "Size of pointer type is not equal to either long or int" 132 #endif 133 134 135 /* Rounding mode constants */ 136 137 #define TT_Round_Off 5 138 #define TT_Round_To_Half_Grid 0 139 #define TT_Round_To_Grid 1 140 #define TT_Round_To_Double_Grid 2 141 #define TT_Round_Up_To_Grid 4 142 #define TT_Round_Down_To_Grid 3 143 #define TT_Round_Super 6 144 #define TT_Round_Super_45 7 145 146 147 /* Touch flag masks */ 148 149 #define TT_Flag_On_Curve 1 150 #define TT_Flag_Touched_X 2 151 #define TT_Flag_Touched_Y 4 152 #define TT_Flag_Touched_Both 6 153 154 155 /* Error management constants :) */ 156 157 #define SUCCESS 0 158 #define FAILURE -1 159 160 161 /* The min and max functions missing in C. As usual, be careful not to */ 162 /* write things like MIN( a++, b++ ) to avoid side effects. */ 163 164 #ifndef MIN 165 #define MIN( a, b ) ( (a) < (b) ? (a) : (b) ) 166 #endif 167 168 #ifndef MAX 169 #define MAX( a, b ) ( (a) > (b) ? (a) : (b) ) 170 #endif 171 172 #ifndef ABS 173 #define ABS( a ) ( (a) < 0 ? -(a) : (a) ) 174 #endif 175 176 /* conversion macros for the handles defined in freetype.h */ 177 178 #define HANDLE_Val( handle ) ((handle).z) 179 180 #define HANDLE_Engine( handle ) ((PEngine_Instance)HANDLE_Val( handle )) 181 182 #define HANDLE_Face( handle ) ((PFace)HANDLE_Val( handle )) 183 184 #define HANDLE_Instance( handle ) ((PInstance)HANDLE_Val( handle )) 185 186 /* HANDLE_Stream( handle ) must be defined in ttfile.c */ 187 188 #define HANDLE_Glyph( handle ) ((PGlyph)HANDLE_Val( handle )) 189 190 #define HANDLE_CharMap( handle ) ((PCMapTable)HANDLE_Val( handle )) 191 192 #define HANDLE_Set( handle, val ) ((handle).z = (void*)(val)) 193 194 195 #endif /* TTTYPES_H */ 196 197 198 /* END */ 199