2 * Copyright © 2018 Ebrahim Byagowi
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.
25 #ifndef HB_AAT_LAYOUT_FEAT_TABLE_HH
26 #define HB_AAT_LAYOUT_FEAT_TABLE_HH
28 #include "hb-aat-layout-common-private.hh"
31 * feat -- Feature Name
32 * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6feat.html
34 #define HB_AAT_TAG_feat HB_TAG('f','e','a','t')
42 inline bool sanitize (hb_sanitize_context_t *c) const
44 TRACE_SANITIZE (this);
45 return_trace (likely (c->check_struct (this)));
49 HBUINT16 setting; /* The setting. */
50 NameID nameIndex; /* The name table index for the setting's name. */
52 DEFINE_SIZE_STATIC (4);
57 inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
59 TRACE_SANITIZE (this);
60 return_trace (likely (c->check_struct (this) &&
61 (base+settingTable).sanitize (c, nSettings)));
65 Exclusive = 0x8000, /* If set, the feature settings are mutually exclusive. */
66 NotDefault = 0x4000, /* If clear, then the setting with an index of 0 in
67 * the setting name array for this feature should
68 * be taken as the default for the feature
69 * (if one is required). If set, then bits 0-15 of this
70 * featureFlags field contain the index of the setting
71 * which is to be taken as the default. */
72 IndexMask = 0x00FF /* If bits 30 and 31 are set, then these sixteen bits
73 * indicate the index of the setting in the setting name
74 * array for this feature which should be taken
79 HBUINT16 feature; /* Feature type. */
80 HBUINT16 nSettings; /* The number of records in the setting name array. */
81 LOffsetTo<UnsizedArrayOf<SettingName> >
82 settingTable; /* Offset in bytes from the beginning of this table to
83 * this feature's setting name array. The actual type of
84 * record this offset refers to will depend on the
85 * exclusivity value, as described below. */
86 HBUINT16 featureFlags; /* Single-bit flags associated with the feature type. */
87 HBINT16 nameIndex; /* The name table index for the feature's name.
88 * This index has values greater than 255 and
91 DEFINE_SIZE_STATIC (12);
96 static const hb_tag_t tableTag = HB_AAT_TAG_feat;
98 inline bool sanitize (hb_sanitize_context_t *c) const
100 TRACE_SANITIZE (this);
101 return_trace (likely (c->check_struct (this) &&
102 names.sanitize (c, featureNameCount, this)));
106 FixedVersion<>version; /* Version number of the feature name table
107 * (0x00010000 for the current version). */
108 HBUINT16 featureNameCount;
109 /* The number of entries in the feature name array. */
110 HBUINT16 reserved1; /* Reserved (set to zero). */
111 HBUINT32 reserved2; /* Reserved (set to zero). */
112 UnsizedArrayOf<FeatureName>
113 names; /* The feature name array. */
115 DEFINE_SIZE_STATIC (24);
118 } /* namespace AAT */
120 #endif /* HB_AAT_LAYOUT_FEAT_TABLE_HH */