summaryrefslogtreecommitdiff
path: root/Build/source/libs/icu-xetex/test/letest/sfnt.h
blob: b0ffb3068906f72730bcb35c7834f96c25fd1802 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
/***************************************************************************
*
*   Copyright (C) 1998-2007, International Business Machines
*   Corporation and others.  All Rights Reserved.
*
************************************************************************/

#ifndef __SFNT_H
#define __SFNT_H

#include "LETypes.h"

U_NAMESPACE_USE

#ifndef ANY_NUMBER
#define ANY_NUMBER 1
#endif

struct DirectoryEntry
{
    le_uint32   tag;
    le_uint32   checksum;
    le_uint32   offset;
    le_uint32   length;
};

#ifndef XP_CPLUSPLUS
typedef struct DirectoryEntry DirectoryEntry;
#endif

struct SFNTDirectory
{
    le_uint32       scalerType;
    le_uint16       numTables;
    le_uint16       searchRange;
    le_uint16       entrySelector;
    le_uint16       rangeShift;
    DirectoryEntry  tableDirectory[ANY_NUMBER];
};

#ifndef XP_CPLUSPLUS
typedef struct SFNTDirectory SFNTDirectory;
#endif


struct CMAPEncodingSubtableHeader
{
    le_uint16   platformID;
    le_uint16   platformSpecificID;
    le_uint32   encodingOffset;
};

#ifndef XP_CPLUSPLUS
typedef struct CMAPEncodingSubtableHeader CMAPEncodingSubtableHeader;
#endif

struct CMAPTable
{
    le_uint16   version;
    le_uint16   numberSubtables;
    CMAPEncodingSubtableHeader encodingSubtableHeaders[ANY_NUMBER];
};

#ifndef XP_CPLUSPLUS
typedef struct CMAPTable CMAPTable;
#endif

struct CMAPEncodingSubtable
{
    le_uint16   format;
    le_uint16   length;
    le_uint16   language;
};

#ifndef XP_CPLUSPLUS
typedef struct CMAPEncodingSubtable CMAPEncodingSubtable;
#endif

#ifdef XP_CPLUSPLUS
struct CMAPFormat0Encoding : CMAPEncodingSubtable
{
    le_uint8    glyphIndexArray[256];
};
#else
struct CMAPFormat0Encoding
{
	CMAPEncodingSubtable base;

	le_uint8 glyphIndexArray[256];
};

typedef struct CMAPFormat0Encoding CMAPFormat0Encoding;
#endif

struct CMAPFormat2Subheader
{
    le_uint16   firstCode;
    le_uint16   entryCount;
    le_int16    idDelta;
    le_uint16   idRangeOffset;
};

#ifndef XP_CPLUSPLUS
typedef struct CMAPFormat2Subheader CMAPFormat2Subheader;
#endif

#ifdef XP_CPLUSPLUS
struct CMAPFormat2Encoding : CMAPEncodingSubtable
{
    le_uint16  subHeadKeys[256];
    CMAPFormat2Subheader subheaders[ANY_NUMBER];
};
#else
struct CMAPFormat2Encoding
{
	CMAPEncodingSubtable base;

    le_uint16  subHeadKeys[256];
    CMAPFormat2Subheader subheaders[ANY_NUMBER];
};

typedef struct CMAPFormat2Encoding CMAPFormat2Encoding;
#endif

#ifdef XP_CPLUSPLUS
struct CMAPFormat4Encoding : CMAPEncodingSubtable
{
    le_uint16   segCountX2;
    le_uint16   searchRange;
    le_uint16   entrySelector;
    le_uint16   rangeShift;
    le_uint16   endCodes[ANY_NUMBER];
/*
    le_uint16   reservedPad;
    le_uint16   startCodes[ANY_NUMBER];
    le_uint16   idDelta[ANY_NUMBER];
    le_uint16   idRangeOffset[ANY_NUMBER];
    le_uint16   glyphIndexArray[ANY_NUMBER];
*/
};
#else
struct CMAPFormat4Encoding
{
	CMAPEncodingSubtable base;

