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) */
55 typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, const void *data);
56 typedef bool (*apply_lookup_func_t) (hb_apply_context_t *c, unsigned int lookup_index);
61 apply_lookup_func_t apply;
65 static inline bool match_glyph (hb_codepoint_t glyph_id, const USHORT &value, const void *data HB_UNUSED)
67 return glyph_id == value;
70 static inline bool match_class (hb_codepoint_t glyph_id, const USHORT &value, const void *data)
72 const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
73 return class_def.get_class (glyph_id) == value;
76 static inline bool match_coverage (hb_codepoint_t glyph_id, const USHORT &value, const void *data)
78 const OffsetTo<Coverage> &coverage = (const OffsetTo<Coverage>&)value;
79 return (data+coverage) (glyph_id) != NOT_COVERED;
83 static inline bool match_input (hb_apply_context_t *c,
84 unsigned int count, /* Including the first glyph (not matched) */
85 const USHORT input[], /* Array of input values--start with second glyph */
86 match_func_t match_func,
87 const void *match_data,
88 unsigned int *context_length_out)
91 unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
92 if (unlikely (c->buffer->in_pos + count > end))
95 for (i = 1, j = c->buffer->in_pos + 1; i < count; i++, j++)
97 while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL))
99 if (unlikely (j + count - i == end))
104 if (likely (!match_func (c->buffer->info[j].codepoint, input[i - 1], match_data)))
108 *context_length_out = j - c->buffer->in_pos;
113 static inline bool match_backtrack (hb_apply_context_t *c,
115 const USHORT backtrack[],
116 match_func_t match_func,
117 const void *match_data)
119 if (unlikely (c->buffer->out_length < count))
122 for (unsigned int i = 0, j = c->buffer->out_length - 1; i < count; i++, j--)
124 while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->out_info[j], c->lookup_flag, NULL))
126 if (unlikely (j + 1 == count - i))
131 if (likely (!match_func (c->buffer->out_info[j].codepoint, backtrack[i], match_data)))
138 static inline bool match_lookahead (hb_apply_context_t *c,
140 const USHORT lookahead[],
141 match_func_t match_func,
142 const void *match_data,
146 unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
147 if (unlikely (c->buffer->in_pos + offset + count > end))
150 for (i = 0, j = c->buffer->in_pos + offset; i < count; i++, j++)
152 while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_flag, NULL))
154 if (unlikely (j + count - i == end))
159 if (likely (!match_func (c->buffer->info[j].codepoint, lookahead[i], match_data)))
169 inline bool sanitize (hb_sanitize_context_t *c) {
171 return c->check_struct (this);
174 USHORT sequenceIndex; /* Index into current glyph
175 * sequence--first glyph = 0 */
176 USHORT lookupListIndex; /* Lookup to apply to that
177 * position--zero--based */
179 DEFINE_SIZE_STATIC (4);
182 static inline bool apply_lookup (hb_apply_context_t *c,
183 unsigned int count, /* Including the first glyph */
184 unsigned int lookupCount,
185 const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
186 apply_lookup_func_t apply_func)
188 unsigned int end = MIN (c->buffer->len, c->buffer->in_pos + c->context_length);
189 if (unlikely (c->buffer->in_pos + count > end))
192 /* TODO We don't support lookupRecord arrays that are not increasing:
193 * Should be easy for in_place ones at least. */
195 /* Note: If sublookup is reverse, i will underflow after the first loop
196 * and we jump out of it. Not entirely disastrous. So we don't check
197 * for reverse lookup here.
199 for (unsigned int i = 0; i < count; /* NOP */)
201 while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[c->buffer->in_pos], c->lookup_flag, NULL))
203 if (unlikely (c->buffer->in_pos == end))
205 /* No lookup applied for this index */
206 c->buffer->next_glyph ();
209 if (lookupCount && i == lookupRecord->sequenceIndex)
211 unsigned int old_pos = c->buffer->in_pos;
214 bool done = apply_func (c, lookupRecord->lookupListIndex);
218 /* Err, this is wrong if the lookup jumped over some glyphs */
219 i += c->buffer->in_pos - old_pos;
220 if (unlikely (c->buffer->in_pos == end))
229 /* No lookup applied for this index */
230 c->buffer->next_glyph ();
239 /* Contextual lookups */
241 struct ContextLookupContext
244 const void *match_data;
247 static inline bool context_lookup (hb_apply_context_t *c,
248 unsigned int inputCount, /* Including the first glyph (not matched) */
249 const USHORT input[], /* Array of input values--start with second glyph */
250 unsigned int lookupCount,
251 const LookupRecord lookupRecord[],
252 ContextLookupContext &lookup_context)
254 hb_apply_context_t new_context = *c;
255 return match_input (c,
257 lookup_context.funcs.match, lookup_context.match_data,
258 &new_context.context_length)
259 && apply_lookup (&new_context,
261 lookupCount, lookupRecord,
262 lookup_context.funcs.apply);
267 friend struct RuleSet;
270 inline bool apply (hb_apply_context_t *c, ContextLookupContext &lookup_context) const
273 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (input, input[0].static_size * (inputCount ? inputCount - 1 : 0));
274 return context_lookup (c,
276 lookupCount, lookupRecord,
281 inline bool sanitize (hb_sanitize_context_t *c) {
283 return inputCount.sanitize (c)
284 && lookupCount.sanitize (c)
285 && c->check_range (input,
286 input[0].static_size * inputCount
287 + lookupRecordX[0].static_size * lookupCount);
291 USHORT inputCount; /* Total number of glyphs in input
292 * glyph sequence--includes the first
294 USHORT lookupCount; /* Number of LookupRecords */
295 USHORT input[VAR]; /* Array of match inputs--start with
297 LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in
300 DEFINE_SIZE_ARRAY2 (4, input, lookupRecordX);
305 inline bool apply (hb_apply_context_t *c, ContextLookupContext &lookup_context) const
308 unsigned int num_rules = rule.len;
309 for (unsigned int i = 0; i < num_rules; i++)
311 if ((this+rule[i]).apply (c, lookup_context))
318 inline bool sanitize (hb_sanitize_context_t *c) {
320 return rule.sanitize (c, this);
325 rule; /* Array of Rule tables
326 * ordered by preference */
328 DEFINE_SIZE_ARRAY (2, rule);
332 struct ContextFormat1
334 friend struct Context;
337 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
340 unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
341 if (likely (index == NOT_COVERED))
344 const RuleSet &rule_set = this+ruleSet[index];
345 struct ContextLookupContext lookup_context = {
346 {match_glyph, apply_func},
349 return rule_set.apply (c, lookup_context);
352 inline bool sanitize (hb_sanitize_context_t *c) {
354 return coverage.sanitize (c, this)
355 && ruleSet.sanitize (c, this);
359 USHORT format; /* Format identifier--format = 1 */
361 coverage; /* Offset to Coverage table--from
362 * beginning of table */
363 OffsetArrayOf<RuleSet>
364 ruleSet; /* Array of RuleSet tables
365 * ordered by Coverage Index */
367 DEFINE_SIZE_ARRAY (6, ruleSet);
371 struct ContextFormat2
373 friend struct Context;
376 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
379 unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
380 if (likely (index == NOT_COVERED))
383 const ClassDef &class_def = this+classDef;
384 index = class_def (c->buffer->info[c->buffer->in_pos].codepoint);
385 const RuleSet &rule_set = this+ruleSet[index];
386 /* LONGTERMTODO: Old code fetches glyph classes at most once and caches
387 * them across subrule lookups. Not sure it's worth it.
389 struct ContextLookupContext lookup_context = {
390 {match_class, apply_func},
393 return rule_set.apply (c, lookup_context);
396 inline bool sanitize (hb_sanitize_context_t *c) {
398 return coverage.sanitize (c, this)
399 && classDef.sanitize (c, this)
400 && ruleSet.sanitize (c, this);
404 USHORT format; /* Format identifier--format = 2 */
406 coverage; /* Offset to Coverage table--from
407 * beginning of table */
409 classDef; /* Offset to glyph ClassDef table--from
410 * beginning of table */
411 OffsetArrayOf<RuleSet>
412 ruleSet; /* Array of RuleSet tables
413 * ordered by class */
415 DEFINE_SIZE_ARRAY (8, ruleSet);
419 struct ContextFormat3
421 friend struct Context;
424 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
427 unsigned int index = (this+coverage[0]) (c->buffer->info[c->buffer->in_pos].codepoint);
428 if (likely (index == NOT_COVERED))
431 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage, coverage[0].static_size * glyphCount);
432 struct ContextLookupContext lookup_context = {
433 {match_coverage, apply_func},
436 return context_lookup (c,
437 glyphCount, (const USHORT *) (coverage + 1),
438 lookupCount, lookupRecord,
442 inline bool sanitize (hb_sanitize_context_t *c) {
444 if (!c->check_struct (this)) return false;
445 unsigned int count = glyphCount;
446 if (!c->check_array (coverage, coverage[0].static_size, count)) return false;
447 for (unsigned int i = 0; i < count; i++)
448 if (!coverage[i].sanitize (c, this)) return false;
449 LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage, coverage[0].static_size * count);
450 return c->check_array (lookupRecord, lookupRecord[0].static_size, lookupCount);
454 USHORT format; /* Format identifier--format = 3 */
455 USHORT glyphCount; /* Number of glyphs in the input glyph
457 USHORT lookupCount; /* Number of LookupRecords */
459 coverage[VAR]; /* Array of offsets to Coverage
460 * table in glyph sequence order */
461 LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in
464 DEFINE_SIZE_ARRAY2 (6, coverage, lookupRecordX);
470 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
474 case 1: return u.format1.apply (c, apply_func);
475 case 2: return u.format2.apply (c, apply_func);
476 case 3: return u.format3.apply (c, apply_func);
477 default:return false;
481 inline bool sanitize (hb_sanitize_context_t *c) {
483 if (!u.format.sanitize (c)) return false;
485 case 1: return u.format1.sanitize (c);
486 case 2: return u.format2.sanitize (c);
487 case 3: return u.format3.sanitize (c);
494 USHORT format; /* Format identifier */
495 ContextFormat1 format1;
496 ContextFormat2 format2;
497 ContextFormat3 format3;
502 /* Chaining Contextual lookups */
504 struct ChainContextLookupContext
507 const void *match_data[3];
510 static inline bool chain_context_lookup (hb_apply_context_t *c,
511 unsigned int backtrackCount,
512 const USHORT backtrack[],
513 unsigned int inputCount, /* Including the first glyph (not matched) */
514 const USHORT input[], /* Array of input values--start with second glyph */
515 unsigned int lookaheadCount,
516 const USHORT lookahead[],
517 unsigned int lookupCount,
518 const LookupRecord lookupRecord[],
519 ChainContextLookupContext &lookup_context)
522 if (unlikely (c->buffer->out_length < backtrackCount ||
523 c->buffer->in_pos + inputCount + lookaheadCount > c->buffer->len ||
524 inputCount + lookaheadCount > c->context_length))
527 hb_apply_context_t new_context = *c;
528 return match_backtrack (c,
529 backtrackCount, backtrack,
530 lookup_context.funcs.match, lookup_context.match_data[0])
533 lookup_context.funcs.match, lookup_context.match_data[1],
534 &new_context.context_length)
535 && match_lookahead (c,
536 lookaheadCount, lookahead,
537 lookup_context.funcs.match, lookup_context.match_data[2],
538 new_context.context_length)
539 && apply_lookup (&new_context,
541 lookupCount, lookupRecord,
542 lookup_context.funcs.apply);
547 friend struct ChainRuleSet;
550 inline bool apply (hb_apply_context_t *c, ChainContextLookupContext &lookup_context) const
553 const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
554 const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
555 const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
556 return chain_context_lookup (c,
557 backtrack.len, backtrack.array,
558 input.len, input.array,
559 lookahead.len, lookahead.array,
560 lookup.len, lookup.array,
566 inline bool sanitize (hb_sanitize_context_t *c) {
568 if (!backtrack.sanitize (c)) return false;
569 HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
570 if (!input.sanitize (c)) return false;
571 ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
572 if (!lookahead.sanitize (c)) return false;
573 ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
574 return lookup.sanitize (c);
579 backtrack; /* Array of backtracking values
580 * (to be matched before the input
582 HeadlessArrayOf<USHORT>
583 inputX; /* Array of input values (start with
586 lookaheadX; /* Array of lookahead values's (to be
587 * matched after the input sequence) */
588 ArrayOf<LookupRecord>
589 lookupX; /* Array of LookupRecords--in
597 inline bool apply (hb_apply_context_t *c, ChainContextLookupContext &lookup_context) const
600 unsigned int num_rules = rule.len;
601 for (unsigned int i = 0; i < num_rules; i++)
603 if ((this+rule[i]).apply (c, lookup_context))
610 inline bool sanitize (hb_sanitize_context_t *c) {
612 return rule.sanitize (c, this);
616 OffsetArrayOf<ChainRule>
617 rule; /* Array of ChainRule tables
618 * ordered by preference */
620 DEFINE_SIZE_ARRAY (2, rule);
623 struct ChainContextFormat1
625 friend struct ChainContext;
628 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
631 unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
632 if (likely (index == NOT_COVERED))
635 const ChainRuleSet &rule_set = this+ruleSet[index];
636 struct ChainContextLookupContext lookup_context = {
637 {match_glyph, apply_func},
640 return rule_set.apply (c, lookup_context);
643 inline bool sanitize (hb_sanitize_context_t *c) {
645 return coverage.sanitize (c, this)
646 && ruleSet.sanitize (c, this);
650 USHORT format; /* Format identifier--format = 1 */
652 coverage; /* Offset to Coverage table--from
653 * beginning of table */
654 OffsetArrayOf<ChainRuleSet>
655 ruleSet; /* Array of ChainRuleSet tables
656 * ordered by Coverage Index */
658 DEFINE_SIZE_ARRAY (6, ruleSet);
661 struct ChainContextFormat2
663 friend struct ChainContext;
666 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
669 unsigned int index = (this+coverage) (c->buffer->info[c->buffer->in_pos].codepoint);
670 if (likely (index == NOT_COVERED))
673 const ClassDef &backtrack_class_def = this+backtrackClassDef;
674 const ClassDef &input_class_def = this+inputClassDef;
675 const ClassDef &lookahead_class_def = this+lookaheadClassDef;
677 index = input_class_def (c->buffer->info[c->buffer->in_pos].codepoint);
678 const ChainRuleSet &rule_set = this+ruleSet[index];
679 /* LONGTERMTODO: Old code fetches glyph classes at most once and caches
680 * them across subrule lookups. Not sure it's worth it.
682 struct ChainContextLookupContext lookup_context = {
683 {match_class, apply_func},
684 {&backtrack_class_def,
686 &lookahead_class_def}
688 return rule_set.apply (c, lookup_context);
691 inline bool sanitize (hb_sanitize_context_t *c) {
693 return coverage.sanitize (c, this)
694 && backtrackClassDef.sanitize (c, this)
695 && inputClassDef.sanitize (c, this)
696 && lookaheadClassDef.sanitize (c, this)
697 && ruleSet.sanitize (c, this);
701 USHORT format; /* Format identifier--format = 2 */
703 coverage; /* Offset to Coverage table--from
704 * beginning of table */
706 backtrackClassDef; /* Offset to glyph ClassDef table
707 * containing backtrack sequence
708 * data--from beginning of table */
710 inputClassDef; /* Offset to glyph ClassDef
711 * table containing input sequence
712 * data--from beginning of table */
714 lookaheadClassDef; /* Offset to glyph ClassDef table
715 * containing lookahead sequence
716 * data--from beginning of table */
717 OffsetArrayOf<ChainRuleSet>
718 ruleSet; /* Array of ChainRuleSet tables
719 * ordered by class */
721 DEFINE_SIZE_ARRAY (12, ruleSet);
724 struct ChainContextFormat3
726 friend struct ChainContext;
730 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
733 const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
735 unsigned int index = (this+input[0]) (c->buffer->info[c->buffer->in_pos].codepoint);
736 if (likely (index == NOT_COVERED))
739 const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (input);
740 const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
741 struct ChainContextLookupContext lookup_context = {
742 {match_coverage, apply_func},
745 return chain_context_lookup (c,
746 backtrack.len, (const USHORT *) backtrack.array,
747 input.len, (const USHORT *) input.array + 1,
748 lookahead.len, (const USHORT *) lookahead.array,
749 lookup.len, lookup.array,
754 inline bool sanitize (hb_sanitize_context_t *c) {
756 if (!backtrack.sanitize (c, this)) return false;
757 OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
758 if (!input.sanitize (c, this)) return false;
759 OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (input);
760 if (!lookahead.sanitize (c, this)) return false;
761 ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
762 return lookup.sanitize (c);
766 USHORT format; /* Format identifier--format = 3 */
767 OffsetArrayOf<Coverage>
768 backtrack; /* Array of coverage tables
769 * in backtracking sequence, in glyph
771 OffsetArrayOf<Coverage>
772 inputX ; /* Array of coverage
773 * tables in input sequence, in glyph
775 OffsetArrayOf<Coverage>
776 lookaheadX; /* Array of coverage tables
777 * in lookahead sequence, in glyph
779 ArrayOf<LookupRecord>
780 lookupX; /* Array of LookupRecords--in
783 DEFINE_SIZE_MIN (10);
789 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
793 case 1: return u.format1.apply (c, apply_func);
794 case 2: return u.format2.apply (c, apply_func);
795 case 3: return u.format3.apply (c, apply_func);
796 default:return false;
800 inline bool sanitize (hb_sanitize_context_t *c) {
802 if (!u.format.sanitize (c)) return false;
804 case 1: return u.format1.sanitize (c);
805 case 2: return u.format2.sanitize (c);
806 case 3: return u.format3.sanitize (c);
813 USHORT format; /* Format identifier */
814 ChainContextFormat1 format1;
815 ChainContextFormat2 format2;
816 ChainContextFormat3 format3;
821 struct ExtensionFormat1
823 friend struct Extension;
826 inline unsigned int get_type (void) const { return extensionLookupType; }
827 inline unsigned int get_offset (void) const { return extensionOffset; }
829 inline bool sanitize (hb_sanitize_context_t *c) {
831 return c->check_struct (this);
835 USHORT format; /* Format identifier. Set to 1. */
836 USHORT extensionLookupType; /* Lookup type of subtable referenced
837 * by ExtensionOffset (i.e. the
838 * extension subtable). */
839 ULONG extensionOffset; /* Offset to the extension subtable,
840 * of lookup type subtable. */
842 DEFINE_SIZE_STATIC (8);
847 inline unsigned int get_type (void) const
850 case 1: return u.format1.get_type ();
854 inline unsigned int get_offset (void) const
857 case 1: return u.format1.get_offset ();
862 inline bool sanitize (hb_sanitize_context_t *c) {
864 if (!u.format.sanitize (c)) return false;
866 case 1: return u.format1.sanitize (c);
873 USHORT format; /* Format identifier */
874 ExtensionFormat1 format1;
885 static const hb_tag_t GSUBTag = HB_OT_TAG_GSUB;
886 static const hb_tag_t GPOSTag = HB_OT_TAG_GPOS;
888 inline unsigned int get_script_count (void) const
889 { return (this+scriptList).len; }
890 inline const Tag& get_script_tag (unsigned int i) const
891 { return (this+scriptList).get_tag (i); }
892 inline unsigned int get_script_tags (unsigned int start_offset,
893 unsigned int *script_count /* IN/OUT */,
894 hb_tag_t *script_tags /* OUT */) const
895 { return (this+scriptList).get_tags (start_offset, script_count, script_tags); }
896 inline const Script& get_script (unsigned int i) const
897 { return (this+scriptList)[i]; }
898 inline bool find_script_index (hb_tag_t tag, unsigned int *index) const
899 { return (this+scriptList).find_index (tag, index); }
901 inline unsigned int get_feature_count (void) const
902 { return (this+featureList).len; }
903 inline const Tag& get_feature_tag (unsigned int i) const
904 { return (this+featureList).get_tag (i); }
905 inline unsigned int get_feature_tags (unsigned int start_offset,
906 unsigned int *feature_count /* IN/OUT */,
907 hb_tag_t *feature_tags /* OUT */) const
908 { return (this+featureList).get_tags (start_offset, feature_count, feature_tags); }
909 inline const Feature& get_feature (unsigned int i) const
910 { return (this+featureList)[i]; }
911 inline bool find_feature_index (hb_tag_t tag, unsigned int *index) const
912 { return (this+featureList).find_index (tag, index); }
914 inline unsigned int get_lookup_count (void) const
915 { return (this+lookupList).len; }
916 inline const Lookup& get_lookup (unsigned int i) const
917 { return (this+lookupList)[i]; }
919 inline bool sanitize (hb_sanitize_context_t *c) {
921 return version.sanitize (c) && likely (version.major == 1)
922 && scriptList.sanitize (c, this)
923 && featureList.sanitize (c, this)
924 && lookupList.sanitize (c, this);
928 FixedVersion version; /* Version of the GSUB/GPOS table--initially set
931 scriptList; /* ScriptList table */
932 OffsetTo<FeatureList>
933 featureList; /* FeatureList table */
935 lookupList; /* LookupList table */
937 DEFINE_SIZE_STATIC (10);
941 #endif /* HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH */