1 #ifndef HARFBUZZ_OPEN_PRIVATE_H
2 #define HARFBUZZ_OPEN_PRIVATE_H
4 #include "harfbuzz-private.h"
5 #include "harfbuzz-open.h"
9 /* Macros to convert to/from BigEndian */
12 #define hb_be_uint16_t GUINT16_TO_BE
13 #define hb_be_int16_t GINT16_TO_BE
14 #define hb_be_uint32_t GUINT32_TO_BE
15 #define hb_be_int32_t GINT32_TO_BE
16 #define hb_be_uint64_t GUINT64_TO_BE
17 #define hb_be_int64_t GINT64_TO_BE
23 #define DEFINE_INT_TYPE1(NAME, TYPE, BIG_ENDIAN) \
24 inline NAME& operator = (TYPE i) { v = BIG_ENDIAN(i); return *this; } \
25 inline operator TYPE(void) const { return BIG_ENDIAN(v); } \
26 inline bool operator== (NAME o) const { return v == o.v; } \
29 #define DEFINE_INT_TYPE0(NAME, type) DEFINE_INT_TYPE1 (NAME, type, hb_be_##type)
30 #define DEFINE_INT_TYPE(NAME, u, w) DEFINE_INT_TYPE0 (NAME, u##int##w##_t)
31 #define DEFINE_INT_TYPE_STRUCT(NAME, u, w) \
33 DEFINE_INT_TYPE(NAME, u, w) \
40 /* get_len() is a method returning the number of items in an array-like object */
41 #define DEFINE_LEN(Type, array, num) \
42 inline unsigned int get_len(void) const { return num; } \
44 /* get_size() is a method returning the size in bytes of an array-like object */
45 #define DEFINE_SIZE(Type, array, num) \
46 inline unsigned int get_size(void) const { return sizeof (*this) + sizeof (Type) * num; }
48 #define DEFINE_LEN_AND_SIZE(Type, array, num) \
49 DEFINE_LEN(Type, array, num) \
50 DEFINE_SIZE(Type, array, num)
52 #define DEFINE_NON_INSTANTIABLE(Type) \
53 private: inline Type() {} /* cannot be instantiated */ \
56 /* An array type is one that contains a variable number of objects
57 * as its last item. An array object is extended with len() and size()
58 * methods, as well as overloaded [] operator. */
59 #define DEFINE_ARRAY_TYPE(Type, array, num) \
60 DEFINE_INDEX_OPERATOR(const, Type, array, num) \
61 DEFINE_INDEX_OPERATOR( , Type, array, num) \
62 DEFINE_LEN_AND_SIZE(Type, array, num)
63 #define DEFINE_INDEX_OPERATOR(const, Type, array, num) \
64 inline const Type& operator[] (unsigned int i) const { \
69 /* An offset array type is like an array type, but it contains a table
70 * of offsets to the objects, relative to the beginning of the current
72 #define DEFINE_OFFSET_ARRAY_TYPE(Type, array, num) \
73 DEFINE_OFFSET_INDEX_OPERATOR(const, Type, array, num) \
74 DEFINE_OFFSET_INDEX_OPERATOR( , Type, array, num) \
75 DEFINE_LEN_AND_SIZE(Offset, array, num)
76 #define DEFINE_OFFSET_INDEX_OPERATOR(const, Type, array, num) \
77 inline const Type& operator[] (unsigned int i) const { \
79 assert (array[i]); /* TODO: should just skip them */ \
80 return *(const Type *)((const char*)this + array[i]); \
83 #define DEFINE_RECORD_ARRAY_TYPE(Type, array, num) \
84 DEFINE_RECORD_ACCESSOR(const, Type, array, num) \
85 DEFINE_RECORD_ACCESSOR( , Type, array, num) \
86 DEFINE_LEN_AND_SIZE(Record, array, num)
87 #define DEFINE_RECORD_ACCESSOR(const, Type, array, num) \
88 inline const Type& operator[] (unsigned int i) const { \
90 assert (array[i].offset); /* TODO: should just skip them */ \
91 return *(const Type *)((const char*)this + array[i].offset); \
93 inline const Tag& get_tag (unsigned int i) const { \
95 return array[i].tag; \
97 /* TODO: implement find_tag() */
103 * The OpenType Font File
114 /* "The following data types are used in the OpenType font file.
115 * All OpenType fonts use Motorola-style byte ordering (Big Endian):" */
118 DEFINE_INT_TYPE_STRUCT (BYTE, u, 8); /* 8-bit unsigned integer. */
119 ASSERT_SIZE (BYTE, 1);
120 DEFINE_INT_TYPE_STRUCT (CHAR, , 8); /* 8-bit signed integer. */
121 ASSERT_SIZE (CHAR, 1);
122 DEFINE_INT_TYPE_STRUCT (USHORT, u, 16); /* 16-bit unsigned integer. */
123 ASSERT_SIZE (USHORT, 2);
124 DEFINE_INT_TYPE_STRUCT (SHORT, , 16); /* 16-bit signed integer. */
125 ASSERT_SIZE (SHORT, 2);
126 DEFINE_INT_TYPE_STRUCT (ULONG, u, 32); /* 32-bit unsigned integer. */
127 ASSERT_SIZE (ULONG, 4);
128 DEFINE_INT_TYPE_STRUCT (LONG, , 32); /* 32-bit signed integer. */
129 ASSERT_SIZE (LONG, 4);
131 /* Date represented in number of seconds since 12:00 midnight, January 1,
132 * 1904. The value is represented as a signed 64-bit integer. */
133 DEFINE_INT_TYPE_STRUCT (LONGDATETIME, , 64);
135 /* 32-bit signed fixed-point number (16.16) */
137 inline Fixed& operator = (int32_t v) { i = (int16_t) (v >> 16); f = (uint16_t) v; return *this; } \
138 inline operator int32_t(void) const { return (((int32_t) i) << 16) + (uint16_t) f; } \
139 inline bool operator== (Fixed o) const { return i == o.i && f == o.f; } \
141 inline operator double(void) const { return (uint32_t) this / 65536.; }
142 inline int16_t int_part (void) const { return i; }
143 inline uint16_t frac_part (void) const { return f; }
149 ASSERT_SIZE (Fixed, 4);
151 /* Smallest measurable distance in the em space. */
154 /* 16-bit signed integer (SHORT) that describes a quantity in FUnits. */
155 struct FWORD : SHORT {
157 ASSERT_SIZE (FWORD, 2);
159 /* 16-bit unsigned integer (USHORT) that describes a quantity in FUnits. */
160 struct UFWORD : USHORT {
162 ASSERT_SIZE (UFWORD, 2);
164 /* 16-bit signed fixed number with the low 14 bits of fraction (2.14). */
165 struct F2DOT14 : SHORT {
166 inline operator double() const { return (uint32_t) this / 16384.; }
168 ASSERT_SIZE (F2DOT14, 2);
170 /* Array of four uint8s (length = 32 bits) used to identify a script, language
171 * system, feature, or baseline */
173 inline Tag (void) { v[0] = v[1] = v[2] = v[3] = 0; }
174 inline Tag (uint32_t v) { (ULONG&)(*this) = v; }
175 inline Tag (const char *c) { v[0] = c[0]; v[1] = c[1]; v[2] = c[2]; v[3] = c[3]; }
176 inline bool operator== (Tag o) const { return v[0]==o.v[0]&&v[1]==o.v[1]&&v[2]==o.v[2]&&v[3]==o.v[3]; }
177 inline bool operator== (const char *c) const { return v[0]==c[0]&&v[1]==c[1]&&v[2]==c[2]&&v[3]==c[3]; }
178 inline bool operator== (uint32_t i) const { return i == (uint32_t) *this; }
179 inline operator uint32_t(void) const { return (v[0]<<24)+(v[1]<<16) +(v[2]<<8)+v[3]; }
180 /* What the char* converters return is NOT nul-terminated. Print using "%.4s" */
181 inline operator const char* (void) const { return (const char *)this; }
182 inline operator char* (void) { return (char *)this; }
187 ASSERT_SIZE (Tag, 4);
189 /* Glyph index number, same as uint16 (length = 16 bits) */
190 DEFINE_INT_TYPE_STRUCT (GlyphID, u, 16);
191 ASSERT_SIZE (GlyphID, 2);
193 /* Offset to a table, same as uint16 (length = 16 bits), NULL offset = 0x0000 */
194 DEFINE_INT_TYPE_STRUCT (Offset, u, 16);
195 ASSERT_SIZE (Offset, 2);
198 struct CheckSum : ULONG {
199 static uint32_t CalcTableChecksum (ULONG *Table, uint32_t Length) {
201 ULONG *EndPtr = Table+((Length+3) & ~3) / sizeof(ULONG);
203 while (Table < EndPtr)
208 ASSERT_SIZE (CheckSum, 4);
215 struct USHORT_Version : USHORT {
217 ASSERT_SIZE (USHORT_Version, 2);
219 struct Fixed_Version : Fixed {
220 inline int16_t major (void) const { return this->int_part(); }
221 inline int16_t minor (void) const { return this->frac_part(); }
223 ASSERT_SIZE (Fixed_Version, 4);
227 * Organization of an OpenType Font
230 struct OpenTypeFontFile;
234 typedef struct TableDirectory {
236 friend struct OpenTypeFontFile;
238 inline const Tag& get_tag (void) const { return tag; }
239 inline unsigned long get_checksum (void) const { return checkSum; }
240 inline unsigned long get_offset (void) const { return offset; }
241 inline unsigned long get_length (void) const { return length; }
244 Tag tag; /* 4-byte identifier. */
245 CheckSum checkSum; /* CheckSum for this table. */
246 ULONG offset; /* Offset from beginning of TrueType font
248 ULONG length; /* Length of this table. */
250 ASSERT_SIZE (TableDirectory, 16);
252 typedef struct OffsetTable {
253 /* OpenTypeTables, in no particular order */
254 DEFINE_ARRAY_TYPE (TableDirectory, tableDir, numTables);
255 // TODO: Implement find_table
258 Tag sfnt_version; /* '\0\001\0\00' if TrueType / 'OTTO' if CFF */
259 USHORT numTables; /* Number of tables. */
260 USHORT searchRange; /* (Maximum power of 2 <= numTables) x 16 */
261 USHORT entrySelector; /* Log2(maximum power of 2 <= numTables). */
262 USHORT rangeShift; /* NumTables x 16-searchRange. */
263 TableDirectory tableDir[]; /* TableDirectory entries. numTables items */
265 ASSERT_SIZE (OffsetTable, 12);
268 * TrueType Collections
272 /* OpenTypeFontFaces, in no particular order */
273 DEFINE_OFFSET_ARRAY_TYPE (OffsetTable, offsetTable, numFonts);
276 Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */
277 ULONG version; /* Version of the TTC Header (1.0 or 2.0),
278 * 0x00010000 or 0x00020000 */
279 ULONG numFonts; /* Number of fonts in TTC */
280 ULONG offsetTable[]; /* Array of offsets to the OffsetTable for each font
281 * from the beginning of the file */
283 ASSERT_SIZE (TTCHeader, 12);
290 struct OpenTypeFontFile {
291 DEFINE_NON_INSTANTIABLE(OpenTypeFontFile);
292 static const hb_tag_t TrueTypeTag = HB_TAG ( 0 , 1 , 0 , 0 );
293 static const hb_tag_t CFFTag = HB_TAG ('O','T','T','O');
294 static const hb_tag_t TTCTag = HB_TAG ('t','t','c','f');
296 /* Factory: ::get(font_data)
297 * This is how you get a handle to one of these
299 static inline const OpenTypeFontFile& get (const char *font_data) {
300 return (const OpenTypeFontFile&)*font_data;
302 static inline OpenTypeFontFile& get (char *font_data) {
303 return (OpenTypeFontFile&)*font_data;
306 /* This is how you get a table */
307 inline const char* get_table (const OpenTypeTable& table) const {
308 return ((const char*)this) + table.offset;
310 inline char* get_table (const OpenTypeTable& table) {
311 return ((char*)this) + table.offset;
313 inline const char* operator[] (const OpenTypeTable& table) const {
314 return ((const char*)this) + table.offset;
316 inline char* operator[] (const OpenTypeTable& table) {
317 return ((char*)this) + table.offset;
320 /* Array interface sans get_size() */
321 inline unsigned int get_len (void) const {
324 case TrueTypeTag: case CFFTag: return 1;
325 case TTCTag: return ((const TTCHeader&)*this).get_len();
328 inline const OpenTypeFontFace& operator[] (unsigned int i) const {
329 assert (i < get_len ());
331 default: case TrueTypeTag: case CFFTag: return (const OffsetTable&)*this;
332 case TTCTag: return ((const TTCHeader&)*this)[i];
335 inline OpenTypeFontFace& operator[] (unsigned int i) {
336 assert (i < get_len ());
338 default: case TrueTypeTag: case CFFTag: return (OffsetTable&)*this;
339 case TTCTag: return ((TTCHeader&)*this)[i];
342 inline const Tag& get_tag (void) const { return tag; }
345 Tag tag; /* 4-byte identifier. */
347 ASSERT_SIZE (OpenTypeFontFile, 4);
353 * OpenType Layout Common Table Formats
358 * Script, ScriptList, LangSys, Feature, FeatureList, Lookup, LookupList
369 typedef struct Record {
370 Tag tag; /* 4-byte Tag identifier */
371 Offset offset; /* Offset from beginning of object holding
373 } ScriptRecord, LangSysRecord, FeatureRecord;
374 ASSERT_SIZE (Record, 6);
377 /* Scripts, in sorted alphabetical tag order */
378 DEFINE_RECORD_ARRAY_TYPE (Script, scriptRecord, scriptCount);
381 USHORT scriptCount; /* Number of ScriptRecords */
382 ScriptRecord scriptRecord[]; /* Array of ScriptRecords--listed alphabetically
385 ASSERT_SIZE (ScriptList, 2);
388 /* LangSys', in sorted alphabetical tag order */
389 DEFINE_RECORD_ARRAY_TYPE (LangSys, langSysRecord, langSysCount);
391 /* Return NULL if none */
392 inline const LangSys* get_default_language_system (void) const {
395 return (const LangSys *)((const char*)this + defaultLangSys);
397 inline LangSys* get_default_language_system (void) {
400 return (LangSys *)((char*)this + defaultLangSys);
403 /* TODO implement find_language_system based on find_tag */
406 Offset defaultLangSys; /* Offset to DefaultLangSys table--from
407 * beginning of Script table--may be NULL */
408 USHORT langSysCount; /* Number of LangSysRecords for this script--
409 * excluding the DefaultLangSys */
410 LangSysRecord langSysRecord[];/* Array of LangSysRecords--listed
411 * alphabetically by LangSysTag */
413 ASSERT_SIZE (Script, 4);
416 /* Feature indices, in no particular order */
417 DEFINE_ARRAY_TYPE (USHORT, featureIndex, featureCount);
419 /* Returns -1 if none */
420 inline int get_required_feature_index (void) const {
421 if (reqFeatureIndex == 0xffff)
423 return reqFeatureIndex;;
426 /* TODO implement find_feature */
429 Offset lookupOrder; /* = NULL (reserved for an offset to a
430 * reordering table) */
431 USHORT reqFeatureIndex;/* Index of a feature required for this
432 * language system--if no required features
434 USHORT featureCount; /* Number of FeatureIndex values for this
435 * language system--excludes the required
437 USHORT featureIndex[]; /* Array of indices into the FeatureList--in
438 * arbitrary order. featureCount entires long */
440 ASSERT_SIZE (LangSys, 6);
443 /* Feature indices, in sorted alphabetical tag order */
444 DEFINE_RECORD_ARRAY_TYPE (Feature, featureRecord, featureCount);
447 USHORT featureCount; /* Number of FeatureRecords in this table */
448 FeatureRecord featureRecord[];/* Array of FeatureRecords--zero-based (first
449 * feature has FeatureIndex = 0)--listed
450 * alphabetically by FeatureTag */
452 ASSERT_SIZE (FeatureList, 2);
455 /* LookupList indices, in no particular order */
456 DEFINE_ARRAY_TYPE (USHORT, lookupIndex, lookupCount);
458 // TODO: implement get_feature_params()
461 Offset featureParams; /* Offset to Feature Parameters table (if one
462 * has been defined for the feature), relative
463 * to the beginning of the Feature Table; = NULL
465 USHORT lookupCount; /* Number of LookupList indices for this
467 USHORT lookupIndex[]; /* Array of LookupList indices for this
468 * feature--zero-based (first lookup is
469 * LookupListIndex = 0) */
471 ASSERT_SIZE (Feature, 4);
474 /* Lookup indices, in sorted alphabetical tag order */
475 DEFINE_OFFSET_ARRAY_TYPE (Lookup, lookupOffset, lookupCount);
478 USHORT lookupCount; /* Number of lookups in this table */
479 Offset lookupOffset[]; /* Array of offsets to Lookup tables--from
480 * beginning of LookupList--zero based (first
481 * lookup is Lookup index = 0) */
483 ASSERT_SIZE (LookupList, 2);
485 struct LookupFlag : USHORT {
486 static const uint16_t RightToLeft = 0x0001u;
487 static const uint16_t IgnoreBaseGlyphs = 0x0002u;
488 static const uint16_t IgnoreLigatures = 0x0004u;
489 static const uint16_t IgnoreMarks = 0x0008u;
490 static const uint16_t Reserved = 0x00F0u;
491 static const uint16_t MarkAttachmentType = 0xFF00u;
493 ASSERT_SIZE (LookupFlag, 2);
496 /* SubTables, in the desired order */
497 DEFINE_OFFSET_ARRAY_TYPE (char*, subTableOffset, subTableCount);
499 inline bool is_right_to_left (void) const { return lookupFlag & LookupFlag::RightToLeft; }
500 inline bool ignore_base_glyphs(void) const { return lookupFlag & LookupFlag::IgnoreBaseGlyphs; }
501 inline bool ignore_ligatures (void) const { return lookupFlag & LookupFlag::IgnoreLigatures; }
502 inline bool ignore_marks (void) const { return lookupFlag & LookupFlag::IgnoreMarks; }
503 inline bool get_mark_attachment_type (void) const { return lookupFlag & LookupFlag::MarkAttachmentType; }
505 inline uint16_t get_type (void) const { return lookupType; }
506 inline uint16_t get_flag (void) const { return lookupFlag; }
509 USHORT lookupType; /* Different enumerations for GSUB and GPOS */
510 USHORT lookupFlag; /* Lookup qualifiers */
511 USHORT subTableCount; /* Number of SubTables for this lookup */
512 Offset subTableOffset[];/* Array of offsets to SubTables-from
513 * beginning of Lookup table */
515 ASSERT_SIZE (Lookup, 6);
521 struct CoverageFormat1 {
522 /* GlyphIDs, in sorted numerical order */
523 DEFINE_ARRAY_TYPE (GlyphID, glyphArray, glyphCount);
525 inline int get_coverage (uint16_t glyph_id) const {
529 for (int i = 0; i < glyphCount; i++)
530 if (gid == glyphArray[i])
536 USHORT coverageFormat; /* Format identifier--format = 1 */
537 USHORT glyphCount; /* Number of glyphs in the GlyphArray */
538 GlyphID glyphArray[]; /* Array of GlyphIDs--in numerical order */
540 ASSERT_SIZE (CoverageFormat1, 4);
542 struct CoverageRangeRecord {
544 inline int get_coverage (uint16_t glyph_id) const {
545 if (glyph_id >= start && glyph_id <= end)
546 return startCoverageIndex + (glyph_id - start);
551 GlyphID start; /* First GlyphID in the range */
552 GlyphID end; /* Last GlyphID in the range */
553 USHORT startCoverageIndex; /* Coverage Index of first GlyphID in
556 ASSERT_SIZE (CoverageRangeRecord, 6);
558 struct CoverageFormat2 {
559 /* CoverageRangeRecords, in sorted numerical start order */
560 DEFINE_ARRAY_TYPE (CoverageRangeRecord, rangeRecord, rangeCount);
562 inline int get_coverage (uint16_t glyph_id) const {
564 for (int i = 0; i < rangeCount; i++) {
565 int coverage = rangeRecord[i].get_coverage (glyph_id);
573 USHORT coverageFormat; /* Format identifier--format = 2 */
574 USHORT rangeCount; /* Number of CoverageRangeRecords */
575 CoverageRangeRecord rangeRecord[]; /* Array of glyph ranges--ordered by
576 * Start GlyphID. rangeCount entries
579 ASSERT_SIZE (CoverageFormat2, 4);
582 DEFINE_NON_INSTANTIABLE(Coverage);
584 inline unsigned int get_size (void) const {
585 switch (u.coverageFormat) {
586 case 1: return u.format1.get_size ();
587 case 2: return u.format2.get_size ();
588 default:return sizeof (u.coverageFormat);
592 /* Returns -1 if not covered. */
593 inline int get_coverage (uint16_t glyph_id) const {
594 switch (u.coverageFormat) {
595 case 1: return u.format1.get_coverage(glyph_id);
596 case 2: return u.format2.get_coverage(glyph_id);
603 USHORT coverageFormat; /* Format identifier */
604 CoverageFormat1 format1;
605 CoverageFormat2 format2;
610 * Class Definition Table
613 struct ClassDefFormat1 {
614 /* GlyphIDs, in sorted numerical order */
615 DEFINE_ARRAY_TYPE (USHORT, classValueArray, glyphCount);
617 inline int get_class (uint16_t glyph_id) const {
618 if (glyph_id >= startGlyph && glyph_id < startGlyph + glyphCount)
619 return classValueArray[glyph_id - startGlyph];
624 USHORT classFormat; /* Format identifier--format = 1 */
625 GlyphID startGlyph; /* First GlyphID of the classValueArray */
626 USHORT glyphCount; /* Size of the classValueArray */
627 USHORT classValueArray[]; /* Array of Class Values--one per GlyphID */
629 ASSERT_SIZE (ClassDefFormat1, 6);
631 struct ClassRangeRecord {
633 inline int get_class (uint16_t glyph_id) const {
634 if (glyph_id >= start && glyph_id <= end)
640 GlyphID start; /* First GlyphID in the range */
641 GlyphID end; /* Last GlyphID in the range */
642 USHORT classValue; /* Applied to all glyphs in the range */
644 ASSERT_SIZE (ClassRangeRecord, 6);
646 struct ClassDefFormat2 {
647 /* ClassRangeRecords, in sorted numerical start order */
648 DEFINE_ARRAY_TYPE (ClassRangeRecord, rangeRecord, rangeCount);
650 inline int get_class (uint16_t glyph_id) const {
652 for (int i = 0; i < rangeCount; i++) {
653 int classValue = rangeRecord[i].get_class (glyph_id);
661 USHORT classFormat; /* Format identifier--format = 2 */
662 USHORT rangeCount; /* Number of Number of ClassRangeRecords */
663 ClassRangeRecord rangeRecord[]; /* Array of glyph ranges--ordered by
666 ASSERT_SIZE (ClassDefFormat2, 4);
669 DEFINE_NON_INSTANTIABLE(ClassDef);
671 inline unsigned int get_size (void) const {
672 switch (u.classFormat) {
673 case 1: return u.format1.get_size ();
674 case 2: return u.format2.get_size ();
675 default:return sizeof (u.classFormat);
679 /* Returns 0 if not found. */
680 inline int get_class (uint16_t glyph_id) const {
681 switch (u.classFormat) {
682 case 1: return u.format1.get_class(glyph_id);
683 case 2: return u.format2.get_class(glyph_id);
690 USHORT classFormat; /* Format identifier */
691 ClassDefFormat1 format1;
692 ClassDefFormat2 format2;
702 inline unsigned int get_size (void) const {
703 int count = endSize - startSize + 1;
704 if (count < 0) count = 0;
705 switch (deltaFormat) {
706 case 1: return sizeof (Device) + sizeof (USHORT) * ((count+7)/8);
707 case 2: return sizeof (Device) + sizeof (USHORT) * ((count+3)/4);
708 case 3: return sizeof (Device) + sizeof (USHORT) * ((count+1)/2);
709 default:return sizeof (Device);
713 inline int get_delta (int ppem_size) const {
714 if (ppem_size >= startSize && ppem_size <= endSize &&
715 deltaFormat >= 1 && deltaFormat <= 3) {
716 int s = ppem_size - startSize;
719 uint16_t byte = deltaValue[s >> (4 - f)];
720 uint16_t bits = byte >> (16 - (((s & ((1 << (4 - f)) - 1)) + 1) << f));
721 uint16_t mask = 0xFFFF >> (16 - (1 << f));
723 int delta = bits & mask;
725 if (delta >= ((mask + 1) >> 1))
734 USHORT startSize; /* Smallest size to correct--in ppem */
735 USHORT endSize; /* Largest size to correct--in ppem */
736 USHORT deltaFormat; /* Format of DeltaValue array data: 1, 2, or 3 */
737 USHORT deltaValue[]; /* Array of compressed data */
739 ASSERT_SIZE (Device, 6);
743 #define DEFINE_LIST_ACCESSOR0(const, Type, name) \
744 inline const Type##List* get_##name##_list (void) const { \
745 assert (name##List); \
746 return (const Type##List *)((const char*)this + name##List); \
748 inline const Type& get_##name (unsigned int i) const { \
749 return (*get_##name##_list())[i]; \
751 #define DEFINE_LIST_ACCESSOR(Type, name) \
752 DEFINE_LIST_ACCESSOR0(const, Type, name) \
753 DEFINE_LIST_ACCESSOR0( , Type, name)
755 struct GSUBGPOSHeader {
757 DEFINE_LIST_ACCESSOR(Script, script); /* get_script_list, get_script(i) */
758 DEFINE_LIST_ACCESSOR(Feature, feature);/* get_feature_list, get_feature(i) */
759 DEFINE_LIST_ACCESSOR(Lookup, lookup); /* get_lookup_list, get_lookup(i) */
761 /* TODO implement find_script */
764 Fixed_Version version; /* Version of the GSUB/GPOS table--initially set
766 Offset scriptList; /* Offset to ScriptList table--from beginning of
768 Offset featureList; /* Offset to FeatureList table--from beginning of
770 Offset lookupList; /* Offset to LookupList table--from beginning of
773 ASSERT_SIZE (GSUBGPOSHeader, 10);
775 #endif /* HARFBUZZ_OPEN_PRIVATE_H */