1 (*******************************************************************
2  *
3  *  TTTables.Pas                                              1.2
4  *
5  *    TrueType Tables declarations
6  *
7  *  Copyright 1996 David Turner, Robert Wilhelm and Werner Lemberg
8  *
9  *  This file is part of the FreeType project, and may only be used
10  *  modified and distributed under the terms of the FreeType project
11  *  license, LICENSE.TXT. By continuing to use, modify or distribute
12  *  this file you indicate that you have read the license and
13  *  understand and accept it fully.
14  *
15  *
16  *  Difference between 1.1 and 1.2 :
17  *
18  *  - TTTables now only contains the declarations of the
19  *    TrueType tables.
20  *
21  *  - Instance, Resident and Execution context declarations
22  *    were moved to TTObjs
23  *
24  *  - Tables loaders were moved to the new TTLoad component
25  *
26  ******************************************************************)
27 
28 Unit TTTables;
29 
30 interface
31 
32 uses FreeType, TTTypes;
33 
34 (***************************************************************************)
35 (*                                                                         *)
36 (*                      TrueType Table Types                               *)
37 (*                                                                         *)
38 (***************************************************************************)
39 
40 type
41   (* TrueType collection header *)
42   PTTCHeader = ^TTTCHeader;
43   TTTCHeader = record
44                  Tag            : Long;
45                  version        : TT_Fixed;
46                  DirCount       : ULong;
47                  TableDirectory : PStorage;
48                end;
49 
50   (* TrueType Table Directory type *)
51   PTableDir = ^TTableDir;
52   TTableDir = Record
53                 version        : TT_Fixed;  (* should be $10000 *)
54                 numTables      : UShort;    (* Tables number    *)
55 
56                 searchRange,             (* These parameters are only used  *)
57                 entrySelector,           (* for a dichotomy search in the   *)
58                 rangeShift     : UShort; (* directory. We ignore them       *)
59                end;
60 
61   (* The 'TableDir' is followed by 'numTables' TableDirEntries *)
62 
63   TTableDirEntry = Record
64                      Tag      : Long;   (*        table type *)
65                      CheckSum : Long;   (*    table Checksum *)
66                      Offset   : Long;   (* Table file offset *)
67                      Length   : Long;   (*      Table length *)
68                     end;
69 
70   TTableDirEntries = array[0..100] of TTableDirEntry;
71   PTableDirEntries = ^TTableDirEntries;
72 
73   (* 'cmap' tables *)
74 
75   TCMapDir = record
76                tableVersionNumber : UShort;
77                numCMaps           : UShort;
78              end;
79 
80   TCMapDirEntry = record
81                     platformID         : UShort;
82                     platformEncodingID : UShort;
83                     offset             : Long;
84                   end;
85 
86   TCMapDirEntries = array[0..10] of TCMapDirEntry;
87   PCMapDirEntries = ^TCMapDirEntries;
88 
89   (* table "maxp" of Maximum Profiles' *)
90 
91   TMaxProfile = Record
92                   Version                 : TT_Fixed;
93                   numGlyphs,
94                   maxPoints,
95                   maxContours,
96                   maxCompositePoints,
97                   maxCompositeContours,
98                   maxZones,
99                   maxTwilightPoints,
100                   maxStorage,
101                   maxFunctionDefs,
102                   maxInstructionDefs,
103                   maxStackElements,
104 
105                   maxSizeOfInstructions,
106                   maxComponentElements,
107                   maxComponentDepth       : UShort;
108                 end;
109 
110   (* table "gasp" *)
111 
112 const
113   Gasp_GridFit = 1;
114   Gasp_DoGray  = 2;
115 
116 type
117   TGaspRange = record
118                  maxPPEM  : UShort;
119                  gaspFlag : UShort;
120                end;
121 
122   TGaspRanges = array[0..9] of TGaspRange;
123   PGaspRanges = ^TGaspRanges;
124 
125   TGasp = record
126             version    : UShort;
127             numRanges  : UShort;
128             gaspRanges : PGaspRanges;
129           end;
130 
131   (* table "HMTX" *)
132 
133   TLongMetrics = record
134                   advance : UShort;
135                   bearing : Short;
136                  end;
137 
138   TTableLongMetrics = array[0..255] of TLongMetrics;
139   PTableLongMetrics = ^TTableLongMetrics;
140 
141   TShortMetrics = Short;
142   TTableShortMetrics = array[0..255] of TShortMetrics;
143   PTableShortMetrics = ^TTableShortMetrics;
144 
145 {
146   (* table "OS/2" *)
147 
148   TOS2_Table = record
149                  version             : UShort;   (* $0001 *)
150                  xAvgCharWidth       : Short;
151                  usWeightClass       : UShort;
152                  usWidthClass        : UShort;
153                  fsType              : Short;
154                  ySubscriptXSize     : Short;
155                  ySubscriptYSize     : Short;
156                  ySubScriptXOffset   : Short;
157                  ySubscriptYOffset   : Short;
158                  ySuperscriptXSize   : Short;
159                  ySuperscriptYSize   : Short;
160                  ySuperscriptXOffset : Short;
161                  ySuperscriptYOffset : Short;
162                  yStrikeoutSize      : Short;
163                  yStrikeoutPosition  : Short;
164                  sFamilyClass        : Short;
165                  panose              : array[0..9] of Byte;
166                  ulUnicodeRange1     : ULong;   (* bits  0-31  *)
167                  ulUnicodeRange2     : ULong;   (* bits 32-63  *)
168                  ulUnicodeRange3     : ULong;   (* bits 64-95  *)
169                  ulUnicodeRange4     : ULong;   (* bits 96-127 *)
170                  achVendID           : array[0..3] of Byte;
171                  fsSelection         : UShort;
172                  usFirstCharIndex    : UShort;
173                  usLastCharIndex     : UShort;
174                  sTypoAscender       : UShort;
175                  sTypoDescender      : UShort;
176                  sTypoLineGap        : UShort;
177                  usWinAscent         : UShort;
178                  usWinDescent        : UShort;
179 
180                  (* only version 1 tables *)
181                  ulCodePageRange1    : ULong;
182                  ulCodePageRange2    : ULong;
183                end;
184 
185   (* table "post" *)
186 
187   TPostscript = record
188                   FormatType         : TT_Fixed;
189                   italicAngle        : TT_Fixed;
190                   underlinePosition  : Short;
191                   underlineThickness : Short;
192                   isFixedPitch       : ULong;
193                   minMemType42       : ULong;
194                   maxMemType42       : ULong;
195                   minMemType1        : ULong;
196                   maxMemType1        : ULong;
197                 end;
198 }
199   (* table "name" *)
200 
201   (* table "name" *)
202 
203   TName_Record  = record
204 
205     platformID : UShort;
206     encodingID : UShort;
207     languageID : UShort;
208     nameID     : UShort;
209     length     : UShort;
210     offset     : UShort;
211   end;
212   PName_Record  = ^TName_Record;
213   TName_Records = array[0..0] of TName_Record;
214   PName_Records = ^TName_Records;
215 
216 
217   PName_Table = ^TName_Table;
218   TName_Table = record
219 
220     format         : UShort;
221     numNameRecords : UShort;
222     storageOffset  : UShort;
223     names          : PName_Records;
224     storage        : PByte;
225   end;
226 
227 
228   PHdmx_Record = ^THdmx_Record;
229   THdmx_Record = record
230                    ppem      : Byte;
231                    max_width : Byte;
232                    widths    : PByte;
233                  end;
234 
235   THdmx_Records = array[0..19] of THdmx_Record;
236   PHdmx_Records = ^THdmx_Records;
237 
238   THdmx = record
239             version     : UShort;
240             num_records : Short;
241             records     : PHdmx_Records;
242           end;
243 
244 implementation
245 
246 end.
247 
248