    le_uint16   segCountX2;
    le_uint16   searchRange;
    le_uint16   entrySelector;
    le_uint16   rangeShift;
    le_uint16   endCodes[ANY_NUMBER];
/*
//  le_uint16   reservedPad;
//  le_uint16   startCodes[ANY_NUMBER];
//  le_uint16   idDelta[ANY_NUMBER];
//  le_uint16   idRangeOffset[ANY_NUMBER];
//  le_uint16   glyphIndexArray[ANY_NUMBER];
*/
};

typedef struct CMAPFormat4Encoding CMAPFormat4Encoding;
#endif

#ifdef XP_CPLUSPLUS
struct CMAPFormat6Encoding : CMAPEncodingSubtable
{
    le_uint16   firstCode;
    le_uint16   entryCount;
    le_uint16   glyphIndexArray[ANY_NUMBER];
};
#else
struct CMAPFormat6Encoding
{
	CMAPEncodingSubtable base;

    le_uint16   firstCode;
    le_uint16   entryCount;
    le_uint16   glyphIndexArray[ANY_NUMBER];
};

typedef struct CMAPFormat6Encoding CMAPFormat6Encoding;
#endif

struct CMAPEncodingSubtable32
{
    le_uint32   format;
    le_uint32   length;
    le_uint32   language;
};

#ifndef XP_CPLUSPLUS
typedef struct CMAPEncodingSubtable32 CMAPEncodingSubtable32;
#endif

struct CMAPGroup
{
    le_uint32   startCharCode;
    le_uint32   endCharCode;
    le_uint32   startGlyphCode;
};

#ifndef XP_CPLUSPLUS
typedef struct CMAPGroup CMAPGroup;
#endif

#ifdef XP_CPLUSPLUS
struct CMAPFormat8Encoding : CMAPEncodingSubtable32
{
    le_uint32   is32[65536/32];
    le_uint32   nGroups;
    CMAPGroup   groups[ANY_NUMBER];
};
#else
struct CMAPFormat8Encoding
{
	CMAPEncodingSubtable32 base;

    le_uint32   is32[65536/32];
    le_uint32   nGroups;
    CMAPGroup   groups[ANY_NUMBER];
};

typedef struct CMAPFormat8Encoding CMAPFormat8Encoding;
#endif

#ifdef XP_CPLUSPLUS
struct CMAPFormat10Encoding : CMAPEncodingSubtable32
{
    le_uint32   startCharCode;
    le_uint32   numCharCodes;
    le_uint16   glyphs[ANY_NUMBER];
};
#else
struct CMAPFormat10Encoding
{
	CMAPEncodingSubtable32 base;

    le_uint32   startCharCode;
    le_uint32   numCharCodes;
    le_uint16   glyphs[ANY_NUMBER];
};

typedef struct CMAPFormat10Encoding CMAPFormat10Encoding;
#endif

#ifdef XP_CPLUSPLUS
struct CMAPFormat12Encoding : CMAPEncodingSubtable32
{
    le_uint32   nGroups;
    CMAPGroup   groups[ANY_NUMBER];
};
#else
struct CMAPFormat12Encoding
{
	CMAPEncodingSubtable32 base;

    le_uint32   nGroups;
    CMAPGroup   groups[ANY_NUMBER];
};

typedef struct CMAPFormat12Encoding CMAPFormat12Encoding;
#endif

typedef le_int32 fixed;

struct BigDate
{
    le_uint32   bc;
    le_uint32   ad;
};

#ifndef XP_CPLUSPLUS
typedef struct BigDate BigDate;
#endif

struct HEADTable
{
    fixed       version;
    fixed       fontRevision;
    le_uint32   checksumAdjustment;
    le_uint32   magicNumber;
    le_uint16   flags;
    le_uint16   unitsPerEm;
    BigDate     created;
    BigDate     modified;
    le_int16    xMin;
    le_int16    yMin;
    le_int16    xMax;
    le_int16    yMax;
    le_int16    lowestRecPPEM;
    le_int16    fontDirectionHint;
    le_int16    indexToLocFormat;
    le_int16    glyphDataFormat;
};

#ifndef XP_CPLUSPLUS
typedef struct HEADTable HEADTable;
#endif

