2 * Copyright (C) 2007,2008,2009,2010 Red Hat, Inc.
4 * This is part of HarfBuzz, a text shaping library.
6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software.
12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24 * Red Hat Author(s): Behdad Esfahbod
27 #ifndef HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH
28 #define HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH
30 #include "hb-buffer-private.hh"
31 #include "hb-ot-layout-gdef-private.hh"
36 #ifndef HB_DEBUG_APPLY
37 #define HB_DEBUG_APPLY HB_DEBUG+0
40 #define TRACE_APPLY() \
41 hb_trace_t<HB_DEBUG_APPLY> trace (&c->debug_depth, "APPLY", HB_FUNC, this); \
46 struct hb_apply_context_t
48 unsigned int debug_depth;
49 hb_ot_layout_context_t *layout;
51 hb_mask_t lookup_mask;
52 unsigned int context_length;
53 unsigned int nesting_level_left;
54 unsigned int lookup_flag;
55 unsigned int property; /* propety of first glyph (TODO remove) */
60 typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, const void *data);
61 typedef bool (*apply_lookup_func_t) (hb_apply_context_t *c, unsigned int lookup_index);
66 apply_lookup_func_t apply;
70 static inline bool match_glyph (hb_codepoint_t glyph_id, const USHORT &value, const void *data HB_UNUSED)
72 return glyph_id == value;
75 static inline bool match_class (hb_codepoint_t glyph_id, const USHORT &value, const void *data)
77 const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
78 return class_def.get_class (glyph_id) == value;
81 static inline bool match_coverage (hb_codepoint_t glyph_id, const USHORT &value, const void *data)
83 const OffsetTo<Coverage> &coverage = (const OffsetTo<Coverage>&)value;
84 return (data+coverage) (glyph_id) != NOT_COVERED;
88 static inline bool match_input (hb_apply_context_t *c,
89 unsigned int count, /* Including the first glyph (not matched) */
90 const USHORT input[], /* Array of input values--start with second glyph */
91 match_func_t match_func,
92 const void *match_data,
93 unsigned int *context_length_out)
96 unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
97 if (unlikely (c->buffer->i + count > end))
100 for (i = 1, j = c->buffer->i + 1; i < count; i++, j++)
102 while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL))
104 if (unlikely (j + count - i == end))
109 if (likely (!match_func (c->buffer->info[j].codepoint, input[i - 1], match_data)))
113 *context_length_out = j - c->buffer->i;
118 static inline bool match_backtrack (hb_apply_context_t *c,
120 const USHORT backtrack[],
121 match_func_t match_func,
122 const void *match_data)
124 if (unlikely (c->buffer->out_len < count))
127 for (unsigned int i = 0, j = c->buffer->out_len - 1; i < count; i++, j--)
129 while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->out_info[j], c->lookup_flag, NULL))
131 if (unlikely (j + 1 == count - i))
136 if (likely (!match_func (c->buffer->out_info[j].codepoint, backtrack[i], match_data)))
143 static inline bool match_lookahead (hb_apply_context_t *c,
145 const USHORT lookahead[],
146 match_func_t match_func,
147 const void *match_data,
151 unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
152 if (unlikely (c->buffer->i + offset + count > end))
155 for (i = 0, j = c->buffer->i + offset; i < count; i++, j++)
157 while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL))
159 if (unlikely (j + count - i == end))
164 if (likely (!match_func (c->buffer->info[j].codepoint, lookahead[i], match_data)))
176 inline bool sanitize (hb_sanitize_context_t *c) {
178 return c->check_struct (this);
181 USHORT sequenceIndex; /* Index into current glyph
182 * sequence--first glyph = 0 */
183 USHORT lookupListIndex; /* Lookup to apply to that
184 * position--zero--based */
186 DEFINE_SIZE_STATIC (4);
192 static inline bool apply_lookup (hb_apply_context_t *c,
193 unsigned int count, /* Including the first glyph */
194 unsigned int lookupCount,
195 const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
196 apply_lookup_func_t apply_func)
198 unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
199 if (unlikely (c->buffer->i + count > end))
202 /* TODO We don't support lookupRecord arrays that are not increasing:
203 * Should be easy for in_place ones at least. */
205 /* Note: If sublookup is reverse, i will underflow after the first loop
206 * and we jump out of it. Not entirely disastrous. So we don't check
207 * for reverse lookup here.
209 for (unsigned int i = 0; i < count; /* NOP */)
211 while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[c->buffer->i], c->lookup_flag, NULL))
213 if (unlikely (c->buffer->i == end))
215 /* No lookup applied for this index */
216 c->buffer->next_glyph ();
219 if (lookupCount && i == lookupRecord->sequenceIndex)
221 unsigned int old_pos = c->buffer->i;
224 bool done = apply_func (c, lookupRecord->lookupListIndex);
228 /* Err, this is wrong if the lookup jumped over some glyphs */
229 i += c->buffer->i - old_pos;
230 if (unlikely (c->buffer->i == end))
239 /* No lookup applied for this index */
240 c->buffer->next_glyph ();
251 /* Contextual lookups */
253 struct ContextLookupContext
256 const void *match_data;
259 static inline bool context_lookup (hb_apply_context_t *c,
260 unsigned int inputCount, /* Including the first glyph (not matched) */
261 const USHORT input[], /* Array of input values--start with second glyph */
262 unsigned int lookupCount,
263 const LookupRecord lookupRecord[],
264 ContextLookupContext &lookup_context)
266 hb_apply_context_t new_context = *c;
267 return match_input (c,
269 lookup_context.funcs.match, lookup_context.match_data,
270 &new_context.context_length)
271 && apply_lookup (&new_context,
273 lookupCount, lookupRecord,
274 lookup_context.funcs.apply);
279 friend struct RuleSet;
282 inline bool apply (hb_apply_context_t *c, ContextLookupContext &lookup_context) const
285 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (input, input[0].static_size * (inputCount ? inputCount - 1 : 0));
286 return context_lookup (c,
288 lookupCount, lookupRecord,
293 inline bool sanitize (hb_sanitize_context_t *c) {
295 return inputCount.sanitize (c)
296 && lookupCount.sanitize (c)
297 && c->check_range (input,
298 input[0].static_size * inputCount
299 + lookupRecordX[0].static_size * lookupCount);
303 USHORT inputCount; /* Total number of glyphs in input
304 * glyph sequence--includes the first
306 USHORT lookupCount; /* Number of LookupRecords */
307 USHORT input[VAR]; /* Array of match inputs--start with
309 LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in
312 DEFINE_SIZE_ARRAY2 (4, input, lookupRecordX);
317 inline bool apply (hb_apply_context_t *c, ContextLookupContext &lookup_context) const
320 unsigned int num_rules = rule.len;
321 for (unsigned int i = 0; i < num_rules; i++)
323 if ((this+rule[i]).apply (c, lookup_context))
330 inline bool sanitize (hb_sanitize_context_t *c) {
332 return rule.sanitize (c, this);
337 rule; /* Array of Rule tables
338 * ordered by preference */
340 DEFINE_SIZE_ARRAY (2, rule);
344 struct ContextFormat1
346 friend struct Context;
349 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
352 unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
353 if (likely (index == NOT_COVERED))
356 const RuleSet &rule_set = this+ruleSet[index];
357 struct ContextLookupContext lookup_context = {
358 {match_glyph, apply_func},
361 return rule_set.apply (c, lookup_context);
364 inline bool sanitize (hb_sanitize_context_t *c) {
366 return coverage.sanitize (c, this)
367 && ruleSet.sanitize (c, this);
371 USHORT format; /* Format identifier--format = 1 */
373 coverage; /* Offset to Coverage table--from
374 * beginning of table */
375 OffsetArrayOf<RuleSet>
376 ruleSet; /* Array of RuleSet tables
377 * ordered by Coverage Index */
379 DEFINE_SIZE_ARRAY (6, ruleSet);
383 struct ContextFormat2
385 friend struct Context;
388 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
391 unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
392 if (likely (index == NOT_COVERED))
395 const ClassDef &class_def = this+classDef;
396 index = class_def (c->buffer->info[c->buffer->i].codepoint);
397 const RuleSet &rule_set = this+ruleSet[index];
398 struct ContextLookupContext lookup_context = {
399 {match_class, apply_func},
402 return rule_set.apply (c, lookup_context);
405 inline bool sanitize (hb_sanitize_context_t *c) {
407 return coverage.sanitize (c, this)
408 && classDef.sanitize (c, this)
409 && ruleSet.sanitize (c, this);
413 USHORT format; /* Format identifier--format = 2 */
415 coverage; /* Offset to Coverage table--from
416 * beginning of table */
418 classDef; /* Offset to glyph ClassDef table--from
419 * beginning of table */
420 OffsetArrayOf<RuleSet>
421 ruleSet; /* Array of RuleSet tables
422 * ordered by class */
424 DEFINE_SIZE_ARRAY (8, ruleSet);
428 struct ContextFormat3
430 friend struct Context;
433 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
436 unsigned int index = (this+coverage[0]) (c->buffer->info[c->buffer->i].codepoint);
437 if (likely (index == NOT_COVERED))
440 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage, coverage[0].static_size * glyphCount);
441 struct ContextLookupContext lookup_context = {
442 {match_coverage, apply_func},
445 return context_lookup (c,
446 glyphCount, (const USHORT *) (coverage + 1),
447 lookupCount, lookupRecord,
451 inline bool sanitize (hb_sanitize_context_t *c) {
453 if (!c->check_struct (this)) return false;
454 unsigned int count = glyphCount;
455 if (!c->check_array (coverage, coverage[0].static_size, count)) return false;
456 for (unsigned int i = 0; i < count; i++)
457 if (!coverage[i].sanitize (c, this)) return false;
458 LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage, coverage[0].static_size * count);
459 return c->check_array (lookupRecord, lookupRecord[0].static_size, lookupCount);
463 USHORT format; /* Format identifier--format = 3 */
464 USHORT glyphCount; /* Number of glyphs in the input glyph
466 USHORT lookupCount; /* Number of LookupRecords */
468 coverage[VAR]; /* Array of offsets to Coverage
469 * table in glyph sequence order */
470 LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in
473 DEFINE_SIZE_ARRAY2 (6, coverage, lookupRecordX);
479 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
483 case 1: return u.format1.apply (c, apply_func);
484 case 2: return u.format2.apply (c, apply_func);
485 case 3: return u.format3.apply (c, apply_func);
486 default:return false;
490 inline bool sanitize (hb_sanitize_context_t *c) {
492 if (!u.format.sanitize (c)) return false;
494 case 1: return u.format1.sanitize (c);
495 case 2: return u.format2.sanitize (c);
496 case 3: return u.format3.sanitize (c);
503 USHORT format; /* Format identifier */
504 ContextFormat1 format1;
505 ContextFormat2 format2;
506 ContextFormat3 format3;
511 /* Chaining Contextual lookups */
513 struct ChainContextLookupContext
516 const void *match_data[3];
519 static inline bool chain_context_lookup (hb_apply_context_t *c,
520 unsigned int backtrackCount,
521 const USHORT backtrack[],
522 unsigned int inputCount, /* Including the first glyph (not matched) */
523 const USHORT input[], /* Array of input values--start with second glyph */
524 unsigned int lookaheadCount,
525 const USHORT lookahead[],
526 unsigned int lookupCount,
527 const LookupRecord lookupRecord[],
528 ChainContextLookupContext &lookup_context)
531 if (unlikely (c->buffer->out_len < backtrackCount ||
532 c->buffer->i + inputCount + lookaheadCount > c->buffer->len ||
533 inputCount + lookaheadCount > c->context_length))
536 hb_apply_context_t new_context = *c;
537 return match_backtrack (c,
538 backtrackCount, backtrack,
539 lookup_context.funcs.match, lookup_context.match_data[0])
542 lookup_context.funcs.match, lookup_context.match_data[1],
543 &new_context.context_length)
544 && match_lookahead (c,
545 lookaheadCount, lookahead,
546 lookup_context.funcs.match, lookup_context.match_data[2],
547 new_context.context_length)
548 && apply_lookup (&new_context,
550 lookupCount, lookupRecord,
551 lookup_context.funcs.apply);
556 friend struct ChainRuleSet;
559 inline bool apply (hb_apply_context_t *c, ChainContextLookupContext &lookup_context) const
562 const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
563 const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
564 const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
565 return chain_context_lookup (c,
566 backtrack.len, backtrack.array,
567 input.len, input.array,
568 lookahead.len, lookahead.array,
569 lookup.len, lookup.array,
575 inline bool sanitize (hb_sanitize_context_t *c) {
577 if (!backtrack.sanitize (c)) return false;
578 HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
579 if (!input.sanitize (c)) return false;
580 ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
581 if (!lookahead.sanitize (c)) return false;
582 ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
583 return lookup.sanitize (c);
588 backtrack; /* Array of backtracking values
589 * (to be matched before the input
591 HeadlessArrayOf<USHORT>
592 inputX; /* Array of input values (start with
595 lookaheadX; /* Array of lookahead values's (to be
596 * matched after the input sequence) */
597 ArrayOf<LookupRecord>
598 lookupX; /* Array of LookupRecords--in
606 inline bool apply (hb_apply_context_t *c, ChainContextLookupContext &lookup_context) const
609 unsigned int num_rules = rule.len;
610 for (unsigned int i = 0; i < num_rules; i++)
612 if ((this+rule[i]).apply (c, lookup_context))
619 inline bool sanitize (hb_sanitize_context_t *c) {
621 return rule.sanitize (c, this);
625 OffsetArrayOf<ChainRule>
626 rule; /* Array of ChainRule tables
627 * ordered by preference */
629 DEFINE_SIZE_ARRAY (2, rule);
632 struct ChainContextFormat1
634 friend struct ChainContext;
637 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
640 unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
641 if (likely (index == NOT_COVERED))
644 const ChainRuleSet &rule_set = this+ruleSet[index];
645 struct ChainContextLookupContext lookup_context = {
646 {match_glyph, apply_func},
649 return rule_set.apply (c, lookup_context);
652 inline bool sanitize (hb_sanitize_context_t *c) {
654 return coverage.sanitize (c, this)
655 && ruleSet.sanitize (c, this);
659 USHORT format; /* Format identifier--format = 1 */
661 coverage; /* Offset to Coverage table--from
662 * beginning of table */
663 OffsetArrayOf<ChainRuleSet>
664 ruleSet; /* Array of ChainRuleSet tables
665 * ordered by Coverage Index */
667 DEFINE_SIZE_ARRAY (6, ruleSet);
670 struct ChainContextFormat2
672 friend struct ChainContext;
675 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
678 unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
679 if (likely (index == NOT_COVERED))
682 const ClassDef &backtrack_class_def = this+backtrackClassDef;
683 const ClassDef &input_class_def = this+inputClassDef;
684 const ClassDef &lookahead_class_def = this+lookaheadClassDef;
686 index = input_class_def (c->buffer->info[c->buffer->i].codepoint);
687 const ChainRuleSet &rule_set = this+ruleSet[index];
688 struct ChainContextLookupContext lookup_context = {
689 {match_class, apply_func},
690 {&backtrack_class_def,
692 &lookahead_class_def}
694 return rule_set.apply (c, lookup_context);
697 inline bool sanitize (hb_sanitize_context_t *c) {
699 return coverage.sanitize (c, this)
700 && backtrackClassDef.sanitize (c, this)
701 && inputClassDef.sanitize (c, this)
702 && lookaheadClassDef.sanitize (c, this)
703 && ruleSet.sanitize (c, this);
707 USHORT format; /* Format identifier--format = 2 */
709 coverage; /* Offset to Coverage table--from
710 * beginning of table */
712 backtrackClassDef; /* Offset to glyph ClassDef table
713 * containing backtrack sequence
714 * data--from beginning of table */
716 inputClassDef; /* Offset to glyph ClassDef
717 * table containing input sequence
718 * data--from beginning of table */
720 lookaheadClassDef; /* Offset to glyph ClassDef table
721 * containing lookahead sequence
722 * data--from beginning of table */
723 OffsetArrayOf<ChainRuleSet>
724 ruleSet; /* Array of ChainRuleSet tables
725 * ordered by class */
727 DEFINE_SIZE_ARRAY (12, ruleSet);
730 struct ChainContextFormat3
732 friend struct ChainContext;
736 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
739 const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
741 unsigned int index = (this+input[0]) (c->buffer->info[c->buffer->i].codepoint);
742 if (likely (index == NOT_COVERED))
745 const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (input);
746 const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
747 struct ChainContextLookupContext lookup_context = {
748 {match_coverage, apply_func},
751 return chain_context_lookup (c,
752 backtrack.len, (const USHORT *) backtrack.array,
753 input.len, (const USHORT *) input.array + 1,
754 lookahead.len, (const USHORT *) lookahead.array,
755 lookup.len, lookup.array,
760 inline bool sanitize (hb_sanitize_context_t *c) {
762 if (!backtrack.sanitize (c, this)) return false;
763 OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
764 if (!input.sanitize (c, this)) return false;
765 OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (input);
766 if (!lookahead.sanitize (c, this)) return false;
767 ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
768 return lookup.sanitize (c);
772 USHORT format; /* Format identifier--format = 3 */
773 OffsetArrayOf<Coverage>
774 backtrack; /* Array of coverage tables
775 * in backtracking sequence, in glyph
777 OffsetArrayOf<Coverage>
778 inputX ; /* Array of coverage
779 * tables in input sequence, in glyph
781 OffsetArrayOf<Coverage>
782 lookaheadX; /* Array of coverage tables
783 * in lookahead sequence, in glyph
785 ArrayOf<LookupRecord>
786 lookupX; /* Array of LookupRecords--in
789 DEFINE_SIZE_MIN (10);
795 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
799 case 1: return u.format1.apply (c, apply_func);
800 case 2: return u.format2.apply (c, apply_func);
801 case 3: return u.format3.apply (c, apply_func);
802 default:return false;
806 inline bool sanitize (hb_sanitize_context_t *c) {
808 if (!u.format.sanitize (c)) return false;
810 case 1: return u.format1.sanitize (c);
811 case 2: return u.format2.sanitize (c);
812 case 3: return u.format3.sanitize (c);
819 USHORT format; /* Format identifier */
820 ChainContextFormat1 format1;
821 ChainContextFormat2 format2;
822 ChainContextFormat3 format3;
827 struct ExtensionFormat1
829 friend struct Extension;
832 inline unsigned int get_type (void) const { return extensionLookupType; }
833 inline unsigned int get_offset (void) const { return extensionOffset; }
835 inline bool sanitize (hb_sanitize_context_t *c) {
837 return c->check_struct (this);
841 USHORT format; /* Format identifier. Set to 1. */
842 USHORT extensionLookupType; /* Lookup type of subtable referenced
843 * by ExtensionOffset (i.e. the
844 * extension subtable). */
845 ULONG extensionOffset; /* Offset to the extension subtable,
846 * of lookup type subtable. */
848 DEFINE_SIZE_STATIC (8);
853 inline unsigned int get_type (void) const
856 case 1: return u.format1.get_type ();
860 inline unsigned int get_offset (void) const
863 case 1: return u.format1.get_offset ();
868 inline bool sanitize (hb_sanitize_context_t *c) {
870 if (!u.format.sanitize (c)) return false;
872 case 1: return u.format1.sanitize (c);
879 USHORT format; /* Format identifier */
880 ExtensionFormat1 format1;
891 static const hb_tag_t GSUBTag = HB_OT_TAG_GSUB;
892 static const hb_tag_t GPOSTag = HB_OT_TAG_GPOS;
894 inline unsigned int get_script_count (void) const
895 { return (this+scriptList).len; }
896 inline const Tag& get_script_tag (unsigned int i) const
897 { return (this+scriptList).get_tag (i); }
898 inline unsigned int get_script_tags (unsigned int start_offset,
899 unsigned int *script_count /* IN/OUT */,
900 hb_tag_t *script_tags /* OUT */) const
901 { return (this+scriptList).get_tags (start_offset, script_count, script_tags); }
902 inline const Script& get_script (unsigned int i) const
903 { return (this+scriptList)[i]; }
904 inline bool find_script_index (hb_tag_t tag, unsigned int *index) const
905 { return (this+scriptList).find_index (tag, index); }
907 inline unsigned int get_feature_count (void) const
908 { return (this+featureList).len; }
909 inline const Tag& get_feature_tag (unsigned int i) const
910 { return (this+featureList).get_tag (i); }
911 inline unsigned int get_feature_tags (unsigned int start_offset,
912 unsigned int *feature_count /* IN/OUT */,
913 hb_tag_t *feature_tags /* OUT */) const
914 { return (this+featureList).get_tags (start_offset, feature_count, feature_tags); }
915 inline const Feature& get_feature (unsigned int i) const
916 { return (this+featureList)[i]; }
917 inline bool find_feature_index (hb_tag_t tag, unsigned int *index) const
918 { return (this+featureList).find_index (tag, index); }
920 inline unsigned int get_lookup_count (void) const
921 { return (this+lookupList).len; }
922 inline const Lookup& get_lookup (unsigned int i) const
923 { return (this+lookupList)[i]; }
925 inline bool sanitize (hb_sanitize_context_t *c) {
927 return version.sanitize (c) && likely (version.major == 1)
928 && scriptList.sanitize (c, this)
929 && featureList.sanitize (c, this)
930 && lookupList.sanitize (c, this);
934 FixedVersion version; /* Version of the GSUB/GPOS table--initially set
937 scriptList; /* ScriptList table */
938 OffsetTo<FeatureList>
939 featureList; /* FeatureList table */
941 lookupList; /* LookupList table */
943 DEFINE_SIZE_STATIC (10);
949 #endif /* HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH */