1 /******************************************************************* 2 * 3 * tttables.h 1.1 4 * 5 * TrueType Tables structures and handling (specification). 6 * 7 * Copyright 1996-1999 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 #ifndef TTTABLES_H 19 #define TTTABLES_H 20 21 #include "ttconfig.h" 22 #include "tttypes.h" 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 /***********************************************************************/ 29 /* */ 30 /* TrueType Table Types */ 31 /* */ 32 /***********************************************************************/ 33 34 /* TrueType Collection Header */ 35 36 struct TTTCHeader_ 37 { 38 ULong Tag; 39 TT_Fixed version; 40 ULong DirCount; 41 PULong TableDirectory; 42 }; 43 44 typedef struct TTTCHeader_ TTTCHeader; 45 typedef TTTCHeader* PTTCHeader; 46 47 48 /* TrueType Table Directory type */ 49 50 struct TTableDir_ 51 { 52 TT_Fixed version; /* should be 0x10000 */ 53 UShort numTables; /* number of tables */ 54 55 UShort searchRange; /* These parameters are only used */ 56 UShort entrySelector; /* for a dichotomy search in the */ 57 UShort rangeShift; /* directory. We ignore them. */ 58 }; 59 60 typedef struct TTableDir_ TTableDir; 61 typedef TTableDir* PTableDir; 62 63 64 /* The 'TableDir' is followed by 'numTables' TableDirEntries */ 65 66 struct TTableDirEntry_ 67 { 68 ULong Tag; /* table type */ 69 ULong CheckSum; /* table checksum */ 70 ULong Offset; /* table file offset */ 71 ULong Length; /* table length */ 72 }; 73 74 typedef struct TTableDirEntry_ TTableDirEntry; 75 typedef TTableDirEntry* PTableDirEntry; 76 77 78 /* 'cmap' tables */ 79 80 struct TCMapDir_ 81 { 82 UShort tableVersionNumber; 83 UShort numCMaps; 84 }; 85 86 typedef struct TCMapDir_ TCMapDir; 87 typedef TCMapDir* PCMapDir; 88 89 struct TCMapDirEntry_ 90 { 91 UShort platformID; 92 UShort platformEncodingID; 93 Long offset; 94 }; 95 96 typedef struct TCMapDirEntry_ TCMapDirEntry; 97 typedef TCMapDirEntry* PCMapDirEntries; 98 99 100 /* 'maxp' Maximum Profiles table */ 101 102 struct TMaxProfile_ 103 { 104 TT_Fixed version; 105 UShort numGlyphs, 106 maxPoints, 107 maxContours, 108 maxCompositePoints, 109 maxCompositeContours, 110 maxZones, 111 maxTwilightPoints, 112 maxStorage, 113 maxFunctionDefs, 114 maxInstructionDefs, 115 maxStackElements, 116 maxSizeOfInstructions, 117 maxComponentElements, 118 maxComponentDepth; 119 }; 120 121 typedef struct TMaxProfile_ TMaxProfile; 122 typedef TMaxProfile* PMaxProfile; 123 124 125 /* table "gasp" */ 126 127 #define GASP_GRIDFIT 0x01 128 #define GASP_DOGRAY 0x02 129 130 struct GaspRange_ 131 { 132 UShort maxPPEM; 133 UShort gaspFlag; 134 }; 135 136 typedef struct GaspRange_ GaspRange; 137 138 139 struct TGasp_ 140 { 141 UShort version; 142 UShort numRanges; 143 GaspRange* gaspRanges; 144 }; 145 146 typedef struct TGasp_ TGasp; 147 148 149 /* table "head" - now defined in freetype.h */ 150 /* table "hhea" - now defined in freetype.h */ 151 152 153 /* tables "HMTX" and "VMTX" */ 154 155 struct TLongMetrics_ 156 { 157 UShort advance; 158 Short bearing; 159 }; 160 161 typedef struct TLongMetrics_ TLongMetrics, *PLongMetrics; 162 163 typedef Short TShortMetrics, *PShortMetrics; 164 165 /* 'loca' location table type */ 166 167 struct TLoca_ 168 { 169 UShort Size; 170 PStorage Table; 171 }; 172 173 typedef struct TLoca_ TLoca; 174 175 176 /* table "name" */ 177 178 struct TNameRec_ 179 { 180 UShort platformID; 181 UShort encodingID; 182 UShort languageID; 183 UShort nameID; 184 UShort stringLength; 185 UShort stringOffset; 186 187 /* this last field is not defined in the spec */ 188 /* but used by the FreeType engine */ 189 190 PByte string; 191 }; 192 193 typedef struct TNameRec_ TNameRec; 194 195 196 struct TName_Table_ 197 { 198 UShort format; 199 UShort numNameRecords; 200 UShort storageOffset; 201 TNameRec* names; 202 PByte storage; 203 }; 204 205 typedef struct TName_Table_ TName_Table; 206 207 208 #ifdef __cplusplus 209 } 210 #endif 211 212 #endif /* TTTABLES_H */ 213 214 215 /* END */ 216