]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/letest/sfnt.h
ICU-57166.0.1.tar.gz
[apple/icu.git] / icuSources / test / letest / sfnt.h
CommitLineData
b75a7d8f
A
1/***************************************************************************
2*
57a6839d 3* Copyright (C) 1998-2013, International Business Machines
b75a7d8f
A
4* Corporation and others. All Rights Reserved.
5*
6************************************************************************/
7
8#ifndef __SFNT_H
9#define __SFNT_H
10
57a6839d 11#include "layout/LETypes.h"
b75a7d8f 12
46f4442e 13U_NAMESPACE_USE
b75a7d8f
A
14
15#ifndef ANY_NUMBER
16#define ANY_NUMBER 1
17#endif
18
19struct DirectoryEntry
20{
21 le_uint32 tag;
22 le_uint32 checksum;
23 le_uint32 offset;
24 le_uint32 length;
25};
26
4388f060 27#ifndef __cplusplus
46f4442e
A
28typedef struct DirectoryEntry DirectoryEntry;
29#endif
30
b75a7d8f
A
31struct SFNTDirectory
32{
33 le_uint32 scalerType;
34 le_uint16 numTables;
35 le_uint16 searchRange;
36 le_uint16 entrySelector;
37 le_uint16 rangeShift;
38 DirectoryEntry tableDirectory[ANY_NUMBER];
39};
40
4388f060 41#ifndef __cplusplus
46f4442e
A
42typedef struct SFNTDirectory SFNTDirectory;
43#endif
44
b75a7d8f
A
45
46struct CMAPEncodingSubtableHeader
47{
48 le_uint16 platformID;
49 le_uint16 platformSpecificID;
50 le_uint32 encodingOffset;
51};
52
4388f060 53#ifndef __cplusplus
46f4442e
A
54typedef struct CMAPEncodingSubtableHeader CMAPEncodingSubtableHeader;
55#endif
56
b75a7d8f
A
57struct CMAPTable
58{
59 le_uint16 version;
60 le_uint16 numberSubtables;
61 CMAPEncodingSubtableHeader encodingSubtableHeaders[ANY_NUMBER];
62};
63
4388f060 64#ifndef __cplusplus
46f4442e
A
65typedef struct CMAPTable CMAPTable;
66#endif
67
b75a7d8f
A
68struct CMAPEncodingSubtable
69{
70 le_uint16 format;
71 le_uint16 length;
72 le_uint16 language;
73};
74
4388f060 75#ifndef __cplusplus
46f4442e
A
76typedef struct CMAPEncodingSubtable CMAPEncodingSubtable;
77#endif
78
4388f060 79#ifdef __cplusplus
b75a7d8f
A
80struct CMAPFormat0Encoding : CMAPEncodingSubtable
81{
82 le_uint8 glyphIndexArray[256];
83};
46f4442e
A
84#else
85struct CMAPFormat0Encoding
86{
87 CMAPEncodingSubtable base;
88
89 le_uint8 glyphIndexArray[256];
90};
91
92typedef struct CMAPFormat0Encoding CMAPFormat0Encoding;
93#endif
b75a7d8f
A
94
95struct CMAPFormat2Subheader
96{
97 le_uint16 firstCode;
98 le_uint16 entryCount;
99 le_int16 idDelta;
100 le_uint16 idRangeOffset;
101};
102
4388f060 103#ifndef __cplusplus
46f4442e
A
104typedef struct CMAPFormat2Subheader CMAPFormat2Subheader;
105#endif
106
4388f060 107#ifdef __cplusplus
b75a7d8f
A
108struct CMAPFormat2Encoding : CMAPEncodingSubtable
109{
110 le_uint16 subHeadKeys[256];
111 CMAPFormat2Subheader subheaders[ANY_NUMBER];
112};
46f4442e
A
113#else
114struct CMAPFormat2Encoding
115{
116 CMAPEncodingSubtable base;
117
118 le_uint16 subHeadKeys[256];
119 CMAPFormat2Subheader subheaders[ANY_NUMBER];
120};
121
122typedef struct CMAPFormat2Encoding CMAPFormat2Encoding;
123#endif
b75a7d8f 124
4388f060 125#ifdef __cplusplus
b75a7d8f
A
126struct CMAPFormat4Encoding : CMAPEncodingSubtable
127{
128 le_uint16 segCountX2;
129 le_uint16 searchRange;
130 le_uint16 entrySelector;
131 le_uint16 rangeShift;
132 le_uint16 endCodes[ANY_NUMBER];
46f4442e
A
133/*
134 le_uint16 reservedPad;
135 le_uint16 startCodes[ANY_NUMBER];
136 le_uint16 idDelta[ANY_NUMBER];
137 le_uint16 idRangeOffset[ANY_NUMBER];
138 le_uint16 glyphIndexArray[ANY_NUMBER];
139*/
140};
141#else
142struct CMAPFormat4Encoding
143{
144 CMAPEncodingSubtable base;
145
146 le_uint16 segCountX2;
147 le_uint16 searchRange;
148 le_uint16 entrySelector;
149 le_uint16 rangeShift;
150 le_uint16 endCodes[ANY_NUMBER];
151/*
b75a7d8f
A
152// le_uint16 reservedPad;
153// le_uint16 startCodes[ANY_NUMBER];
154// le_uint16 idDelta[ANY_NUMBER];
155// le_uint16 idRangeOffset[ANY_NUMBER];
156// le_uint16 glyphIndexArray[ANY_NUMBER];
46f4442e 157*/
b75a7d8f
A
158};
159
46f4442e
A
160typedef struct CMAPFormat4Encoding CMAPFormat4Encoding;
161#endif
162
4388f060 163#ifdef __cplusplus
b75a7d8f
A
164struct CMAPFormat6Encoding : CMAPEncodingSubtable
165{
166 le_uint16 firstCode;
167 le_uint16 entryCount;
168 le_uint16 glyphIndexArray[ANY_NUMBER];
169};
46f4442e
A
170#else
171struct CMAPFormat6Encoding
172{
173 CMAPEncodingSubtable base;
174
175 le_uint16 firstCode;
176 le_uint16 entryCount;
177 le_uint16 glyphIndexArray[ANY_NUMBER];
178};
179
180typedef struct CMAPFormat6Encoding CMAPFormat6Encoding;
181#endif
b75a7d8f
A
182
183struct CMAPEncodingSubtable32
184{
185 le_uint32 format;
186 le_uint32 length;
187 le_uint32 language;
188};
189
4388f060 190#ifndef __cplusplus
46f4442e
A
191typedef struct CMAPEncodingSubtable32 CMAPEncodingSubtable32;
192#endif
193
b75a7d8f
A
194struct CMAPGroup
195{
196 le_uint32 startCharCode;
197 le_uint32 endCharCode;
198 le_uint32 startGlyphCode;
199};
200
4388f060 201#ifndef __cplusplus
46f4442e
A
202typedef struct CMAPGroup CMAPGroup;
203#endif
204
4388f060 205#ifdef __cplusplus
b75a7d8f
A
206struct CMAPFormat8Encoding : CMAPEncodingSubtable32
207{
208 le_uint32 is32[65536/32];
209 le_uint32 nGroups;
210 CMAPGroup groups[ANY_NUMBER];
211};
46f4442e
A
212#else
213struct CMAPFormat8Encoding
214{
215 CMAPEncodingSubtable32 base;
216
217 le_uint32 is32[65536/32];
218 le_uint32 nGroups;
219 CMAPGroup groups[ANY_NUMBER];
220};
221
222typedef struct CMAPFormat8Encoding CMAPFormat8Encoding;
223#endif
b75a7d8f 224
4388f060 225#ifdef __cplusplus
b75a7d8f
A
226struct CMAPFormat10Encoding : CMAPEncodingSubtable32
227{
228 le_uint32 startCharCode;
229 le_uint32 numCharCodes;
230 le_uint16 glyphs[ANY_NUMBER];
231};
46f4442e
A
232#else
233struct CMAPFormat10Encoding
234{
235 CMAPEncodingSubtable32 base;
b75a7d8f 236
46f4442e
A
237 le_uint32 startCharCode;
238 le_uint32 numCharCodes;
239 le_uint16 glyphs[ANY_NUMBER];
240};
241
242typedef struct CMAPFormat10Encoding CMAPFormat10Encoding;
243#endif
244
4388f060 245#ifdef __cplusplus
b75a7d8f
A
246struct CMAPFormat12Encoding : CMAPEncodingSubtable32
247{
248 le_uint32 nGroups;
249 CMAPGroup groups[ANY_NUMBER];
250};
46f4442e
A
251#else
252struct CMAPFormat12Encoding
253{
254 CMAPEncodingSubtable32 base;
255
256 le_uint32 nGroups;
257 CMAPGroup groups[ANY_NUMBER];
258};
259
260typedef struct CMAPFormat12Encoding CMAPFormat12Encoding;
261#endif
b75a7d8f
A
262
263typedef le_int32 fixed;
264
265struct BigDate
266{
267 le_uint32 bc;
268 le_uint32 ad;
269};
270
4388f060 271#ifndef __cplusplus
46f4442e
A
272typedef struct BigDate BigDate;
273#endif
274
b75a7d8f
A
275struct HEADTable
276{
277 fixed version;
278 fixed fontRevision;
279 le_uint32 checksumAdjustment;
280 le_uint32 magicNumber;
281 le_uint16 flags;
282 le_uint16 unitsPerEm;
283 BigDate created;
284 BigDate modified;
285 le_int16 xMin;
286 le_int16 yMin;
287 le_int16 xMax;
288 le_int16 yMax;
289 le_int16 lowestRecPPEM;
290 le_int16 fontDirectionHint;
291 le_int16 indexToLocFormat;
292 le_int16 glyphDataFormat;
293};
294
4388f060 295#ifndef __cplusplus
46f4442e
A
296typedef struct HEADTable HEADTable;
297#endif
298
b75a7d8f
A
299struct MAXPTable
300{
301 fixed version;
302 le_uint16 numGlyphs;
303 le_uint16 maxPoints;
304 le_uint16 maxContours;
305 le_uint16 maxComponentPoints;
306 le_uint16 maxComponentContours;
307 le_uint16 maxZones;
308 le_uint16 maxTwilightPoints;
309 le_uint16 maxStorage;
310 le_uint16 maxFunctionDefs;
311 le_uint16 maxInstructionDefs;
312 le_uint16 maxStackElements;
313 le_uint16 maxSizeOfInstructions;
314 le_uint16 maxComponentElements;
315 le_uint16 maxComponentDepth;
316};
317
4388f060 318#ifndef __cplusplus
46f4442e
A
319typedef struct MAXPTable MAXPTable;
320#endif
321
b75a7d8f
A
322struct HHEATable
323{
324 fixed version;
325 le_int16 ascent;
326 le_int16 descent;
327 le_int16 lineGap;
328 le_uint16 advanceWidthMax;
329 le_int16 minLeftSideBearing;
330 le_int16 minRightSideBearing;
331 le_int16 xMaxExtent;
332 le_int16 caretSlopeRise;
333 le_int16 caretSlopeRun;
334 le_int16 caretOffset;
335 le_int16 reserved1;
336 le_int16 reserved2;
337 le_int16 reserved3;
338 le_int16 reserved4;
339 le_int16 metricDataFormat;
340 le_uint16 numOfLongHorMetrics;
341};
342
4388f060 343#ifndef __cplusplus
46f4442e
A
344typedef struct HHEATable HHEATable;
345#endif
346
b75a7d8f
A
347struct LongHorMetric
348{
349 le_uint16 advanceWidth;
350 le_int16 leftSideBearing;
351};
352
4388f060 353#ifndef __cplusplus
46f4442e
A
354typedef struct LongHorMetric LongHorMetric;
355#endif
356
b75a7d8f
A
357struct HMTXTable
358{
46f4442e
A
359 LongHorMetric hMetrics[ANY_NUMBER]; /* ANY_NUMBER = numOfLongHorMetrics from hhea table */
360/* le_int16 leftSideBearing[ANY_NUMBER]; ANY_NUMBER = numGlyphs - numOfLongHorMetrics */
b75a7d8f
A
361};
362
4388f060 363#ifndef __cplusplus
46f4442e
A
364typedef struct HMTXTable HMTXTable;
365#endif
366
73c04bcf
A
367enum PlatformID
368{
369 PLATFORM_UNICODE = 0,
370 PLATFORM_MACINTOSH = 1,
371 PLATFORM_ISO = 2,
372 PLATFORM_MICROSOFT = 3,
373 PLATFORM_CUSTOM = 4
374};
375
376enum MacintoshEncodingID
377{
378 MACINTOSH_ROMAN = 0
379};
380
381enum MacintoshLanguageID
382{
383 MACINTOSH_ENGLISH = 0
384};
385
46f4442e
A
386enum MicrosoftEncodingID
387{
388 MICROSOFT_UNICODE_BMP = 1,
389 MICROSOFT_UNICODE_FULL = 10
390};
391
392enum MicrosoftLanguageID
393{
394 MICROSOFT_ENGLISH = 0x409
395};
396
73c04bcf
A
397enum NameID
398{
399 NAME_COPYRIGHT_NOTICE = 0,
400 NAME_FONT_FAMILY = 1,
401 NAME_FONT_SUB_FAMILY = 2,
402 NAME_UNIQUE_FONT_ID = 3,
403 NAME_FULL_FONT_NAME = 4,
404 NAME_VERSION_STRING = 5,
405 NAME_POSTSCRIPT_NAME = 6,
406 NAME_TRADEMARK = 7,
407 NAME_MANUFACTURER = 8,
408 NAME_DESIGNER = 9,
409 NAME_DESCRIPTION = 10,
410 NAME_VENDOR_URL = 11,
411 NAME_DESIGNER_URL = 12,
412 NAME_LICENSE_DESCRIPTION = 13,
413 NAME_LICENSE_URL = 14,
414 NAME_RESERVED = 15,
415 NAME_PREFERRED_FAMILY = 16,
416 NAME_PREFERRED_SUB_FAMILY = 17,
417 NAME_COMPATIBLE_FULL = 18,
418 NAME_SAMPLE_TEXT = 19,
419 NAME_POSTSCRIPT_CID = 20
420};
421
422struct NameRecord
423{
424 le_uint16 platformID;
425 le_uint16 encodingID;
426 le_uint16 languageID;
427 le_uint16 nameID;
428 le_uint16 length;
429 le_uint16 offset;
430};
431
4388f060 432#ifndef __cplusplus
46f4442e
A
433typedef struct NameRecord NameRecord;
434#endif
435
73c04bcf
A
436struct NAMETable
437{
438 le_uint16 version;
439 le_uint16 count;
440 le_uint16 stringOffset;
441 NameRecord nameRecords[ANY_NUMBER];
442};
443
4388f060 444#ifndef __cplusplus
46f4442e
A
445typedef struct NAMETable NAMETable;
446#endif
447
b75a7d8f
A
448#endif
449