1 /* Copyright (C) 2001-2019 Artifex Software, Inc.
2    All Rights Reserved.
3 
4    This software is provided AS-IS with no warranty, either express or
5    implied.
6 
7    This software is distributed under license and may not be copied,
8    modified or distributed except as expressly authorized under the terms
9    of the license contained in the file LICENSE in this distribution.
10 
11    Refer to licensing information at http://www.artifex.com or contact
12    Artifex Software, Inc.,  1305 Grant Avenue - Suite 200, Novato,
13    CA 94945, U.S.A., +1(415)492-9861, for further information.
14 */
15 
16 
17 
18 /* Changes after FreeType: cut out the TrueType instruction interpreter. */
19 
20 /*******************************************************************
21  *
22  *  tttables.h                                                  1.1
23  *
24  *    TrueType Tables structures and handling (specification).
25  *
26  *  Copyright 1996-1998 by
27  *  David Turner, Robert Wilhelm, and Werner Lemberg.
28  *
29  *  This file is part of the FreeType project, and may only be used
30  *  modified and distributed under the terms of the FreeType project
31  *  license, LICENSE.TXT. By continuing to use, modify, or distribute
32  *  this file you indicate that you have read the license and
33  *  understand and accept it fully.
34  *
35  ******************************************************************/
36 
37 #ifndef TTTABLES_H
38 #define TTTABLES_H
39 
40 #include "tttypes.h"
41 
42 #ifdef __cplusplus
43   extern "C" {
44 #endif
45 
46   /***********************************************************************/
47   /*                                                                     */
48   /*                      TrueType Table Types                           */
49   /*                                                                     */
50   /***********************************************************************/
51 
52   /* TrueType Collection Header */
53 
54   struct  _TTTCHeader
55   {
56     Long      Tag;
57     TT_Fixed  version;
58     ULong     DirCount;
59     PULong    TableDirectory;
60   };
61 
62   typedef struct _TTTCHeader  TTTCHeader;
63   typedef TTTCHeader*         PTTCHeader;
64 
65   /* TrueType Table Directory type */
66 
67   struct  _TTableDir
68   {
69     TT_Fixed  version;      /* should be 0x10000 */
70     UShort    numTables;    /* number of tables  */
71 
72     UShort  searchRange;    /* These parameters are only used  */
73     UShort  entrySelector;  /* for a dichotomy search in the   */
74     UShort  rangeShift;     /* directory. We ignore them.      */
75   };
76 
77   typedef struct _TTableDir  TTableDir;
78   typedef TTableDir*         PTableDir;
79 
80   /* The 'TableDir' is followed by 'numTables' TableDirEntries */
81 
82   struct  _TTableDirEntry
83   {
84     Long  Tag;        /*        table type */
85     Long  CheckSum;   /*    table checksum */
86     Long  Offset;     /* table file offset */
87     Long  Length;     /*      table length */
88   };
89 
90   typedef struct _TTableDirEntry  TTableDirEntry;
91   typedef TTableDirEntry*         PTableDirEntry;
92 
93   /* 'cmap' tables */
94 
95   struct  _TCMapDir
96   {
97     UShort  tableVersionNumber;
98     UShort  numCMaps;
99   };
100 
101   typedef struct _TCMapDir  TCMapDir;
102   typedef TCMapDir*         PCMapDir;
103 
104   struct  _TCMapDirEntry
105   {
106     UShort  platformID;
107     UShort  platformEncodingID;
108     Long    offset;
109   };
110 
111   typedef struct _TCMapDirEntry  TCMapDirEntry;
112   typedef TCMapDirEntry*         PCMapDirEntries;
113 
114   /* 'maxp' Maximum Profiles table */
115 
116   struct  _TMaxProfile
117   {
118     TT_Fixed  version;
119     UShort    numGlyphs,
120               maxPoints,
121               maxContours,
122               maxCompositePoints,
123               maxCompositeContours,
124               maxZones,
125               maxTwilightPoints,
126               maxStorage,
127               maxFunctionDefs,
128               maxInstructionDefs,
129               maxStackElements,
130               maxSizeOfInstructions,
131               maxComponentElements,
132               maxComponentDepth;
133   };
134 
135   typedef struct _TMaxProfile  TMaxProfile;
136   typedef TMaxProfile*         PMaxProfile;
137 
138   /* table "gasp" */
139 
140 #  define GASP_GRIDFIT  0x01
141 #  define GASP_DOGRAY   0x02
142 
143   struct  _GaspRange
144   {
145     UShort  maxPPEM;
146     UShort  gaspFlag;
147   };
148 
149   typedef struct _GaspRange  GaspRange;
150 
151   struct  _TGasp
152   {
153     UShort      version;
154     UShort      numRanges;
155     GaspRange*  gaspRanges;
156   };
157 
158   typedef struct _TGasp  TGasp;
159 
160   /* table "head" - now defined in freetype.h */
161   /* table "hhea" - now defined in freetype.h */
162 
163   /* table "HMTX" */
164 
165   struct  _TLongHorMetric
166   {
167     UShort  advance_Width;
168     Short   lsb;
169   };
170 
171   typedef struct _TLongHorMetric  TLongHorMetric;
172   typedef TLongHorMetric*         PTableHorMetrics;
173 
174   /* 'OS/2' table - now defined in freetype.h */
175   /* "post" table - now defined in freetype.h */
176 
177   /* 'loca' location table type */
178 
179   struct  _TLoca
180   {
181     UShort    Size;
182     PStorage  Table;
183   };
184 
185   typedef struct _TLoca  TLoca;
186 
187   /* table "name" */
188 
189   struct  _TNameRec
190   {
191     UShort  platformID;
192     UShort  encodingID;
193     UShort  languageID;
194     UShort  nameID;
195     UShort  stringLength;
196     UShort  stringOffset;
197 
198     /* this last field is not defined in the spec */
199     /* but used by the FreeType engine            */
200 
201     PByte   string;
202   };
203 
204   typedef struct _TNameRec  TNameRec;
205 
206   struct  _TName_Table
207   {
208     UShort     format;
209     UShort     numNameRecords;
210     UShort     storageOffset;
211     TNameRec*  names;
212     PByte      storage;
213   };
214 
215   typedef struct _TName_Table  TName_Table;
216 
217 #ifdef __cplusplus
218   }
219 #endif
220 
221 #endif /* TTTABLES_H */
222 
223 /* END */
224