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"
34 #ifndef HB_DEBUG_APPLY
35 #define HB_DEBUG_APPLY HB_DEBUG+0
38 #define TRACE_APPLY() \
39 hb_trace_t<HB_DEBUG_APPLY> trace (&c->debug_depth, "APPLY", HB_FUNC, this); \
42 struct hb_apply_context_t
44 unsigned int debug_depth;
45 hb_ot_layout_context_t *layout;
47 unsigned int context_length;
48 unsigned int nesting_level_left;
49 unsigned int lookup_flag;
50 unsigned int property; /* propety of first glyph (TODO remove) */
57 #define BUFFER c->buffer
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->in_length, c->buffer->in_pos + c->context_length);
97 if (unlikely (c->buffer->in_pos + count > end))
100 for (i = 1, j = c->buffer->in_pos + 1; i < count; i++, j++)
102 while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[j], c->lookup_flag, NULL))
104 if (unlikely (j + count - i == end))
109 if (likely (!match_func (c->buffer->in_string[j].codepoint, input[i - 1], match_data)))
113 *context_length_out = j - c->buffer->in_pos;
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_pos < count))
127 for (unsigned int i = 0, j = c->buffer->out_pos - 1; i < count; i++, j--)
129 while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->out_string[j], c->lookup_flag, NULL))
131 if (unlikely (j + 1 == count - i))
136 if (likely (!match_func (c->buffer->out_string[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->in_length, c->buffer->in_pos + c->context_length);
152 if (unlikely (c->buffer->in_pos + offset + count > end))
155 for (i = 0, j = c->buffer->in_pos + offset; i < count; i++, j++)
157 while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[j], c->lookup_flag, NULL))
159 if (unlikely (j + count - i == end))
164 if (likely (!match_func (c->buffer->in_string[j].codepoint, lookahead[i], match_data)))
174 inline bool sanitize (hb_sanitize_context_t *c) {
176 return c->check_struct (this);
179 USHORT sequenceIndex; /* Index into current glyph
180 * sequence--first glyph = 0 */
181 USHORT lookupListIndex; /* Lookup to apply to that
182 * position--zero--based */
184 DEFINE_SIZE_STATIC (4);
187 static inline bool apply_lookup (hb_apply_context_t *c,
188 unsigned int count, /* Including the first glyph */
189 unsigned int lookupCount,
190 const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
191 apply_lookup_func_t apply_func)
193 unsigned int end = MIN (c->buffer->in_length, c->buffer->in_pos + c->context_length);
194 if (unlikely (c->buffer->in_pos + count > end))
197 /* TODO We don't support lookupRecord arrays that are not increasing:
198 * Should be easy for in_place ones at least. */
200 /* Note: If sublookup is reverse, i will underflow after the first loop
201 * and we jump out of it. Not entirely disastrous. So we don't check
202 * for reverse lookup here.
204 for (unsigned int i = 0; i < count; /* NOP */)
206 while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[c->buffer->in_pos], c->lookup_flag, NULL))
208 if (unlikely (c->buffer->in_pos == end))
210 /* No lookup applied for this index */
211 c->buffer->next_glyph ();
214 if (lookupCount && i == lookupRecord->sequenceIndex)
216 unsigned int old_pos = c->buffer->in_pos;
219 bool done = apply_func (c, lookupRecord->lookupListIndex);
223 /* Err, this is wrong if the lookup jumped over some glyphs */
224 i += c->buffer->in_pos - old_pos;
225 if (unlikely (c->buffer->in_pos == end))
234 /* No lookup applied for this index */
235 c->buffer->next_glyph ();
244 /* Contextual lookups */
246 struct ContextLookupContext
249 const void *match_data;
252 static inline bool context_lookup (hb_apply_context_t *c,
253 unsigned int inputCount, /* Including the first glyph (not matched) */
254 const USHORT input[], /* Array of input values--start with second glyph */
255 unsigned int lookupCount,
256 const LookupRecord lookupRecord[],
257 ContextLookupContext &lookup_context)
259 hb_apply_context_t new_context = *c;
260 return match_input (c,
262 lookup_context.funcs.match, lookup_context.match_data,
263 &new_context.context_length)
264 && apply_lookup (&new_context,
266 lookupCount, lookupRecord,
267 lookup_context.funcs.apply);
272 friend struct RuleSet;
275 inline bool apply (hb_apply_context_t *c, ContextLookupContext &lookup_context) const
278 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (input, input[0].static_size * (inputCount ? inputCount - 1 : 0));
279 return context_lookup (c,
281 lookupCount, lookupRecord,
286 inline bool sanitize (hb_sanitize_context_t *c) {
288 return inputCount.sanitize (c)
289 && lookupCount.sanitize (c)
290 && c->check_range (input,
291 input[0].static_size * inputCount
292 + lookupRecordX[0].static_size * lookupCount);
296 USHORT inputCount; /* Total number of glyphs in input
297 * glyph sequence--includes the first
299 USHORT lookupCount; /* Number of LookupRecords */
300 USHORT input[VAR]; /* Array of match inputs--start with
302 LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in
305 DEFINE_SIZE_ARRAY2 (4, input, lookupRecordX);
310 inline bool apply (hb_apply_context_t *c, ContextLookupContext &lookup_context) const
313 unsigned int num_rules = rule.len;
314 for (unsigned int i = 0; i < num_rules; i++)
316 if ((this+rule[i]).apply (c, lookup_context))
323 inline bool sanitize (hb_sanitize_context_t *c) {
325 return rule.sanitize (c, this);
330 rule; /* Array of Rule tables
331 * ordered by preference */
333 DEFINE_SIZE_ARRAY (2, rule);
337 struct ContextFormat1
339 friend struct Context;
342 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
345 unsigned int index = (this+coverage) (IN_CURGLYPH ());
346 if (likely (index == NOT_COVERED))
349 const RuleSet &rule_set = this+ruleSet[index];
350 struct ContextLookupContext lookup_context = {
351 {match_glyph, apply_func},
354 return rule_set.apply (c, lookup_context);
357 inline bool sanitize (hb_sanitize_context_t *c) {
359 return coverage.sanitize (c, this)
360 && ruleSet.sanitize (c, this);
364 USHORT format; /* Format identifier--format = 1 */
366 coverage; /* Offset to Coverage table--from
367 * beginning of table */
368 OffsetArrayOf<RuleSet>
369 ruleSet; /* Array of RuleSet tables
370 * ordered by Coverage Index */
372 DEFINE_SIZE_ARRAY (6, ruleSet);
376 struct ContextFormat2
378 friend struct Context;
381 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
384 unsigned int index = (this+coverage) (IN_CURGLYPH ());
385 if (likely (index == NOT_COVERED))
388 const ClassDef &class_def = this+classDef;
389 index = class_def (IN_CURGLYPH ());
390 const RuleSet &rule_set = this+ruleSet[index];
391 /* LONGTERMTODO: Old code fetches glyph classes at most once and caches
392 * them across subrule lookups. Not sure it's worth it.
394 struct ContextLookupContext lookup_context = {
395 {match_class, apply_func},
398 return rule_set.apply (c, lookup_context);
401 inline bool sanitize (hb_sanitize_context_t *c) {
403 return coverage.sanitize (c, this)
404 && classDef.sanitize (c, this)
405 && ruleSet.sanitize (c, this);
409 USHORT format; /* Format identifier--format = 2 */
411 coverage; /* Offset to Coverage table--from
412 * beginning of table */
414 classDef; /* Offset to glyph ClassDef table--from
415 * beginning of table */
416 OffsetArrayOf<RuleSet>
417 ruleSet; /* Array of RuleSet tables
418 * ordered by class */
420 DEFINE_SIZE_ARRAY (8, ruleSet);
424 struct ContextFormat3
426 friend struct Context;
429 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
432 unsigned int index = (this+coverage[0]) (IN_CURGLYPH ());
433 if (likely (index == NOT_COVERED))
436 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage, coverage[0].static_size * glyphCount);
437 struct ContextLookupContext lookup_context = {
438 {match_coverage, apply_func},
441 return context_lookup (c,
442 glyphCount, (const USHORT *) (coverage + 1),
443 lookupCount, lookupRecord,
447 inline bool sanitize (hb_sanitize_context_t *c) {
449 if (!c->check_struct (this)) return false;
450 unsigned int count = glyphCount;
451 if (!c->check_array (coverage, coverage[0].static_size, count)) return false;
452 for (unsigned int i = 0; i < count; i++)
453 if (!coverage[i].sanitize (c, this)) return false;
454 LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage, coverage[0].static_size * count);
455 return c->check_array (lookupRecord, lookupRecord[0].static_size, lookupCount);
459 USHORT format; /* Format identifier--format = 3 */
460 USHORT glyphCount; /* Number of glyphs in the input glyph
462 USHORT lookupCount; /* Number of LookupRecords */
464 coverage[VAR]; /* Array of offsets to Coverage
465 * table in glyph sequence order */
466 LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in
469 DEFINE_SIZE_ARRAY2 (6, coverage, lookupRecordX);
475 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
479 case 1: return u.format1.apply (c, apply_func);
480 case 2: return u.format2.apply (c, apply_func);
481 case 3: return u.format3.apply (c, apply_func);
482 default:return false;
486 inline bool sanitize (hb_sanitize_context_t *c) {
488 if (!u.format.sanitize (c)) return false;
490 case 1: return u.format1.sanitize (c);
491 case 2: return u.format2.sanitize (c);
492 case 3: return u.format3.sanitize (c);
499 USHORT format; /* Format identifier */
500 ContextFormat1 format1;
501 ContextFormat2 format2;
502 ContextFormat3 format3;
507 /* Chaining Contextual lookups */
509 struct ChainContextLookupContext
512 const void *match_data[3];
515 static inline bool chain_context_lookup (hb_apply_context_t *c,
516 unsigned int backtrackCount,
517 const USHORT backtrack[],
518 unsigned int inputCount, /* Including the first glyph (not matched) */
519 const USHORT input[], /* Array of input values--start with second glyph */
520 unsigned int lookaheadCount,
521 const USHORT lookahead[],
522 unsigned int lookupCount,
523 const LookupRecord lookupRecord[],
524 ChainContextLookupContext &lookup_context)
527 if (unlikely (c->buffer->out_pos < backtrackCount ||
528 c->buffer->in_pos + inputCount + lookaheadCount > c->buffer->in_length ||
529 inputCount + lookaheadCount > c->context_length))
532 hb_apply_context_t new_context = *c;
533 return match_backtrack (c,
534 backtrackCount, backtrack,
535 lookup_context.funcs.match, lookup_context.match_data[0])
538 lookup_context.funcs.match, lookup_context.match_data[1],
539 &new_context.context_length)
540 && match_lookahead (c,
541 lookaheadCount, lookahead,
542 lookup_context.funcs.match, lookup_context.match_data[2],
543 new_context.context_length)
544 && apply_lookup (&new_context,
546 lookupCount, lookupRecord,
547 lookup_context.funcs.apply);
552 friend struct ChainRuleSet;
555 inline bool apply (hb_apply_context_t *c, ChainContextLookupContext &lookup_context) const
558 const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
559 const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
560 const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
561 return chain_context_lookup (c,
562 backtrack.len, backtrack.array,
563 input.len, input.array,
564 lookahead.len, lookahead.array,
565 lookup.len, lookup.array,
571 inline bool sanitize (hb_sanitize_context_t *c) {
573 if (!backtrack.sanitize (c)) return false;
574 HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
575 if (!input.sanitize (c)) return false;
576 ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
577 if (!lookahead.sanitize (c)) return false;
578 ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
579 return lookup.sanitize (c);
584 backtrack; /* Array of backtracking values
585 * (to be matched before the input
587 HeadlessArrayOf<USHORT>
588 inputX; /* Array of input values (start with
591 lookaheadX; /* Array of lookahead values's (to be
592 * matched after the input sequence) */
593 ArrayOf<LookupRecord>
594 lookupX; /* Array of LookupRecords--in
602 inline bool apply (hb_apply_context_t *c, ChainContextLookupContext &lookup_context) const
605 unsigned int num_rules = rule.len;
606 for (unsigned int i = 0; i < num_rules; i++)
608 if ((this+rule[i]).apply (c, lookup_context))
615 inline bool sanitize (hb_sanitize_context_t *c) {
617 return rule.sanitize (c, this);
621 OffsetArrayOf<ChainRule>
622 rule; /* Array of ChainRule tables
623 * ordered by preference */
625 DEFINE_SIZE_ARRAY (2, rule);
628 struct ChainContextFormat1
630 friend struct ChainContext;
633 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
636 unsigned int index = (this+coverage) (IN_CURGLYPH ());
637 if (likely (index == NOT_COVERED))
640 const ChainRuleSet &rule_set = this+ruleSet[index];
641 struct ChainContextLookupContext lookup_context = {
642 {match_glyph, apply_func},
645 return rule_set.apply (c, lookup_context);
648 inline bool sanitize (hb_sanitize_context_t *c) {
650 return coverage.sanitize (c, this)
651 && ruleSet.sanitize (c, this);
655 USHORT format; /* Format identifier--format = 1 */
657 coverage; /* Offset to Coverage table--from
658 * beginning of table */
659 OffsetArrayOf<ChainRuleSet>
660 ruleSet; /* Array of ChainRuleSet tables
661 * ordered by Coverage Index */
663 DEFINE_SIZE_ARRAY (6, ruleSet);
666 struct ChainContextFormat2
668 friend struct ChainContext;
671 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
674 unsigned int index = (this+coverage) (IN_CURGLYPH ());
675 if (likely (index == NOT_COVERED))
678 const ClassDef &backtrack_class_def = this+backtrackClassDef;
679 const ClassDef &input_class_def = this+inputClassDef;
680 const ClassDef &lookahead_class_def = this+lookaheadClassDef;
682 index = input_class_def (IN_CURGLYPH ());
683 const ChainRuleSet &rule_set = this+ruleSet[index];
684 /* LONGTERMTODO: Old code fetches glyph classes at most once and caches
685 * them across subrule lookups. Not sure it's worth it.
687 struct ChainContextLookupContext lookup_context = {
688 {match_class, apply_func},
689 {&backtrack_class_def,
691 &lookahead_class_def}
693 return rule_set.apply (c, lookup_context);
696 inline bool sanitize (hb_sanitize_context_t *c) {
698 return coverage.sanitize (c, this)
699 && backtrackClassDef.sanitize (c, this)
700 && inputClassDef.sanitize (c, this)
701 && lookaheadClassDef.sanitize (c, this)
702 && ruleSet.sanitize (c, this);
706 USHORT format; /* Format identifier--format = 2 */
708 coverage; /* Offset to Coverage table--from
709 * beginning of table */
711 backtrackClassDef; /* Offset to glyph ClassDef table
712 * containing backtrack sequence
713 * data--from beginning of table */
715 inputClassDef; /* Offset to glyph ClassDef
716 * table containing input sequence
717 * data--from beginning of table */
719 lookaheadClassDef; /* Offset to glyph ClassDef table
720 * containing lookahead sequence
721 * data--from beginning of table */
722 OffsetArrayOf<ChainRuleSet>
723 ruleSet; /* Array of ChainRuleSet tables
724 * ordered by class */
726 DEFINE_SIZE_ARRAY (12, ruleSet);
729 struct ChainContextFormat3
731 friend struct ChainContext;
735 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
738 const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
740 unsigned int index = (this+input[0]) (IN_CURGLYPH ());
741 if (likely (index == NOT_COVERED))
744 const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (input);
745 const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
746 struct ChainContextLookupContext lookup_context = {
747 {match_coverage, apply_func},
750 return chain_context_lookup (c,
751 backtrack.len, (const USHORT *) backtrack.array,
752 input.len, (const USHORT *) input.array + 1,
753 lookahead.len, (const USHORT *) lookahead.array,
754 lookup.len, lookup.array,
759 inline bool sanitize (hb_sanitize_context_t *c) {
761 if (!backtrack.sanitize (c, this)) return false;
762 OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
763 if (!input.sanitize (c, this)) return false;
764 OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (input);
765 if (!lookahead.sanitize (c, this)) return false;
766 ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
767 return lookup.sanitize (c);
771 USHORT format; /* Format identifier--format = 3 */
772 OffsetArrayOf<Coverage>
773 backtrack; /* Array of coverage tables
774 * in backtracking sequence, in glyph
776 OffsetArrayOf<Coverage>
777 inputX ; /* Array of coverage
778 * tables in input sequence, in glyph
780 OffsetArrayOf<Coverage>
781 lookaheadX; /* Array of coverage tables
782 * in lookahead sequence, in glyph
784 ArrayOf<LookupRecord>
785 lookupX; /* Array of LookupRecords--in
788 DEFINE_SIZE_MIN (10);
794 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
798 case 1: return u.format1.apply (c, apply_func);
799 case 2: return u.format2.apply (c, apply_func);
800 case 3: return u.format3.apply (c, apply_func);
801 default:return false;
805 inline bool sanitize (hb_sanitize_context_t *c) {
807 if (!u.format.sanitize (c)) return false;
809 case 1: return u.format1.sanitize (c);
810 case 2: return u.format2.sanitize (c);
811 case 3: return u.format3.sanitize (c);
818 USHORT format; /* Format identifier */
819 ChainContextFormat1 format1;
820 ChainContextFormat2 format2;
821 ChainContextFormat3 format3;
826 struct ExtensionFormat1
828 friend struct Extension;
831 inline unsigned int get_type (void) const { return extensionLookupType; }
832 inline unsigned int get_offset (void) const { return extensionOffset; }
834 inline bool sanitize (hb_sanitize_context_t *c) {
836 return c->check_struct (this);
840 USHORT format; /* Format identifier. Set to 1. */
841 USHORT extensionLookupType; /* Lookup type of subtable referenced
842 * by ExtensionOffset (i.e. the
843 * extension subtable). */
844 ULONG extensionOffset; /* Offset to the extension subtable,
845 * of lookup type subtable. */
847 DEFINE_SIZE_STATIC (8);
852 inline unsigned int get_type (void) const
855 case 1: return u.format1.get_type ();
859 inline unsigned int get_offset (void) const
862 case 1: return u.format1.get_offset ();
867 inline bool sanitize (hb_sanitize_context_t *c) {
869 if (!u.format.sanitize (c)) return false;
871 case 1: return u.format1.sanitize (c);
878 USHORT format; /* Format identifier */
879 ExtensionFormat1 format1;
890 static const hb_tag_t GSUBTag = HB_OT_TAG_GSUB;
891 static const hb_tag_t GPOSTag = HB_OT_TAG_GPOS;
893 inline unsigned int get_script_count (void) const
894 { return (this+scriptList).len; }
895 inline const Tag& get_script_tag (unsigned int i) const
896 { return (this+scriptList).get_tag (i); }
897 inline unsigned int get_script_tags (unsigned int start_offset,
898 unsigned int *script_count /* IN/OUT */,
899 hb_tag_t *script_tags /* OUT */) const
900 { return (this+scriptList).get_tags (start_offset, script_count, script_tags); }
901 inline const Script& get_script (unsigned int i) const
902 { return (this+scriptList)[i]; }
903 inline bool find_script_index (hb_tag_t tag, unsigned int *index) const
904 { return (this+scriptList).find_index (tag, index); }
906 inline unsigned int get_feature_count (void) const
907 { return (this+featureList).len; }
908 inline const Tag& get_feature_tag (unsigned int i) const
909 { return (this+featureList).get_tag (i); }
910 inline unsigned int get_feature_tags (unsigned int start_offset,
911 unsigned int *feature_count /* IN/OUT */,
912 hb_tag_t *feature_tags /* OUT */) const
913 { return (this+featureList).get_tags (start_offset, feature_count, feature_tags); }
914 inline const Feature& get_feature (unsigned int i) const
915 { return (this+featureList)[i]; }
916 inline bool find_feature_index (hb_tag_t tag, unsigned int *index) const
917 { return (this+featureList).find_index (tag, index); }
919 inline unsigned int get_lookup_count (void) const
920 { return (this+lookupList).len; }
921 inline const Lookup& get_lookup (unsigned int i) const
922 { return (this+lookupList)[i]; }
924 inline bool sanitize (hb_sanitize_context_t *c) {
926 return version.sanitize (c) && likely (version.major == 1)
927 && scriptList.sanitize (c, this)
928 && featureList.sanitize (c, this)
929 && lookupList.sanitize (c, this);
933 FixedVersion version; /* Version of the GSUB/GPOS table--initially set
936 scriptList; /* ScriptList table */
937 OffsetTo<FeatureList>
938 featureList; /* FeatureList table */
940 lookupList; /* LookupList table */
942 DEFINE_SIZE_STATIC (10);
946 #endif /* HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH */