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