struct MAXPTable
{
    fixed       version;
    le_uint16   numGlyphs;
    le_uint16   maxPoints;
    le_uint16   maxContours;
    le_uint16   maxComponentPoints;
    le_uint16   maxComponentContours;
    le_uint16   maxZones;
    le_uint16   maxTwilightPoints;
    le_uint16   maxStorage;
    le_uint16   maxFunctionDefs;
    le_uint16   maxInstructionDefs;
    le_uint16   maxStackElements;
    le_uint16   maxSizeOfInstructions;
    le_uint16   maxComponentElements;
    le_uint16   maxComponentDepth;
};

#ifndef XP_CPLUSPLUS
typedef struct MAXPTable MAXPTable;
#endif

struct HHEATable
{
    fixed       version;
    le_int16    ascent;
    le_int16    descent;
    le_int16    lineGap;
    le_uint16   advanceWidthMax;
    le_int16    minLeftSideBearing;
    le_int16    minRightSideBearing;
    le_int16    xMaxExtent;
    le_int16    caretSlopeRise;
    le_int16    caretSlopeRun;
    le_int16    caretOffset;
    le_int16    reserved1;
    le_int16    reserved2;
    le_int16    reserved3;
    le_int16    reserved4;
    le_int16    metricDataFormat;
    le_uint16   numOfLongHorMetrics;
};

#ifndef XP_CPLUSPLUS
typedef struct HHEATable HHEATable;
#endif

struct LongHorMetric
{
    le_uint16   advanceWidth;
    le_int16    leftSideBearing;
};

#ifndef XP_CPLUSPLUS
typedef struct LongHorMetric LongHorMetric;
#endif

struct HMTXTable
{
    LongHorMetric hMetrics[ANY_NUMBER];       /* ANY_NUMBER = numOfLongHorMetrics from hhea table */
/* le_int16        leftSideBearing[ANY_NUMBER];  ANY_NUMBER = numGlyphs - numOfLongHorMetrics     */
};

#ifndef XP_CPLUSPLUS
typedef struct HMTXTable HMTXTable;
#endif

enum PlatformID
{
    PLATFORM_UNICODE = 0,
    PLATFORM_MACINTOSH = 1,
    PLATFORM_ISO       = 2,
    PLATFORM_MICROSOFT = 3,
    PLATFORM_CUSTOM    = 4
};

enum MacintoshEncodingID
{
    MACINTOSH_ROMAN = 0
};

enum MacintoshLanguageID
{
    MACINTOSH_ENGLISH = 0
};

enum NameID
{
    NAME_COPYRIGHT_NOTICE     = 0,
    NAME_FONT_FAMILY          = 1,
    NAME_FONT_SUB_FAMILY      = 2,
    NAME_UNIQUE_FONT_ID       = 3,
    NAME_FULL_FONT_NAME       = 4,
    NAME_VERSION_STRING       = 5,
    NAME_POSTSCRIPT_NAME      = 6,
    NAME_TRADEMARK            = 7,
    NAME_MANUFACTURER         = 8,
    NAME_DESIGNER             = 9,
    NAME_DESCRIPTION          = 10,
    NAME_VENDOR_URL           = 11,
    NAME_DESIGNER_URL         = 12,
    NAME_LICENSE_DESCRIPTION  = 13,
    NAME_LICENSE_URL          = 14,
    NAME_RESERVED             = 15,
    NAME_PREFERRED_FAMILY     = 16,
    NAME_PREFERRED_SUB_FAMILY = 17,
    NAME_COMPATIBLE_FULL      = 18,
    NAME_SAMPLE_TEXT          = 19,
    NAME_POSTSCRIPT_CID       = 20
};

struct NameRecord
{
    le_uint16 platformID;
    le_uint16 encodingID;
    le_uint16 languageID;
    le_uint16 nameID;
    le_uint16 length;
    le_uint16 offset;
};

#ifndef XP_CPLUSPLUS
typedef struct NameRecord NameRecord;
#endif

struct NAMETable
{
    le_uint16 version;
    le_uint16 count;
    le_uint16 stringOffset;
    NameRecord nameRecords[ANY_NUMBER];
};

#ifndef XP_CPLUSPLUS
typedef struct NAMETable NAMETable;
#endif

#endif