2 * Copyright (C) 2007,2008,2009,2010 Red Hat, Inc.
3 * Copyright (C) 2010 Google, Inc.
5 * This is part of HarfBuzz, a text shaping library.
7 * Permission is hereby granted, without written agreement and without
8 * license or royalty fees, to use, copy, modify, and distribute this
9 * software and its documentation for any purpose, provided that the
10 * above copyright notice and the following two paragraphs appear in
11 * all copies of this software.
13 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
14 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
15 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
16 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
19 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
20 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
22 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
23 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
25 * Red Hat Author(s): Behdad Esfahbod
26 * Google Author(s): Behdad Esfahbod
29 #ifndef HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH
30 #define HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH
32 #include "hb-buffer-private.hh"
33 #include "hb-ot-layout-gdef-private.hh"
38 /* buffer var allocations */
39 #define lig_id() var2.u16[0] /* unique ligature id */
40 #define lig_comp() var2.u16[1] /* component number in the ligature (0 = base) */
43 #ifndef HB_DEBUG_APPLY
44 #define HB_DEBUG_APPLY (HB_DEBUG+0)
47 #define TRACE_APPLY() \
48 hb_trace_t<HB_DEBUG_APPLY> trace (&c->debug_depth, "APPLY", HB_FUNC, this); \
53 struct hb_apply_context_t
55 unsigned int debug_depth;
56 hb_ot_layout_context_t *layout;
58 hb_mask_t lookup_mask;
59 unsigned int context_length;
60 unsigned int nesting_level_left;
61 unsigned int lookup_props;
62 unsigned int property; /* propety of first glyph */
65 inline void replace_glyph (hb_codepoint_t glyph_index) const
68 buffer->replace_glyph (glyph_index);
70 inline void replace_glyphs_be16 (unsigned int num_in,
72 const uint16_t *glyph_data_be) const
75 buffer->replace_glyphs_be16 (num_in, num_out, glyph_data_be);
78 inline void guess_glyph_class (unsigned int klass)
80 // buffer->info[buffer->i].props_cache() = klass;
84 inline void clear_property (void) const
86 buffer->info[buffer->i].props_cache() = 0;
92 typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, const void *data);
93 typedef bool (*apply_lookup_func_t) (hb_apply_context_t *c, unsigned int lookup_index);
98 apply_lookup_func_t apply;
102 static inline bool match_glyph (hb_codepoint_t glyph_id, const USHORT &value, const void *data HB_UNUSED)
104 return glyph_id == value;
107 static inline bool match_class (hb_codepoint_t glyph_id, const USHORT &value, const void *data)
109 const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
110 return class_def.get_class (glyph_id) == value;
113 static inline bool match_coverage (hb_codepoint_t glyph_id, const USHORT &value, const void *data)
115 const OffsetTo<Coverage> &coverage = (const OffsetTo<Coverage>&)value;
116 return (data+coverage) (glyph_id) != NOT_COVERED;
120 static inline bool match_input (hb_apply_context_t *c,
121 unsigned int count, /* Including the first glyph (not matched) */
122 const USHORT input[], /* Array of input values--start with second glyph */
123 match_func_t match_func,
124 const void *match_data,
125 unsigned int *context_length_out)
128 unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
129 if (unlikely (c->buffer->i + count > end))
132 for (i = 1, j = c->buffer->i + 1; i < count; i++, j++)
134 while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_props, NULL))
136 if (unlikely (j + count - i == end))
141 if (likely (!match_func (c->buffer->info[j].codepoint, input[i - 1], match_data)))
145 *context_length_out = j - c->buffer->i;
150 static inline bool match_backtrack (hb_apply_context_t *c,
152 const USHORT backtrack[],
153 match_func_t match_func,
154 const void *match_data)
156 if (unlikely (c->buffer->out_len < count))
159 for (unsigned int i = 0, j = c->buffer->out_len - 1; i < count; i++, j--)
161 while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->out_info[j], c->lookup_props, NULL))
163 if (unlikely (j + 1 == count - i))
168 if (likely (!match_func (c->buffer->out_info[j].codepoint, backtrack[i], match_data)))
175 static inline bool match_lookahead (hb_apply_context_t *c,
177 const USHORT lookahead[],
178 match_func_t match_func,
179 const void *match_data,
183 unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
184 if (unlikely (c->buffer->i + offset + count > end))
187 for (i = 0, j = c->buffer->i + offset; i < count; i++, j++)
189 while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[j], c->lookup_props, NULL))
191 if (unlikely (j + count - i == end))
196 if (likely (!match_func (c->buffer->info[j].codepoint, lookahead[i], match_data)))
208 inline bool sanitize (hb_sanitize_context_t *c) {
210 return c->check_struct (this);
213 USHORT sequenceIndex; /* Index into current glyph
214 * sequence--first glyph = 0 */
215 USHORT lookupListIndex; /* Lookup to apply to that
216 * position--zero--based */
218 DEFINE_SIZE_STATIC (4);
224 static inline bool apply_lookup (hb_apply_context_t *c,
225 unsigned int count, /* Including the first glyph */
226 unsigned int lookupCount,
227 const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
228 apply_lookup_func_t apply_func)
230 unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
231 if (unlikely (c->buffer->i + count > end))
234 /* TODO We don't support lookupRecord arrays that are not increasing:
235 * Should be easy for in_place ones at least. */
237 /* Note: If sublookup is reverse, i will underflow after the first loop
238 * and we jump out of it. Not entirely disastrous. So we don't check
239 * for reverse lookup here.
241 for (unsigned int i = 0; i < count; /* NOP */)
243 while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->info[c->buffer->i], c->lookup_props, NULL))
245 if (unlikely (c->buffer->i == end))
247 /* No lookup applied for this index */
248 c->buffer->next_glyph ();
251 if (lookupCount && i == lookupRecord->sequenceIndex)
253 unsigned int old_pos = c->buffer->i;
256 bool done = apply_func (c, lookupRecord->lookupListIndex);
260 /* Err, this is wrong if the lookup jumped over some glyphs */
261 i += c->buffer->i - old_pos;
262 if (unlikely (c->buffer->i == end))
271 /* No lookup applied for this index */
272 c->buffer->next_glyph ();
283 /* Contextual lookups */
285 struct ContextLookupContext
288 const void *match_data;
291 static inline bool context_lookup (hb_apply_context_t *c,
292 unsigned int inputCount, /* Including the first glyph (not matched) */
293 const USHORT input[], /* Array of input values--start with second glyph */
294 unsigned int lookupCount,
295 const LookupRecord lookupRecord[],
296 ContextLookupContext &lookup_context)
298 hb_apply_context_t new_context = *c;
299 return match_input (c,
301 lookup_context.funcs.match, lookup_context.match_data,
302 &new_context.context_length)
303 && apply_lookup (&new_context,
305 lookupCount, lookupRecord,
306 lookup_context.funcs.apply);
311 friend struct RuleSet;
314 inline bool apply (hb_apply_context_t *c, ContextLookupContext &lookup_context) const
317 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (input, input[0].static_size * (inputCount ? inputCount - 1 : 0));
318 return context_lookup (c,
320 lookupCount, lookupRecord,
325 inline bool sanitize (hb_sanitize_context_t *c) {
327 return inputCount.sanitize (c)
328 && lookupCount.sanitize (c)
329 && c->check_range (input,
330 input[0].static_size * inputCount
331 + lookupRecordX[0].static_size * lookupCount);
335 USHORT inputCount; /* Total number of glyphs in input
336 * glyph sequence--includes the first
338 USHORT lookupCount; /* Number of LookupRecords */
339 USHORT input[VAR]; /* Array of match inputs--start with
341 LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in
344 DEFINE_SIZE_ARRAY2 (4, input, lookupRecordX);
349 inline bool apply (hb_apply_context_t *c, ContextLookupContext &lookup_context) const
352 unsigned int num_rules = rule.len;
353 for (unsigned int i = 0; i < num_rules; i++)
355 if ((this+rule[i]).apply (c, lookup_context))
362 inline bool sanitize (hb_sanitize_context_t *c) {
364 return rule.sanitize (c, this);
369 rule; /* Array of Rule tables
370 * ordered by preference */
372 DEFINE_SIZE_ARRAY (2, rule);
376 struct ContextFormat1
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) (c->buffer->info[c->buffer->i].codepoint);
385 if (likely (index == NOT_COVERED))
388 const RuleSet &rule_set = this+ruleSet[index];
389 struct ContextLookupContext lookup_context = {
390 {match_glyph, 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 && ruleSet.sanitize (c, this);
403 USHORT format; /* Format identifier--format = 1 */
405 coverage; /* Offset to Coverage table--from
406 * beginning of table */
407 OffsetArrayOf<RuleSet>
408 ruleSet; /* Array of RuleSet tables
409 * ordered by Coverage Index */
411 DEFINE_SIZE_ARRAY (6, ruleSet);
415 struct ContextFormat2
417 friend struct Context;
420 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
423 unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
424 if (likely (index == NOT_COVERED))
427 const ClassDef &class_def = this+classDef;
428 index = class_def (c->buffer->info[c->buffer->i].codepoint);
429 const RuleSet &rule_set = this+ruleSet[index];
430 struct ContextLookupContext lookup_context = {
431 {match_class, apply_func},
434 return rule_set.apply (c, lookup_context);
437 inline bool sanitize (hb_sanitize_context_t *c) {
439 return coverage.sanitize (c, this)
440 && classDef.sanitize (c, this)
441 && ruleSet.sanitize (c, this);
445 USHORT format; /* Format identifier--format = 2 */
447 coverage; /* Offset to Coverage table--from
448 * beginning of table */
450 classDef; /* Offset to glyph ClassDef table--from
451 * beginning of table */
452 OffsetArrayOf<RuleSet>
453 ruleSet; /* Array of RuleSet tables
454 * ordered by class */
456 DEFINE_SIZE_ARRAY (8, ruleSet);
460 struct ContextFormat3
462 friend struct Context;
465 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
468 unsigned int index = (this+coverage[0]) (c->buffer->info[c->buffer->i].codepoint);
469 if (likely (index == NOT_COVERED))
472 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage, coverage[0].static_size * glyphCount);
473 struct ContextLookupContext lookup_context = {
474 {match_coverage, apply_func},
477 return context_lookup (c,
478 glyphCount, (const USHORT *) (coverage + 1),
479 lookupCount, lookupRecord,
483 inline bool sanitize (hb_sanitize_context_t *c) {
485 if (!c->check_struct (this)) return false;
486 unsigned int count = glyphCount;
487 if (!c->check_array (coverage, coverage[0].static_size, count)) return false;
488 for (unsigned int i = 0; i < count; i++)
489 if (!coverage[i].sanitize (c, this)) return false;
490 LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage, coverage[0].static_size * count);
491 return c->check_array (lookupRecord, lookupRecord[0].static_size, lookupCount);
495 USHORT format; /* Format identifier--format = 3 */
496 USHORT glyphCount; /* Number of glyphs in the input glyph
498 USHORT lookupCount; /* Number of LookupRecords */
500 coverage[VAR]; /* Array of offsets to Coverage
501 * table in glyph sequence order */
502 LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in
505 DEFINE_SIZE_ARRAY2 (6, coverage, lookupRecordX);
511 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
515 case 1: return u.format1.apply (c, apply_func);
516 case 2: return u.format2.apply (c, apply_func);
517 case 3: return u.format3.apply (c, apply_func);
518 default:return false;
522 inline bool sanitize (hb_sanitize_context_t *c) {
524 if (!u.format.sanitize (c)) return false;
526 case 1: return u.format1.sanitize (c);
527 case 2: return u.format2.sanitize (c);
528 case 3: return u.format3.sanitize (c);
535 USHORT format; /* Format identifier */
536 ContextFormat1 format1;
537 ContextFormat2 format2;
538 ContextFormat3 format3;
543 /* Chaining Contextual lookups */
545 struct ChainContextLookupContext
548 const void *match_data[3];
551 static inline bool chain_context_lookup (hb_apply_context_t *c,
552 unsigned int backtrackCount,
553 const USHORT backtrack[],
554 unsigned int inputCount, /* Including the first glyph (not matched) */
555 const USHORT input[], /* Array of input values--start with second glyph */
556 unsigned int lookaheadCount,
557 const USHORT lookahead[],
558 unsigned int lookupCount,
559 const LookupRecord lookupRecord[],
560 ChainContextLookupContext &lookup_context)
563 if (unlikely (c->buffer->out_len < backtrackCount ||
564 c->buffer->i + inputCount + lookaheadCount > c->buffer->len ||
565 inputCount + lookaheadCount > c->context_length))
568 hb_apply_context_t new_context = *c;
569 return match_backtrack (c,
570 backtrackCount, backtrack,
571 lookup_context.funcs.match, lookup_context.match_data[0])
574 lookup_context.funcs.match, lookup_context.match_data[1],
575 &new_context.context_length)
576 && match_lookahead (c,
577 lookaheadCount, lookahead,
578 lookup_context.funcs.match, lookup_context.match_data[2],
579 new_context.context_length)
580 && apply_lookup (&new_context,
582 lookupCount, lookupRecord,
583 lookup_context.funcs.apply);
588 friend struct ChainRuleSet;
591 inline bool apply (hb_apply_context_t *c, ChainContextLookupContext &lookup_context) const
594 const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
595 const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
596 const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
597 return chain_context_lookup (c,
598 backtrack.len, backtrack.array,
599 input.len, input.array,
600 lookahead.len, lookahead.array,
601 lookup.len, lookup.array,
606 inline bool sanitize (hb_sanitize_context_t *c) {
608 if (!backtrack.sanitize (c)) return false;
609 HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
610 if (!input.sanitize (c)) return false;
611 ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
612 if (!lookahead.sanitize (c)) return false;
613 ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
614 return lookup.sanitize (c);
619 backtrack; /* Array of backtracking values
620 * (to be matched before the input
622 HeadlessArrayOf<USHORT>
623 inputX; /* Array of input values (start with
626 lookaheadX; /* Array of lookahead values's (to be
627 * matched after the input sequence) */
628 ArrayOf<LookupRecord>
629 lookupX; /* Array of LookupRecords--in
637 inline bool apply (hb_apply_context_t *c, ChainContextLookupContext &lookup_context) const
640 unsigned int num_rules = rule.len;
641 for (unsigned int i = 0; i < num_rules; i++)
643 if ((this+rule[i]).apply (c, lookup_context))
650 inline bool sanitize (hb_sanitize_context_t *c) {
652 return rule.sanitize (c, this);
656 OffsetArrayOf<ChainRule>
657 rule; /* Array of ChainRule tables
658 * ordered by preference */
660 DEFINE_SIZE_ARRAY (2, rule);
663 struct ChainContextFormat1
665 friend struct ChainContext;
668 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
671 unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
672 if (likely (index == NOT_COVERED))
675 const ChainRuleSet &rule_set = this+ruleSet[index];
676 struct ChainContextLookupContext lookup_context = {
677 {match_glyph, apply_func},
680 return rule_set.apply (c, lookup_context);
683 inline bool sanitize (hb_sanitize_context_t *c) {
685 return coverage.sanitize (c, this)
686 && ruleSet.sanitize (c, this);
690 USHORT format; /* Format identifier--format = 1 */
692 coverage; /* Offset to Coverage table--from
693 * beginning of table */
694 OffsetArrayOf<ChainRuleSet>
695 ruleSet; /* Array of ChainRuleSet tables
696 * ordered by Coverage Index */
698 DEFINE_SIZE_ARRAY (6, ruleSet);
701 struct ChainContextFormat2
703 friend struct ChainContext;
706 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
709 unsigned int index = (this+coverage) (c->buffer->info[c->buffer->i].codepoint);
710 if (likely (index == NOT_COVERED))
713 const ClassDef &backtrack_class_def = this+backtrackClassDef;
714 const ClassDef &input_class_def = this+inputClassDef;
715 const ClassDef &lookahead_class_def = this+lookaheadClassDef;
717 index = input_class_def (c->buffer->info[c->buffer->i].codepoint);
718 const ChainRuleSet &rule_set = this+ruleSet[index];
719 struct ChainContextLookupContext lookup_context = {
720 {match_class, apply_func},
721 {&backtrack_class_def,
723 &lookahead_class_def}
725 return rule_set.apply (c, lookup_context);
728 inline bool sanitize (hb_sanitize_context_t *c) {
730 return coverage.sanitize (c, this)
731 && backtrackClassDef.sanitize (c, this)
732 && inputClassDef.sanitize (c, this)
733 && lookaheadClassDef.sanitize (c, this)
734 && ruleSet.sanitize (c, this);
738 USHORT format; /* Format identifier--format = 2 */
740 coverage; /* Offset to Coverage table--from
741 * beginning of table */
743 backtrackClassDef; /* Offset to glyph ClassDef table
744 * containing backtrack sequence
745 * data--from beginning of table */
747 inputClassDef; /* Offset to glyph ClassDef
748 * table containing input sequence
749 * data--from beginning of table */
751 lookaheadClassDef; /* Offset to glyph ClassDef table
752 * containing lookahead sequence
753 * data--from beginning of table */
754 OffsetArrayOf<ChainRuleSet>
755 ruleSet; /* Array of ChainRuleSet tables
756 * ordered by class */
758 DEFINE_SIZE_ARRAY (12, ruleSet);
761 struct ChainContextFormat3
763 friend struct ChainContext;
767 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
770 const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
772 unsigned int index = (this+input[0]) (c->buffer->info[c->buffer->i].codepoint);
773 if (likely (index == NOT_COVERED))
776 const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (input);
777 const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
778 struct ChainContextLookupContext lookup_context = {
779 {match_coverage, apply_func},
782 return chain_context_lookup (c,
783 backtrack.len, (const USHORT *) backtrack.array,
784 input.len, (const USHORT *) input.array + 1,
785 lookahead.len, (const USHORT *) lookahead.array,
786 lookup.len, lookup.array,
790 inline bool sanitize (hb_sanitize_context_t *c) {
792 if (!backtrack.sanitize (c, this)) return false;
793 OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
794 if (!input.sanitize (c, this)) return false;
795 OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (input);
796 if (!lookahead.sanitize (c, this)) return false;
797 ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
798 return lookup.sanitize (c);
802 USHORT format; /* Format identifier--format = 3 */
803 OffsetArrayOf<Coverage>
804 backtrack; /* Array of coverage tables
805 * in backtracking sequence, in glyph
807 OffsetArrayOf<Coverage>
808 inputX ; /* Array of coverage
809 * tables in input sequence, in glyph
811 OffsetArrayOf<Coverage>
812 lookaheadX; /* Array of coverage tables
813 * in lookahead sequence, in glyph
815 ArrayOf<LookupRecord>
816 lookupX; /* Array of LookupRecords--in
819 DEFINE_SIZE_MIN (10);
825 inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
829 case 1: return u.format1.apply (c, apply_func);
830 case 2: return u.format2.apply (c, apply_func);
831 case 3: return u.format3.apply (c, apply_func);
832 default:return false;
836 inline bool sanitize (hb_sanitize_context_t *c) {
838 if (!u.format.sanitize (c)) return false;
840 case 1: return u.format1.sanitize (c);
841 case 2: return u.format2.sanitize (c);
842 case 3: return u.format3.sanitize (c);
849 USHORT format; /* Format identifier */
850 ChainContextFormat1 format1;
851 ChainContextFormat2 format2;
852 ChainContextFormat3 format3;
857 struct ExtensionFormat1
859 friend struct Extension;
862 inline unsigned int get_type (void) const { return extensionLookupType; }
863 inline unsigned int get_offset (void) const { return extensionOffset; }
865 inline bool sanitize (hb_sanitize_context_t *c) {
867 return c->check_struct (this);
871 USHORT format; /* Format identifier. Set to 1. */
872 USHORT extensionLookupType; /* Lookup type of subtable referenced
873 * by ExtensionOffset (i.e. the
874 * extension subtable). */
875 ULONG extensionOffset; /* Offset to the extension subtable,
876 * of lookup type subtable. */
878 DEFINE_SIZE_STATIC (8);
883 inline unsigned int get_type (void) const
886 case 1: return u.format1.get_type ();
890 inline unsigned int get_offset (void) const
893 case 1: return u.format1.get_offset ();
898 inline bool sanitize (hb_sanitize_context_t *c) {
900 if (!u.format.sanitize (c)) return false;
902 case 1: return u.format1.sanitize (c);
909 USHORT format; /* Format identifier */
910 ExtensionFormat1 format1;
921 static const hb_tag_t GSUBTag = HB_OT_TAG_GSUB;
922 static const hb_tag_t GPOSTag = HB_OT_TAG_GPOS;
924 inline unsigned int get_script_count (void) const
925 { return (this+scriptList).len; }
926 inline const Tag& get_script_tag (unsigned int i) const
927 { return (this+scriptList).get_tag (i); }
928 inline unsigned int get_script_tags (unsigned int start_offset,
929 unsigned int *script_count /* IN/OUT */,
930 hb_tag_t *script_tags /* OUT */) const
931 { return (this+scriptList).get_tags (start_offset, script_count, script_tags); }
932 inline const Script& get_script (unsigned int i) const
933 { return (this+scriptList)[i]; }
934 inline bool find_script_index (hb_tag_t tag, unsigned int *index) const
935 { return (this+scriptList).find_index (tag, index); }
937 inline unsigned int get_feature_count (void) const
938 { return (this+featureList).len; }
939 inline const Tag& get_feature_tag (unsigned int i) const
940 { return (this+featureList).get_tag (i); }
941 inline unsigned int get_feature_tags (unsigned int start_offset,
942 unsigned int *feature_count /* IN/OUT */,
943 hb_tag_t *feature_tags /* OUT */) const
944 { return (this+featureList).get_tags (start_offset, feature_count, feature_tags); }
945 inline const Feature& get_feature (unsigned int i) const
946 { return (this+featureList)[i]; }
947 inline bool find_feature_index (hb_tag_t tag, unsigned int *index) const
948 { return (this+featureList).find_index (tag, index); }
950 inline unsigned int get_lookup_count (void) const
951 { return (this+lookupList).len; }
952 inline const Lookup& get_lookup (unsigned int i) const
953 { return (this+lookupList)[i]; }
955 inline bool sanitize (hb_sanitize_context_t *c) {
957 return version.sanitize (c) && likely (version.major == 1)
958 && scriptList.sanitize (c, this)
959 && featureList.sanitize (c, this)
960 && lookupList.sanitize (c, this);
964 FixedVersion version; /* Version of the GSUB/GPOS table--initially set
967 scriptList; /* ScriptList table */
968 OffsetTo<FeatureList>
969 featureList; /* FeatureList table */
971 lookupList; /* LookupList table */
973 DEFINE_SIZE_STATIC (10);
979 #endif /* HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH */