2 * Copyright (C) 2007,2008,2009 Red Hat, Inc.
4 * This is part of HarfBuzz, an OpenType Layout engine 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.h"
31 #include "hb-ot-layout-gdef-private.hh"
34 #define APPLY_ARG_DEF \
35 hb_ot_layout_context_t *context, \
36 hb_buffer_t *buffer, \
37 unsigned int context_length HB_GNUC_UNUSED, \
38 unsigned int nesting_level_left HB_GNUC_UNUSED, \
39 unsigned int lookup_flag, \
40 unsigned int property HB_GNUC_UNUSED /* propety of first glyph */
50 typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, char *data);
51 typedef bool (*apply_lookup_func_t) (APPLY_ARG_DEF, unsigned int lookup_index);
56 apply_lookup_func_t apply;
60 static inline bool match_glyph (hb_codepoint_t glyph_id, const USHORT &value, char *data)
62 return glyph_id == value;
65 static inline bool match_class (hb_codepoint_t glyph_id, const USHORT &value, char *data)
67 const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
68 return class_def.get_class (glyph_id) == value;
71 static inline bool match_coverage (hb_codepoint_t glyph_id, const USHORT &value, char *data)
73 const OffsetTo<Coverage> &coverage = (const OffsetTo<Coverage>&)value;
74 return (data+coverage) (glyph_id) != NOT_COVERED;
78 static inline bool match_input (APPLY_ARG_DEF,
79 unsigned int count, /* Including the first glyph (not matched) */
80 const USHORT input[], /* Array of input values--start with second glyph */
81 match_func_t match_func,
83 unsigned int *context_length_out)
86 unsigned int end = MIN (buffer->in_length, buffer->in_pos + context_length);
87 if (HB_UNLIKELY (buffer->in_pos + count > end))
90 for (i = 1, j = buffer->in_pos + 1; i < count; i++, j++)
92 while (_hb_ot_layout_skip_mark (context->face, IN_INFO (j), lookup_flag, NULL))
94 if (HB_UNLIKELY (j + count - i == end))
99 if (HB_LIKELY (!match_func (IN_GLYPH (j), input[i - 1], match_data)))
103 *context_length_out = j - buffer->in_pos;
108 static inline bool match_backtrack (APPLY_ARG_DEF,
110 const USHORT backtrack[],
111 match_func_t match_func,
114 if (HB_UNLIKELY (buffer->out_pos < count))
117 for (unsigned int i = 0, j = buffer->out_pos - 1; i < count; i++, j--)
119 while (_hb_ot_layout_skip_mark (context->face, OUT_INFO (j), lookup_flag, NULL))
121 if (HB_UNLIKELY (j + 1 == count - i))
126 if (HB_LIKELY (!match_func (OUT_GLYPH (j), backtrack[i], match_data)))
133 static inline bool match_lookahead (APPLY_ARG_DEF,
135 const USHORT lookahead[],
136 match_func_t match_func,
141 unsigned int end = MIN (buffer->in_length, buffer->in_pos + context_length);
142 if (HB_UNLIKELY (buffer->in_pos + offset + count > end))
145 for (i = 0, j = buffer->in_pos + offset; i < count; i++, j++)
147 while (_hb_ot_layout_skip_mark (context->face, OUT_INFO (j), lookup_flag, NULL))
149 if (HB_UNLIKELY (j + count - i == end))
154 if (HB_LIKELY (!match_func (IN_GLYPH (j), lookahead[i], match_data)))
165 inline bool sanitize (SANITIZE_ARG_DEF) {
167 return SANITIZE_SELF ();
170 USHORT sequenceIndex; /* Index into current glyph
171 * sequence--first glyph = 0 */
172 USHORT lookupListIndex; /* Lookup to apply to that
173 * position--zero--based */
175 ASSERT_SIZE (LookupRecord, 4);
177 static inline bool apply_lookup (APPLY_ARG_DEF,
178 unsigned int count, /* Including the first glyph */
179 unsigned int lookupCount,
180 const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
181 apply_lookup_func_t apply_func)
183 unsigned int end = MIN (buffer->in_length, buffer->in_pos + context_length);
184 if (HB_UNLIKELY (buffer->in_pos + count > end))
187 /* TODO We don't support lookupRecord arrays that are not increasing:
188 * Should be easy for in_place ones at least. */
189 for (unsigned int i = 0; i < count; i++)
191 while (_hb_ot_layout_skip_mark (context->face, IN_CURINFO (), lookup_flag, NULL))
193 if (HB_UNLIKELY (buffer->in_pos == end))
195 /* No lookup applied for this index */
196 _hb_buffer_next_glyph (buffer);
199 if (lookupCount && i == lookupRecord->sequenceIndex)
201 unsigned int old_pos = buffer->in_pos;
204 bool done = apply_func (APPLY_ARG, lookupRecord->lookupListIndex);
208 i += buffer->in_pos - old_pos;
209 if (HB_UNLIKELY (buffer->in_pos == end))
218 /* No lookup applied for this index */
219 _hb_buffer_next_glyph (buffer);
228 /* Contextual lookups */
230 struct ContextLookupContext
236 static inline bool context_lookup (APPLY_ARG_DEF,
237 unsigned int inputCount, /* Including the first glyph (not matched) */
238 const USHORT input[], /* Array of input values--start with second glyph */
239 unsigned int lookupCount,
240 const LookupRecord lookupRecord[],
241 ContextLookupContext &lookup_context)
243 return match_input (APPLY_ARG,
245 lookup_context.funcs.match, lookup_context.match_data,
247 apply_lookup (APPLY_ARG,
249 lookupCount, lookupRecord,
250 lookup_context.funcs.apply);
255 friend struct RuleSet;
258 inline bool apply (APPLY_ARG_DEF, ContextLookupContext &lookup_context) const
260 const LookupRecord *lookupRecord = &CONST_CAST (LookupRecord, input, sizeof (input[0]) * (inputCount ? inputCount - 1 : 0));
261 return context_lookup (APPLY_ARG,
263 lookupCount, lookupRecord,
268 inline bool sanitize (SANITIZE_ARG_DEF) {
270 if (!SANITIZE_SELF ()) return false;
271 return SANITIZE_MEM (input,
272 sizeof (input[0]) * inputCount +
273 sizeof (lookupRecordX[0]) * lookupCount);
277 USHORT inputCount; /* Total number of glyphs in input
278 * glyph sequence--includes the first
280 USHORT lookupCount; /* Number of LookupRecords */
281 USHORT input[]; /* Array of match inputs--start with
283 LookupRecord lookupRecordX[]; /* Array of LookupRecords--in
286 ASSERT_SIZE (Rule, 4);
290 inline bool apply (APPLY_ARG_DEF, ContextLookupContext &lookup_context) const
292 unsigned int num_rules = rule.len;
293 for (unsigned int i = 0; i < num_rules; i++)
295 if ((this+rule[i]).apply (APPLY_ARG, lookup_context))
302 inline bool sanitize (SANITIZE_ARG_DEF) {
304 return SANITIZE_THIS (rule);
309 rule; /* Array of Rule tables
310 * ordered by preference */
314 struct ContextFormat1
316 friend struct Context;
319 inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const
321 unsigned int index = (this+coverage) (IN_CURGLYPH ());
322 if (HB_LIKELY (index == NOT_COVERED))
325 const RuleSet &rule_set = this+ruleSet[index];
326 struct ContextLookupContext lookup_context = {
327 {match_glyph, apply_func},
330 return rule_set.apply (APPLY_ARG, lookup_context);
333 inline bool sanitize (SANITIZE_ARG_DEF) {
335 return SANITIZE_THIS2 (coverage, ruleSet);
339 USHORT format; /* Format identifier--format = 1 */
341 coverage; /* Offset to Coverage table--from
342 * beginning of table */
343 OffsetArrayOf<RuleSet>
344 ruleSet; /* Array of RuleSet tables
345 * ordered by Coverage Index */
347 ASSERT_SIZE (ContextFormat1, 6);
350 struct ContextFormat2
352 friend struct Context;
355 inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const
357 unsigned int index = (this+coverage) (IN_CURGLYPH ());
358 if (HB_LIKELY (index == NOT_COVERED))
361 const ClassDef &class_def = this+classDef;
362 index = class_def (IN_CURGLYPH ());
363 const RuleSet &rule_set = this+ruleSet[index];
364 /* LONGTERMTODO: Old code fetches glyph classes at most once and caches
365 * them across subrule lookups. Not sure it's worth it.
367 struct ContextLookupContext lookup_context = {
368 {match_class, apply_func},
369 DECONST_CHARP(&class_def)
371 return rule_set.apply (APPLY_ARG, lookup_context);
374 inline bool sanitize (SANITIZE_ARG_DEF) {
376 return SANITIZE_THIS3 (coverage, classDef, ruleSet);
380 USHORT format; /* Format identifier--format = 2 */
382 coverage; /* Offset to Coverage table--from
383 * beginning of table */
385 classDef; /* Offset to glyph ClassDef table--from
386 * beginning of table */
387 OffsetArrayOf<RuleSet>
388 ruleSet; /* Array of RuleSet tables
389 * ordered by class */
391 ASSERT_SIZE (ContextFormat2, 8);
394 struct ContextFormat3
396 friend struct Context;
399 inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const
401 unsigned int index = (this+coverage[0]) (IN_CURGLYPH ());
402 if (HB_LIKELY (index == NOT_COVERED))
405 const LookupRecord *lookupRecord = &CONST_CAST(LookupRecord, coverage, sizeof (coverage[0]) * glyphCount);
406 struct ContextLookupContext lookup_context = {
407 {match_coverage, apply_func},
410 return context_lookup (APPLY_ARG,
411 glyphCount, (const USHORT *) (coverage + 1),
412 lookupCount, lookupRecord,
416 inline bool sanitize (SANITIZE_ARG_DEF) {
418 if (!SANITIZE_SELF ()) return false;
419 unsigned int count = glyphCount;
420 for (unsigned int i = 0; i < count; i++)
421 if (!SANITIZE_THIS (coverage[i])) return false;
422 LookupRecord *lookupRecord = &CAST(LookupRecord, coverage, sizeof (coverage[0]) * glyphCount);
423 return SANITIZE_MEM (lookupRecord, sizeof (lookupRecord[0]) * lookupCount);
427 USHORT format; /* Format identifier--format = 3 */
428 USHORT glyphCount; /* Number of glyphs in the input glyph
430 USHORT lookupCount; /* Number of LookupRecords */
432 coverage[]; /* Array of offsets to Coverage
433 * table in glyph sequence order */
434 LookupRecord lookupRecordX[]; /* Array of LookupRecords--in
437 ASSERT_SIZE (ContextFormat3, 6);
442 inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const
445 case 1: return u.format1->apply (APPLY_ARG, apply_func);
446 case 2: return u.format2->apply (APPLY_ARG, apply_func);
447 case 3: return u.format3->apply (APPLY_ARG, apply_func);
448 default:return false;
452 inline bool sanitize (SANITIZE_ARG_DEF) {
454 if (!SANITIZE (u.format)) return false;
456 case 1: return u.format1->sanitize (SANITIZE_ARG);
457 case 2: return u.format2->sanitize (SANITIZE_ARG);
458 case 3: return u.format3->sanitize (SANITIZE_ARG);
465 USHORT format; /* Format identifier */
466 ContextFormat1 format1[];
467 ContextFormat2 format2[];
468 ContextFormat3 format3[];
471 ASSERT_SIZE (Context, 2);
474 /* Chaining Contextual lookups */
476 struct ChainContextLookupContext
482 static inline bool chain_context_lookup (APPLY_ARG_DEF,
483 unsigned int backtrackCount,
484 const USHORT backtrack[],
485 unsigned int inputCount, /* Including the first glyph (not matched) */
486 const USHORT input[], /* Array of input values--start with second glyph */
487 unsigned int lookaheadCount,
488 const USHORT lookahead[],
489 unsigned int lookupCount,
490 const LookupRecord lookupRecord[],
491 ChainContextLookupContext &lookup_context)
494 if (HB_UNLIKELY (buffer->out_pos < backtrackCount ||
495 buffer->in_pos + inputCount + lookaheadCount > buffer->in_length ||
496 inputCount + lookaheadCount > context_length))
500 return match_backtrack (APPLY_ARG,
501 backtrackCount, backtrack,
502 lookup_context.funcs.match, lookup_context.match_data[0]) &&
503 match_input (APPLY_ARG,
505 lookup_context.funcs.match, lookup_context.match_data[1],
507 match_lookahead (APPLY_ARG,
508 lookaheadCount, lookahead,
509 lookup_context.funcs.match, lookup_context.match_data[2],
511 (context_length = offset, true) &&
512 apply_lookup (APPLY_ARG,
514 lookupCount, lookupRecord,
515 lookup_context.funcs.apply);
520 friend struct ChainRuleSet;
523 inline bool apply (APPLY_ARG_DEF, ChainContextLookupContext &lookup_context) const
525 const HeadlessArrayOf<USHORT> &input = CONST_NEXT (HeadlessArrayOf<USHORT>, backtrack);
526 const ArrayOf<USHORT> &lookahead = CONST_NEXT (ArrayOf<USHORT>, input);
527 const ArrayOf<LookupRecord> &lookup = CONST_NEXT (ArrayOf<LookupRecord>, lookahead);
528 return chain_context_lookup (APPLY_ARG,
529 backtrack.len, backtrack.array,
530 input.len, input.array + 1,
531 lookahead.len, lookahead.array,
532 lookup.len, lookup.array,
538 inline bool sanitize (SANITIZE_ARG_DEF) {
540 if (!SANITIZE (backtrack)) return false;
541 HeadlessArrayOf<USHORT> &input = NEXT (HeadlessArrayOf<USHORT>, backtrack);
542 if (!SANITIZE (input)) return false;
543 ArrayOf<USHORT> &lookahead = NEXT (ArrayOf<USHORT>, input);
544 if (!SANITIZE (lookahead)) return false;
545 ArrayOf<LookupRecord> &lookup = NEXT (ArrayOf<LookupRecord>, lookahead);
546 return SANITIZE (lookup);
551 backtrack; /* Array of backtracking values
552 * (to be matched before the input
554 HeadlessArrayOf<USHORT>
555 inputX; /* Array of input values (start with
558 lookaheadX; /* Array of lookahead values's (to be
559 * matched after the input sequence) */
560 ArrayOf<LookupRecord>
561 lookupX; /* Array of LookupRecords--in
564 ASSERT_SIZE (ChainRule, 8);
568 inline bool apply (APPLY_ARG_DEF, ChainContextLookupContext &lookup_context) const
570 unsigned int num_rules = rule.len;
571 for (unsigned int i = 0; i < num_rules; i++)
573 if ((this+rule[i]).apply (APPLY_ARG, lookup_context))
580 inline bool sanitize (SANITIZE_ARG_DEF) {
582 return SANITIZE_THIS (rule);
586 OffsetArrayOf<ChainRule>
587 rule; /* Array of ChainRule tables
588 * ordered by preference */
590 ASSERT_SIZE (ChainRuleSet, 2);
592 struct ChainContextFormat1
594 friend struct ChainContext;
597 inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const
599 unsigned int index = (this+coverage) (IN_CURGLYPH ());
600 if (HB_LIKELY (index == NOT_COVERED))
603 const ChainRuleSet &rule_set = this+ruleSet[index];
604 struct ChainContextLookupContext lookup_context = {
605 {match_glyph, apply_func},
608 return rule_set.apply (APPLY_ARG, lookup_context);
611 inline bool sanitize (SANITIZE_ARG_DEF) {
613 return SANITIZE_THIS2 (coverage, ruleSet);
617 USHORT format; /* Format identifier--format = 1 */
619 coverage; /* Offset to Coverage table--from
620 * beginning of table */
621 OffsetArrayOf<ChainRuleSet>
622 ruleSet; /* Array of ChainRuleSet tables
623 * ordered by Coverage Index */
625 ASSERT_SIZE (ChainContextFormat1, 6);
627 struct ChainContextFormat2
629 friend struct ChainContext;
632 inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const
634 unsigned int index = (this+coverage) (IN_CURGLYPH ());
635 if (HB_LIKELY (index == NOT_COVERED))
638 const ClassDef &backtrack_class_def = this+backtrackClassDef;
639 const ClassDef &input_class_def = this+inputClassDef;
640 const ClassDef &lookahead_class_def = this+lookaheadClassDef;
642 index = input_class_def (IN_CURGLYPH ());
643 const ChainRuleSet &rule_set = this+ruleSet[index];
644 /* LONGTERMTODO: Old code fetches glyph classes at most once and caches
645 * them across subrule lookups. Not sure it's worth it.
647 struct ChainContextLookupContext lookup_context = {
648 {match_class, apply_func},
649 {DECONST_CHARP(&backtrack_class_def),
650 DECONST_CHARP(&input_class_def),
651 DECONST_CHARP(&lookahead_class_def)}
653 return rule_set.apply (APPLY_ARG, lookup_context);
656 inline bool sanitize (SANITIZE_ARG_DEF) {
658 return SANITIZE_THIS2 (coverage, backtrackClassDef) &&
659 SANITIZE_THIS2 (inputClassDef, lookaheadClassDef) &&
660 SANITIZE_THIS (ruleSet);
664 USHORT format; /* Format identifier--format = 2 */
666 coverage; /* Offset to Coverage table--from
667 * beginning of table */
669 backtrackClassDef; /* Offset to glyph ClassDef table
670 * containing backtrack sequence
671 * data--from beginning of table */
673 inputClassDef; /* Offset to glyph ClassDef
674 * table containing input sequence
675 * data--from beginning of table */
677 lookaheadClassDef; /* Offset to glyph ClassDef table
678 * containing lookahead sequence
679 * data--from beginning of table */
680 OffsetArrayOf<ChainRuleSet>
681 ruleSet; /* Array of ChainRuleSet tables
682 * ordered by class */
684 ASSERT_SIZE (ChainContextFormat2, 12);
686 struct ChainContextFormat3
688 friend struct ChainContext;
692 inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const
694 const OffsetArrayOf<Coverage> &input = CONST_NEXT (OffsetArrayOf<Coverage>, backtrack);
696 unsigned int index = (this+input[0]) (IN_CURGLYPH ());
697 if (HB_LIKELY (index == NOT_COVERED))
700 const OffsetArrayOf<Coverage> &lookahead = CONST_NEXT (OffsetArrayOf<Coverage>, input);
701 const ArrayOf<LookupRecord> &lookup = CONST_NEXT (ArrayOf<LookupRecord>, lookahead);
702 struct ChainContextLookupContext lookup_context = {
703 {match_coverage, apply_func},
704 {DECONST_CHARP(this), DECONST_CHARP(this), DECONST_CHARP(this)}
706 return chain_context_lookup (APPLY_ARG,
707 backtrack.len, (USHORT *) backtrack.array,
708 input.len, (USHORT *) input.array,
709 lookahead.len, (USHORT *) lookahead.array,
710 lookup.len, lookup.array,
715 inline bool sanitize (SANITIZE_ARG_DEF) {
717 if (!SANITIZE_THIS (backtrack)) return false;
718 OffsetArrayOf<Coverage> &input = NEXT (OffsetArrayOf<Coverage>, backtrack);
719 if (!SANITIZE_THIS (input)) return false;
720 OffsetArrayOf<Coverage> &lookahead = NEXT (OffsetArrayOf<Coverage>, input);
721 if (!SANITIZE_THIS (lookahead)) return false;
722 ArrayOf<LookupRecord> &lookup = NEXT (ArrayOf<LookupRecord>, lookahead);
723 return SANITIZE (lookup);
727 USHORT format; /* Format identifier--format = 3 */
728 OffsetArrayOf<Coverage>
729 backtrack; /* Array of coverage tables
730 * in backtracking sequence, in glyph
732 OffsetArrayOf<Coverage>
733 inputX ; /* Array of coverage
734 * tables in input sequence, in glyph
736 OffsetArrayOf<Coverage>
737 lookaheadX; /* Array of coverage tables
738 * in lookahead sequence, in glyph
740 ArrayOf<LookupRecord>
741 lookupX; /* Array of LookupRecords--in
744 ASSERT_SIZE (ChainContextFormat3, 10);
749 inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const
752 case 1: return u.format1->apply (APPLY_ARG, apply_func);
753 case 2: return u.format2->apply (APPLY_ARG, apply_func);
754 case 3: return u.format3->apply (APPLY_ARG, apply_func);
755 default:return false;
759 inline bool sanitize (SANITIZE_ARG_DEF) {
761 if (!SANITIZE (u.format)) return false;
763 case 1: return u.format1->sanitize (SANITIZE_ARG);
764 case 2: return u.format2->sanitize (SANITIZE_ARG);
765 case 3: return u.format3->sanitize (SANITIZE_ARG);
772 USHORT format; /* Format identifier */
773 ChainContextFormat1 format1[];
774 ChainContextFormat2 format2[];
775 ChainContextFormat3 format3[];
778 ASSERT_SIZE (ChainContext, 2);
781 struct ExtensionFormat1
783 friend struct Extension;
786 inline unsigned int get_type (void) const { return extensionLookupType; }
787 inline unsigned int get_offset (void) const { return (extensionOffset[0] << 16) + extensionOffset[1]; }
788 inline const LookupSubTable& get_subtable (void) const
790 unsigned int offset = get_offset ();
791 if (HB_UNLIKELY (!offset)) return Null(LookupSubTable);
792 return CONST_CAST (LookupSubTable, *this, offset);
795 inline bool sanitize (SANITIZE_ARG_DEF) {
797 return SANITIZE_SELF ();
801 USHORT format; /* Format identifier. Set to 1. */
802 USHORT extensionLookupType; /* Lookup type of subtable referenced
803 * by ExtensionOffset (i.e. the
804 * extension subtable). */
805 USHORT extensionOffset[2]; /* Offset to the extension subtable,
806 * of lookup type subtable.
807 * Defined as two shorts to avoid
808 * alignment requirements. */
810 ASSERT_SIZE (ExtensionFormat1, 8);
814 inline unsigned int get_type (void) const
817 case 1: return u.format1->get_type ();
821 inline const LookupSubTable& get_subtable (void) const
824 case 1: return u.format1->get_subtable ();
825 default:return Null(LookupSubTable);
829 inline bool sanitize (SANITIZE_ARG_DEF) {
831 if (!SANITIZE (u.format)) return false;
833 case 1: return u.format1->sanitize (SANITIZE_ARG);
840 USHORT format; /* Format identifier */
841 ExtensionFormat1 format1[];
844 ASSERT_SIZE (Extension, 2);
853 static const hb_tag_t GSUBTag = HB_OT_TAG_GSUB;
854 static const hb_tag_t GPOSTag = HB_OT_TAG_GPOS;
856 STATIC_DEFINE_GET_FOR_DATA_CHECK_MAJOR_VERSION (GSUBGPOS, 1, 1);
858 inline unsigned int get_script_count (void) const
859 { return (this+scriptList).len; }
860 inline const Tag& get_script_tag (unsigned int i) const
861 { return (this+scriptList).get_tag (i); }
862 inline bool get_script_tags (unsigned int *script_count /* IN/OUT */,
863 hb_tag_t *script_tags /* OUT */) const
864 { return (this+scriptList).get_tags (script_count, script_tags); }
865 inline const Script& get_script (unsigned int i) const
866 { return (this+scriptList)[i]; }
867 inline bool find_script_index (hb_tag_t tag, unsigned int *index) const
868 { return (this+scriptList).find_index (tag, index); }
870 inline unsigned int get_feature_count (void) const
871 { return (this+featureList).len; }
872 inline const Tag& get_feature_tag (unsigned int i) const
873 { return (this+featureList).get_tag (i); }
874 inline bool get_feature_tags (unsigned int *feature_count /* IN/OUT */,
875 hb_tag_t *feature_tags /* OUT */) const
876 { return (this+featureList).get_tags (feature_count, feature_tags); }
877 inline const Feature& get_feature (unsigned int i) const
878 { return (this+featureList)[i]; }
879 inline bool find_feature_index (hb_tag_t tag, unsigned int *index) const
880 { return (this+featureList).find_index (tag, index); }
882 inline unsigned int get_lookup_count (void) const
883 { return (this+lookupList).len; }
884 inline const Lookup& get_lookup (unsigned int i) const
885 { return (this+lookupList)[i]; }
887 inline bool sanitize (SANITIZE_ARG_DEF) {
889 if (!SANITIZE (version)) return false;
890 if (version.major != 1) return true;
891 return SANITIZE_THIS3 (scriptList, featureList, lookupList);
895 FixedVersion version; /* Version of the GSUB/GPOS table--initially set
898 scriptList; /* ScriptList table */
899 OffsetTo<FeatureList>
900 featureList; /* FeatureList table */
902 lookupList; /* LookupList table */
904 ASSERT_SIZE (GSUBGPOS, 10);
907 #endif /* HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH */