[feat] Rename API uses of setting to selector
This commit is contained in:
parent
9c64b216ec
commit
54f4c17f0a
|
@ -6,9 +6,9 @@ HB_OT_H_IN
|
|||
<SECTION>
|
||||
<FILE>hb-aat</FILE>
|
||||
hb_aat_layout_feature_get_name_id
|
||||
hb_aat_layout_feature_get_settings
|
||||
hb_aat_layout_feature_setting_get_name_id
|
||||
hb_aat_layout_feature_setting_t
|
||||
hb_aat_layout_feature_get_selectors
|
||||
hb_aat_layout_feature_selector_get_name_id
|
||||
hb_aat_layout_feature_selector_t
|
||||
hb_aat_layout_feature_type_t
|
||||
hb_aat_layout_get_features
|
||||
</SECTION>
|
||||
|
|
|
@ -41,15 +41,15 @@ struct SettingName
|
|||
{
|
||||
static int cmp (const void *key_, const void *entry_)
|
||||
{
|
||||
hb_aat_layout_feature_setting_t key = * (hb_aat_layout_feature_setting_t *) key_;
|
||||
hb_aat_layout_feature_selector_t key = * (hb_aat_layout_feature_selector_t *) key_;
|
||||
const SettingName * entry = (const SettingName *) entry_;
|
||||
return key < entry->setting ? -1 :
|
||||
key > entry->setting ? +1 :
|
||||
0;
|
||||
}
|
||||
|
||||
inline hb_aat_layout_feature_setting_t get_setting () const
|
||||
{ return (hb_aat_layout_feature_setting_t) (unsigned int) setting; }
|
||||
inline hb_aat_layout_feature_selector_t get_selector () const
|
||||
{ return (hb_aat_layout_feature_selector_t) (unsigned int) setting; }
|
||||
|
||||
inline hb_ot_name_id_t get_name_id () const { return nameIndex; }
|
||||
|
||||
|
@ -72,7 +72,7 @@ struct FeatureName
|
|||
{
|
||||
static int cmp (const void *key_, const void *entry_)
|
||||
{
|
||||
hb_aat_layout_feature_setting_t key = * (hb_aat_layout_feature_setting_t *) key_;
|
||||
hb_aat_layout_feature_selector_t key = * (hb_aat_layout_feature_selector_t *) key_;
|
||||
const FeatureName * entry = (const FeatureName *) entry_;
|
||||
return key < entry->feature ? -1 :
|
||||
key > entry->feature ? +1 :
|
||||
|
@ -93,11 +93,11 @@ struct FeatureName
|
|||
* as the default. */
|
||||
};
|
||||
|
||||
inline unsigned int get_settings (const feat *feat,
|
||||
hb_aat_layout_feature_setting_t *default_setting,
|
||||
inline unsigned int get_selectors (const feat *feat,
|
||||
hb_aat_layout_feature_selector_t *default_selector,
|
||||
unsigned int start_offset,
|
||||
unsigned int *count,
|
||||
hb_aat_layout_feature_setting_t *settings) const
|
||||
hb_aat_layout_feature_selector_t *selectors) const
|
||||
{
|
||||
const UnsizedArrayOf<SettingName>& settings_table = feat+settingTableZ;
|
||||
unsigned int settings_count = nSettings;
|
||||
|
@ -105,14 +105,14 @@ struct FeatureName
|
|||
{
|
||||
unsigned int len = MIN (settings_count - start_offset, *count);
|
||||
for (unsigned int i = 0; i < len; i++)
|
||||
settings[i] = settings_table[start_offset + i].get_setting ();
|
||||
selectors[i] = settings_table[start_offset + i].get_selector ();
|
||||
*count = len;
|
||||
}
|
||||
if (default_setting)
|
||||
if (default_selector)
|
||||
{
|
||||
unsigned int index = (featureFlags & NotDefault) ? featureFlags & IndexMask : 0;
|
||||
*default_setting = ((featureFlags & Exclusive) && index < settings_count)
|
||||
? settings_table[index].get_setting ()
|
||||
*default_selector = ((featureFlags & Exclusive) && index < settings_count)
|
||||
? settings_table[index].get_selector ()
|
||||
: HB_AAT_LAYOUT_SELECTOR_INVALID;
|
||||
}
|
||||
return settings_count;
|
||||
|
@ -123,8 +123,8 @@ struct FeatureName
|
|||
|
||||
inline hb_ot_name_id_t get_feature_name_id () const { return nameIndex; }
|
||||
|
||||
inline hb_ot_name_id_t get_feature_setting_name_id (const feat *feat,
|
||||
hb_aat_layout_feature_setting_t key) const
|
||||
inline hb_ot_name_id_t get_feature_selector_name_id (const feat *feat,
|
||||
hb_aat_layout_feature_selector_t key) const
|
||||
{
|
||||
const SettingName* setting = (SettingName*) hb_bsearch (&key, feat+settingTableZ,
|
||||
nSettings,
|
||||
|
@ -189,18 +189,18 @@ struct feat
|
|||
inline hb_ot_name_id_t get_feature_name_id (hb_aat_layout_feature_type_t feature) const
|
||||
{ return get_feature (feature).get_feature_name_id (); }
|
||||
|
||||
inline hb_ot_name_id_t get_feature_setting_name_id (hb_aat_layout_feature_type_t feature,
|
||||
hb_aat_layout_feature_setting_t setting) const
|
||||
{ return get_feature (feature).get_feature_setting_name_id (this, setting); }
|
||||
inline hb_ot_name_id_t get_feature_selector_name_id (hb_aat_layout_feature_type_t feature,
|
||||
hb_aat_layout_feature_selector_t selector) const
|
||||
{ return get_feature (feature).get_feature_selector_name_id (this, selector); }
|
||||
|
||||
inline unsigned int get_settings (hb_aat_layout_feature_type_t key,
|
||||
hb_aat_layout_feature_setting_t *default_setting,
|
||||
inline unsigned int get_selectors (hb_aat_layout_feature_type_t key,
|
||||
hb_aat_layout_feature_selector_t *default_selector,
|
||||
unsigned int start_offset,
|
||||
unsigned int *count,
|
||||
hb_aat_layout_feature_setting_t *settings) const
|
||||
hb_aat_layout_feature_selector_t *selectors) const
|
||||
{
|
||||
return get_feature (key).get_settings (this, default_setting, start_offset,
|
||||
count, settings);
|
||||
return get_feature (key).get_selectors (this, default_selector, start_offset,
|
||||
count, selectors);
|
||||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||
|
|
|
@ -959,7 +959,7 @@ struct Chain
|
|||
{
|
||||
const Feature &feature = featureZ[i];
|
||||
hb_aat_layout_feature_type_t type = (hb_aat_layout_feature_type_t) (unsigned int) feature.featureType;
|
||||
hb_aat_layout_feature_setting_t setting = (hb_aat_layout_feature_setting_t) (unsigned int) feature.featureSetting;
|
||||
hb_aat_layout_feature_selector_t setting = (hb_aat_layout_feature_selector_t) (unsigned int) feature.featureSetting;
|
||||
retry:
|
||||
const hb_aat_map_builder_t::feature_info_t *info = map->features.bsearch ((uint16_t) type);
|
||||
if (info && info->setting == setting)
|
||||
|
|
|
@ -53,37 +53,37 @@ static const hb_aat_feature_mapping_t feature_mappings[] =
|
|||
{HB_TAG ('c','p','s','p'), HB_AAT_LAYOUT_FEATURE_TYPE_CASE_SENSITIVE_LAYOUT, HB_AAT_LAYOUT_SELECTOR_CASE_SENSITIVE_SPACING_ON, HB_AAT_LAYOUT_SELECTOR_CASE_SENSITIVE_SPACING_OFF},
|
||||
{HB_TAG ('c','s','w','h'), HB_AAT_LAYOUT_FEATURE_TYPE_CONTEXTUAL_ALTERNATIVES, HB_AAT_LAYOUT_SELECTOR_CONTEXTUAL_SWASH_ALTERNATES_ON, HB_AAT_LAYOUT_SELECTOR_CONTEXTUAL_SWASH_ALTERNATES_OFF},
|
||||
{HB_TAG ('d','l','i','g'), HB_AAT_LAYOUT_FEATURE_TYPE_LIGATURES, HB_AAT_LAYOUT_SELECTOR_RARE_LIGATURES_ON, HB_AAT_LAYOUT_SELECTOR_RARE_LIGATURES_OFF},
|
||||
{HB_TAG ('e','x','p','t'), HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE, HB_AAT_LAYOUT_SELECTOR_EXPERT_CHARACTERS, (hb_aat_layout_feature_setting_t) 16},
|
||||
{HB_TAG ('e','x','p','t'), HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE, HB_AAT_LAYOUT_SELECTOR_EXPERT_CHARACTERS, (hb_aat_layout_feature_selector_t) 16},
|
||||
{HB_TAG ('f','r','a','c'), HB_AAT_LAYOUT_FEATURE_TYPE_FRACTIONS, HB_AAT_LAYOUT_SELECTOR_DIAGONAL_FRACTIONS, HB_AAT_LAYOUT_SELECTOR_NO_FRACTIONS},
|
||||
{HB_TAG ('f','w','i','d'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_MONOSPACED_TEXT, (hb_aat_layout_feature_setting_t) 7},
|
||||
{HB_TAG ('h','a','l','t'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_ALT_HALF_WIDTH_TEXT, (hb_aat_layout_feature_setting_t) 7},
|
||||
{HB_TAG ('f','w','i','d'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_MONOSPACED_TEXT, (hb_aat_layout_feature_selector_t) 7},
|
||||
{HB_TAG ('h','a','l','t'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_ALT_HALF_WIDTH_TEXT, (hb_aat_layout_feature_selector_t) 7},
|
||||
{HB_TAG ('h','i','s','t'), HB_AAT_LAYOUT_FEATURE_TYPE_LIGATURES, HB_AAT_LAYOUT_SELECTOR_HISTORICAL_LIGATURES_ON, HB_AAT_LAYOUT_SELECTOR_HISTORICAL_LIGATURES_OFF},
|
||||
{HB_TAG ('h','k','n','a'), HB_AAT_LAYOUT_FEATURE_TYPE_ALTERNATE_KANA, HB_AAT_LAYOUT_SELECTOR_ALTERNATE_HORIZ_KANA_ON, HB_AAT_LAYOUT_SELECTOR_ALTERNATE_HORIZ_KANA_OFF},
|
||||
{HB_TAG ('h','l','i','g'), HB_AAT_LAYOUT_FEATURE_TYPE_LIGATURES, HB_AAT_LAYOUT_SELECTOR_HISTORICAL_LIGATURES_ON, HB_AAT_LAYOUT_SELECTOR_HISTORICAL_LIGATURES_OFF},
|
||||
{HB_TAG ('h','n','g','l'), HB_AAT_LAYOUT_FEATURE_TYPE_TRANSLITERATION, HB_AAT_LAYOUT_SELECTOR_HANJA_TO_HANGUL, HB_AAT_LAYOUT_SELECTOR_NO_TRANSLITERATION},
|
||||
{HB_TAG ('h','o','j','o'), HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE, HB_AAT_LAYOUT_SELECTOR_HOJO_CHARACTERS, (hb_aat_layout_feature_setting_t) 16},
|
||||
{HB_TAG ('h','w','i','d'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_HALF_WIDTH_TEXT, (hb_aat_layout_feature_setting_t) 7},
|
||||
{HB_TAG ('h','o','j','o'), HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE, HB_AAT_LAYOUT_SELECTOR_HOJO_CHARACTERS, (hb_aat_layout_feature_selector_t) 16},
|
||||
{HB_TAG ('h','w','i','d'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_HALF_WIDTH_TEXT, (hb_aat_layout_feature_selector_t) 7},
|
||||
{HB_TAG ('i','t','a','l'), HB_AAT_LAYOUT_FEATURE_TYPE_ITALIC_CJK_ROMAN, HB_AAT_LAYOUT_SELECTOR_CJK_ITALIC_ROMAN_ON, HB_AAT_LAYOUT_SELECTOR_CJK_ITALIC_ROMAN_OFF},
|
||||
{HB_TAG ('j','p','0','4'), HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE, HB_AAT_LAYOUT_SELECTOR_JIS2004_CHARACTERS, (hb_aat_layout_feature_setting_t) 16},
|
||||
{HB_TAG ('j','p','7','8'), HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE, HB_AAT_LAYOUT_SELECTOR_JIS1978_CHARACTERS, (hb_aat_layout_feature_setting_t) 16},
|
||||
{HB_TAG ('j','p','8','3'), HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE, HB_AAT_LAYOUT_SELECTOR_JIS1983_CHARACTERS, (hb_aat_layout_feature_setting_t) 16},
|
||||
{HB_TAG ('j','p','9','0'), HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE, HB_AAT_LAYOUT_SELECTOR_JIS1990_CHARACTERS, (hb_aat_layout_feature_setting_t) 16},
|
||||
{HB_TAG ('j','p','0','4'), HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE, HB_AAT_LAYOUT_SELECTOR_JIS2004_CHARACTERS, (hb_aat_layout_feature_selector_t) 16},
|
||||
{HB_TAG ('j','p','7','8'), HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE, HB_AAT_LAYOUT_SELECTOR_JIS1978_CHARACTERS, (hb_aat_layout_feature_selector_t) 16},
|
||||
{HB_TAG ('j','p','8','3'), HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE, HB_AAT_LAYOUT_SELECTOR_JIS1983_CHARACTERS, (hb_aat_layout_feature_selector_t) 16},
|
||||
{HB_TAG ('j','p','9','0'), HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE, HB_AAT_LAYOUT_SELECTOR_JIS1990_CHARACTERS, (hb_aat_layout_feature_selector_t) 16},
|
||||
{HB_TAG ('l','i','g','a'), HB_AAT_LAYOUT_FEATURE_TYPE_LIGATURES, HB_AAT_LAYOUT_SELECTOR_COMMON_LIGATURES_ON, HB_AAT_LAYOUT_SELECTOR_COMMON_LIGATURES_OFF},
|
||||
{HB_TAG ('l','n','u','m'), HB_AAT_LAYOUT_FEATURE_TYPE_NUMBER_CASE, HB_AAT_LAYOUT_SELECTOR_UPPER_CASE_NUMBERS, (hb_aat_layout_feature_setting_t) 2},
|
||||
{HB_TAG ('l','n','u','m'), HB_AAT_LAYOUT_FEATURE_TYPE_NUMBER_CASE, HB_AAT_LAYOUT_SELECTOR_UPPER_CASE_NUMBERS, (hb_aat_layout_feature_selector_t) 2},
|
||||
{HB_TAG ('m','g','r','k'), HB_AAT_LAYOUT_FEATURE_TYPE_MATHEMATICAL_EXTRAS, HB_AAT_LAYOUT_SELECTOR_MATHEMATICAL_GREEK_ON, HB_AAT_LAYOUT_SELECTOR_MATHEMATICAL_GREEK_OFF},
|
||||
{HB_TAG ('n','l','c','k'), HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE, HB_AAT_LAYOUT_SELECTOR_NLCCHARACTERS, (hb_aat_layout_feature_setting_t) 16},
|
||||
{HB_TAG ('o','n','u','m'), HB_AAT_LAYOUT_FEATURE_TYPE_NUMBER_CASE, HB_AAT_LAYOUT_SELECTOR_LOWER_CASE_NUMBERS, (hb_aat_layout_feature_setting_t) 2},
|
||||
{HB_TAG ('n','l','c','k'), HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE, HB_AAT_LAYOUT_SELECTOR_NLCCHARACTERS, (hb_aat_layout_feature_selector_t) 16},
|
||||
{HB_TAG ('o','n','u','m'), HB_AAT_LAYOUT_FEATURE_TYPE_NUMBER_CASE, HB_AAT_LAYOUT_SELECTOR_LOWER_CASE_NUMBERS, (hb_aat_layout_feature_selector_t) 2},
|
||||
{HB_TAG ('o','r','d','n'), HB_AAT_LAYOUT_FEATURE_TYPE_VERTICAL_POSITION, HB_AAT_LAYOUT_SELECTOR_ORDINALS, HB_AAT_LAYOUT_SELECTOR_NORMAL_POSITION},
|
||||
{HB_TAG ('p','a','l','t'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_ALT_PROPORTIONAL_TEXT, (hb_aat_layout_feature_setting_t) 7},
|
||||
{HB_TAG ('p','a','l','t'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_ALT_PROPORTIONAL_TEXT, (hb_aat_layout_feature_selector_t) 7},
|
||||
{HB_TAG ('p','c','a','p'), HB_AAT_LAYOUT_FEATURE_TYPE_LOWER_CASE, HB_AAT_LAYOUT_SELECTOR_LOWER_CASE_PETITE_CAPS, HB_AAT_LAYOUT_SELECTOR_DEFAULT_LOWER_CASE},
|
||||
{HB_TAG ('p','k','n','a'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_PROPORTIONAL_TEXT, (hb_aat_layout_feature_setting_t) 7},
|
||||
{HB_TAG ('p','n','u','m'), HB_AAT_LAYOUT_FEATURE_TYPE_NUMBER_SPACING, HB_AAT_LAYOUT_SELECTOR_PROPORTIONAL_NUMBERS, (hb_aat_layout_feature_setting_t) 4},
|
||||
{HB_TAG ('p','w','i','d'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_PROPORTIONAL_TEXT, (hb_aat_layout_feature_setting_t) 7},
|
||||
{HB_TAG ('q','w','i','d'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_QUARTER_WIDTH_TEXT, (hb_aat_layout_feature_setting_t) 7},
|
||||
{HB_TAG ('p','k','n','a'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_PROPORTIONAL_TEXT, (hb_aat_layout_feature_selector_t) 7},
|
||||
{HB_TAG ('p','n','u','m'), HB_AAT_LAYOUT_FEATURE_TYPE_NUMBER_SPACING, HB_AAT_LAYOUT_SELECTOR_PROPORTIONAL_NUMBERS, (hb_aat_layout_feature_selector_t) 4},
|
||||
{HB_TAG ('p','w','i','d'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_PROPORTIONAL_TEXT, (hb_aat_layout_feature_selector_t) 7},
|
||||
{HB_TAG ('q','w','i','d'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_QUARTER_WIDTH_TEXT, (hb_aat_layout_feature_selector_t) 7},
|
||||
{HB_TAG ('r','u','b','y'), HB_AAT_LAYOUT_FEATURE_TYPE_RUBY_KANA, HB_AAT_LAYOUT_SELECTOR_RUBY_KANA_ON, HB_AAT_LAYOUT_SELECTOR_RUBY_KANA_OFF},
|
||||
{HB_TAG ('s','i','n','f'), HB_AAT_LAYOUT_FEATURE_TYPE_VERTICAL_POSITION, HB_AAT_LAYOUT_SELECTOR_SCIENTIFIC_INFERIORS, HB_AAT_LAYOUT_SELECTOR_NORMAL_POSITION},
|
||||
{HB_TAG ('s','m','c','p'), HB_AAT_LAYOUT_FEATURE_TYPE_LOWER_CASE, HB_AAT_LAYOUT_SELECTOR_LOWER_CASE_SMALL_CAPS, HB_AAT_LAYOUT_SELECTOR_DEFAULT_LOWER_CASE},
|
||||
{HB_TAG ('s','m','p','l'), HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE, HB_AAT_LAYOUT_SELECTOR_SIMPLIFIED_CHARACTERS, (hb_aat_layout_feature_setting_t) 16},
|
||||
{HB_TAG ('s','m','p','l'), HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE, HB_AAT_LAYOUT_SELECTOR_SIMPLIFIED_CHARACTERS, (hb_aat_layout_feature_selector_t) 16},
|
||||
{HB_TAG ('s','s','0','1'), HB_AAT_LAYOUT_FEATURE_TYPE_STYLISTIC_ALTERNATIVES, HB_AAT_LAYOUT_SELECTOR_STYLISTIC_ALT_ONE_ON, HB_AAT_LAYOUT_SELECTOR_STYLISTIC_ALT_ONE_OFF},
|
||||
{HB_TAG ('s','s','0','2'), HB_AAT_LAYOUT_FEATURE_TYPE_STYLISTIC_ALTERNATIVES, HB_AAT_LAYOUT_SELECTOR_STYLISTIC_ALT_TWO_ON, HB_AAT_LAYOUT_SELECTOR_STYLISTIC_ALT_TWO_OFF},
|
||||
{HB_TAG ('s','s','0','3'), HB_AAT_LAYOUT_FEATURE_TYPE_STYLISTIC_ALTERNATIVES, HB_AAT_LAYOUT_SELECTOR_STYLISTIC_ALT_THREE_ON, HB_AAT_LAYOUT_SELECTOR_STYLISTIC_ALT_THREE_OFF},
|
||||
|
@ -108,16 +108,16 @@ static const hb_aat_feature_mapping_t feature_mappings[] =
|
|||
{HB_TAG ('s','u','p','s'), HB_AAT_LAYOUT_FEATURE_TYPE_VERTICAL_POSITION, HB_AAT_LAYOUT_SELECTOR_SUPERIORS, HB_AAT_LAYOUT_SELECTOR_NORMAL_POSITION},
|
||||
{HB_TAG ('s','w','s','h'), HB_AAT_LAYOUT_FEATURE_TYPE_CONTEXTUAL_ALTERNATIVES, HB_AAT_LAYOUT_SELECTOR_SWASH_ALTERNATES_ON, HB_AAT_LAYOUT_SELECTOR_SWASH_ALTERNATES_OFF},
|
||||
{HB_TAG ('t','i','t','l'), HB_AAT_LAYOUT_FEATURE_TYPE_STYLE_OPTIONS, HB_AAT_LAYOUT_SELECTOR_TITLING_CAPS, HB_AAT_LAYOUT_SELECTOR_NO_STYLE_OPTIONS},
|
||||
{HB_TAG ('t','n','a','m'), HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE, HB_AAT_LAYOUT_SELECTOR_TRADITIONAL_NAMES_CHARACTERS, (hb_aat_layout_feature_setting_t) 16},
|
||||
{HB_TAG ('t','n','u','m'), HB_AAT_LAYOUT_FEATURE_TYPE_NUMBER_SPACING, HB_AAT_LAYOUT_SELECTOR_MONOSPACED_NUMBERS, (hb_aat_layout_feature_setting_t) 4},
|
||||
{HB_TAG ('t','r','a','d'), HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE, HB_AAT_LAYOUT_SELECTOR_TRADITIONAL_CHARACTERS, (hb_aat_layout_feature_setting_t) 16},
|
||||
{HB_TAG ('t','w','i','d'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_THIRD_WIDTH_TEXT, (hb_aat_layout_feature_setting_t) 7},
|
||||
{HB_TAG ('u','n','i','c'), HB_AAT_LAYOUT_FEATURE_TYPE_LETTER_CASE, (hb_aat_layout_feature_setting_t) 14, (hb_aat_layout_feature_setting_t) 15},
|
||||
{HB_TAG ('v','a','l','t'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_ALT_PROPORTIONAL_TEXT, (hb_aat_layout_feature_setting_t) 7},
|
||||
{HB_TAG ('t','n','a','m'), HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE, HB_AAT_LAYOUT_SELECTOR_TRADITIONAL_NAMES_CHARACTERS, (hb_aat_layout_feature_selector_t) 16},
|
||||
{HB_TAG ('t','n','u','m'), HB_AAT_LAYOUT_FEATURE_TYPE_NUMBER_SPACING, HB_AAT_LAYOUT_SELECTOR_MONOSPACED_NUMBERS, (hb_aat_layout_feature_selector_t) 4},
|
||||
{HB_TAG ('t','r','a','d'), HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_SHAPE, HB_AAT_LAYOUT_SELECTOR_TRADITIONAL_CHARACTERS, (hb_aat_layout_feature_selector_t) 16},
|
||||
{HB_TAG ('t','w','i','d'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_THIRD_WIDTH_TEXT, (hb_aat_layout_feature_selector_t) 7},
|
||||
{HB_TAG ('u','n','i','c'), HB_AAT_LAYOUT_FEATURE_TYPE_LETTER_CASE, (hb_aat_layout_feature_selector_t) 14, (hb_aat_layout_feature_selector_t) 15},
|
||||
{HB_TAG ('v','a','l','t'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_ALT_PROPORTIONAL_TEXT, (hb_aat_layout_feature_selector_t) 7},
|
||||
{HB_TAG ('v','e','r','t'), HB_AAT_LAYOUT_FEATURE_TYPE_VERTICAL_SUBSTITUTION, HB_AAT_LAYOUT_SELECTOR_SUBSTITUTE_VERTICAL_FORMS_ON, HB_AAT_LAYOUT_SELECTOR_SUBSTITUTE_VERTICAL_FORMS_OFF},
|
||||
{HB_TAG ('v','h','a','l'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_ALT_HALF_WIDTH_TEXT, (hb_aat_layout_feature_setting_t) 7},
|
||||
{HB_TAG ('v','h','a','l'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_ALT_HALF_WIDTH_TEXT, (hb_aat_layout_feature_selector_t) 7},
|
||||
{HB_TAG ('v','k','n','a'), HB_AAT_LAYOUT_FEATURE_TYPE_ALTERNATE_KANA, HB_AAT_LAYOUT_SELECTOR_ALTERNATE_VERT_KANA_ON, HB_AAT_LAYOUT_SELECTOR_ALTERNATE_VERT_KANA_OFF},
|
||||
{HB_TAG ('v','p','a','l'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_ALT_PROPORTIONAL_TEXT, (hb_aat_layout_feature_setting_t) 7},
|
||||
{HB_TAG ('v','p','a','l'), HB_AAT_LAYOUT_FEATURE_TYPE_TEXT_SPACING, HB_AAT_LAYOUT_SELECTOR_ALT_PROPORTIONAL_TEXT, (hb_aat_layout_feature_selector_t) 7},
|
||||
{HB_TAG ('v','r','t','2'), HB_AAT_LAYOUT_FEATURE_TYPE_VERTICAL_SUBSTITUTION, HB_AAT_LAYOUT_SELECTOR_SUBSTITUTE_VERTICAL_FORMS_ON, HB_AAT_LAYOUT_SELECTOR_SUBSTITUTE_VERTICAL_FORMS_OFF},
|
||||
{HB_TAG ('z','e','r','o'), HB_AAT_LAYOUT_FEATURE_TYPE_TYPOGRAPHIC_EXTRAS, HB_AAT_LAYOUT_SELECTOR_SLASHED_ZERO_ON, HB_AAT_LAYOUT_SELECTOR_SLASHED_ZERO_OFF},
|
||||
};
|
||||
|
@ -335,10 +335,10 @@ hb_aat_layout_feature_get_name_id (hb_face_t *face,
|
|||
{ return face->table.feat->get_feature_name_id (feature); }
|
||||
|
||||
/**
|
||||
* hb_aat_layout_feature_get_settings:
|
||||
* hb_aat_layout_feature_get_selectors:
|
||||
* @face: a face object
|
||||
* @feature: feature id
|
||||
* @default_setting: (out): if is set, the feature is exclusive
|
||||
* @default_selector: (out): if is set, the feature is exclusive
|
||||
* @start_offset: iteration's start offset
|
||||
* @count: (inout): buffer size as input, filled size as output
|
||||
* @settings: (out): settings buffer
|
||||
|
@ -357,29 +357,29 @@ hb_aat_layout_feature_get_name_id (hb_face_t *face,
|
|||
* Since: REPLACEME
|
||||
*/
|
||||
unsigned int
|
||||
hb_aat_layout_feature_get_settings (hb_face_t *face,
|
||||
hb_aat_layout_feature_get_selectors (hb_face_t *face,
|
||||
hb_aat_layout_feature_type_t feature,
|
||||
hb_aat_layout_feature_setting_t *default_setting, /* OUT. May be NULL. */
|
||||
hb_aat_layout_feature_selector_t *default_selector, /* OUT. May be NULL. */
|
||||
unsigned int start_offset,
|
||||
unsigned int *count, /* IN/OUT. May be NULL. */
|
||||
hb_aat_layout_feature_setting_t *settings /* OUT. May be NULL. */)
|
||||
hb_aat_layout_feature_selector_t *selectors /* OUT. May be NULL. */)
|
||||
{
|
||||
return face->table.feat->get_settings (feature, default_setting,
|
||||
start_offset, count, settings);
|
||||
return face->table.feat->get_selectors (feature, default_selector,
|
||||
start_offset, count, selectors);
|
||||
}
|
||||
|
||||
/**
|
||||
* hb_aat_layout_feature_setting_get_name_id:
|
||||
* hb_aat_layout_feature_selector_get_name_id:
|
||||
* @face: a face object
|
||||
* @feature: feature id
|
||||
* @setting: setting value
|
||||
* @selector: selector value
|
||||
*
|
||||
* Return value: Name ID index
|
||||
*
|
||||
* Since: REPLACEME
|
||||
*/
|
||||
hb_ot_name_id_t
|
||||
hb_aat_layout_feature_setting_get_name_id (hb_face_t *face,
|
||||
hb_aat_layout_feature_selector_get_name_id (hb_face_t *face,
|
||||
hb_aat_layout_feature_type_t feature,
|
||||
hb_aat_layout_feature_setting_t setting)
|
||||
{ return face->table.feat->get_feature_setting_name_id (feature, setting); }
|
||||
hb_aat_layout_feature_selector_t selector)
|
||||
{ return face->table.feat->get_feature_selector_name_id (feature, selector); }
|
||||
|
|
|
@ -37,8 +37,8 @@ struct hb_aat_feature_mapping_t
|
|||
{
|
||||
hb_tag_t otFeatureTag;
|
||||
hb_aat_layout_feature_type_t aatFeatureType;
|
||||
hb_aat_layout_feature_setting_t selectorToEnable;
|
||||
hb_aat_layout_feature_setting_t selectorToDisable;
|
||||
hb_aat_layout_feature_selector_t selectorToEnable;
|
||||
hb_aat_layout_feature_selector_t selectorToDisable;
|
||||
|
||||
static inline int cmp (const void *key_, const void *entry_)
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ void hb_aat_map_builder_t::add_feature (hb_tag_t tag,
|
|||
{
|
||||
feature_info_t *info = features.push();
|
||||
info->type = HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_ALTERNATIVES;
|
||||
info->setting = (hb_aat_layout_feature_setting_t) value;
|
||||
info->setting = (hb_aat_layout_feature_selector_t) value;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ struct hb_aat_map_builder_t
|
|||
struct feature_info_t
|
||||
{
|
||||
hb_aat_layout_feature_type_t type;
|
||||
hb_aat_layout_feature_setting_t setting;
|
||||
hb_aat_layout_feature_selector_t setting;
|
||||
unsigned seq; /* For stable sorting only. */
|
||||
|
||||
static int cmp (const void *pa, const void *pb)
|
||||
|
|
12
src/hb-aat.h
12
src/hb-aat.h
|
@ -414,7 +414,7 @@ typedef enum
|
|||
HB_AAT_LAYOUT_SELECTOR_PROPORTIONAL_CJK_ROMAN = 1,
|
||||
HB_AAT_LAYOUT_SELECTOR_DEFAULT_CJK_ROMAN = 2,
|
||||
HB_AAT_LAYOUT_SELECTOR_FULL_WIDTH_CJK_ROMAN = 3
|
||||
} hb_aat_layout_feature_setting_t;
|
||||
} hb_aat_layout_feature_selector_t;
|
||||
|
||||
HB_EXTERN unsigned int
|
||||
hb_aat_layout_get_features (hb_face_t *face,
|
||||
|
@ -428,17 +428,17 @@ hb_aat_layout_feature_get_name_id (hb_face_t *face,
|
|||
|
||||
|
||||
HB_EXTERN unsigned int
|
||||
hb_aat_layout_feature_get_settings (hb_face_t *face,
|
||||
hb_aat_layout_feature_get_selectors (hb_face_t *face,
|
||||
hb_aat_layout_feature_type_t feature,
|
||||
hb_aat_layout_feature_setting_t *default_setting, /* OUT. May be NULL. */
|
||||
hb_aat_layout_feature_selector_t *default_selector, /* OUT. May be NULL. */
|
||||
unsigned int start_offset,
|
||||
unsigned int *count, /* IN/OUT. May be NULL. */
|
||||
hb_aat_layout_feature_setting_t *settings /* OUT. May be NULL. */);
|
||||
hb_aat_layout_feature_selector_t *settings /* OUT. May be NULL. */);
|
||||
|
||||
HB_EXTERN hb_ot_name_id_t
|
||||
hb_aat_layout_feature_setting_get_name_id (hb_face_t *face,
|
||||
hb_aat_layout_feature_selector_get_name_id (hb_face_t *face,
|
||||
hb_aat_layout_feature_type_t feature,
|
||||
hb_aat_layout_feature_setting_t setting);
|
||||
hb_aat_layout_feature_selector_t selector);
|
||||
|
||||
HB_END_DECLS
|
||||
|
||||
|
|
|
@ -50,53 +50,53 @@ test_aat_get_features (void)
|
|||
}
|
||||
|
||||
static void
|
||||
test_aat_get_feature_settings (void)
|
||||
test_aat_get_feature_selectors (void)
|
||||
{
|
||||
hb_aat_layout_feature_setting_t default_setting;
|
||||
hb_aat_layout_feature_setting_t settings[3];
|
||||
hb_aat_layout_feature_selector_t default_selector;
|
||||
hb_aat_layout_feature_selector_t settings[3];
|
||||
unsigned int count = 3;
|
||||
|
||||
g_assert_cmpuint (4, ==, hb_aat_layout_feature_get_settings (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE,
|
||||
&default_setting, 0, &count, settings));
|
||||
g_assert_cmpuint (4, ==, hb_aat_layout_feature_get_selectors (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE,
|
||||
&default_selector, 0, &count, settings));
|
||||
g_assert_cmpuint (3, ==, count);
|
||||
g_assert_cmpuint (0, ==, default_setting);
|
||||
g_assert_cmpuint (0, ==, default_selector);
|
||||
|
||||
g_assert_cmpuint (0, ==, settings[0]);
|
||||
g_assert_cmpuint (294, ==, hb_aat_layout_feature_setting_get_name_id (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE, settings[0]));
|
||||
g_assert_cmpuint (294, ==, hb_aat_layout_feature_selector_get_name_id (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE, settings[0]));
|
||||
|
||||
g_assert_cmpuint (1, ==, settings[1]);
|
||||
g_assert_cmpuint (295, ==, hb_aat_layout_feature_setting_get_name_id (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE, settings[1]));
|
||||
g_assert_cmpuint (295, ==, hb_aat_layout_feature_selector_get_name_id (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE, settings[1]));
|
||||
|
||||
g_assert_cmpuint (2, ==, settings[2]);
|
||||
g_assert_cmpuint (296, ==, hb_aat_layout_feature_setting_get_name_id (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE, settings[2]));
|
||||
g_assert_cmpuint (296, ==, hb_aat_layout_feature_selector_get_name_id (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE, settings[2]));
|
||||
|
||||
g_assert_cmpuint (HB_OT_NAME_ID_INVALID, ==, hb_aat_layout_feature_setting_get_name_id (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE, HB_AAT_LAYOUT_SELECTOR_INVALID));
|
||||
g_assert_cmpuint (HB_OT_NAME_ID_INVALID, ==, hb_aat_layout_feature_selector_get_name_id (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE, HB_AAT_LAYOUT_SELECTOR_INVALID));
|
||||
|
||||
count = 3;
|
||||
g_assert_cmpuint (4, ==, hb_aat_layout_feature_get_settings (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE,
|
||||
&default_setting, 3, &count, settings));
|
||||
g_assert_cmpuint (4, ==, hb_aat_layout_feature_get_selectors (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE,
|
||||
&default_selector, 3, &count, settings));
|
||||
g_assert_cmpuint (1, ==, count);
|
||||
g_assert_cmpuint (0, ==, default_setting);
|
||||
g_assert_cmpuint (0, ==, default_selector);
|
||||
|
||||
g_assert_cmpuint (3, ==, settings[0]);
|
||||
g_assert_cmpuint (297, ==, hb_aat_layout_feature_setting_get_name_id (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE, settings[0]));
|
||||
g_assert_cmpuint (297, ==, hb_aat_layout_feature_selector_get_name_id (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE, settings[0]));
|
||||
|
||||
count = 1;
|
||||
g_assert_cmpuint (1, ==, hb_aat_layout_feature_get_settings (face, HB_AAT_LAYOUT_FEATURE_TYPE_TYPOGRAPHIC_EXTRAS,
|
||||
&default_setting, 0, &count, settings));
|
||||
g_assert_cmpuint (1, ==, hb_aat_layout_feature_get_selectors (face, HB_AAT_LAYOUT_FEATURE_TYPE_TYPOGRAPHIC_EXTRAS,
|
||||
&default_selector, 0, &count, settings));
|
||||
g_assert_cmpuint (1, ==, count);
|
||||
g_assert_cmpuint (HB_AAT_LAYOUT_FEATURE_TYPE_INVALID, ==, default_setting);
|
||||
g_assert_cmpuint (HB_AAT_LAYOUT_FEATURE_TYPE_INVALID, ==, default_selector);
|
||||
|
||||
g_assert_cmpuint (8, ==, settings[0]);
|
||||
g_assert_cmpuint (308, ==, hb_aat_layout_feature_setting_get_name_id (face, HB_AAT_LAYOUT_FEATURE_TYPE_TYPOGRAPHIC_EXTRAS, settings[0]));
|
||||
g_assert_cmpuint (308, ==, hb_aat_layout_feature_selector_get_name_id (face, HB_AAT_LAYOUT_FEATURE_TYPE_TYPOGRAPHIC_EXTRAS, settings[0]));
|
||||
|
||||
count = 100;
|
||||
g_assert_cmpuint (0, ==, hb_aat_layout_feature_get_settings (face, HB_AAT_LAYOUT_FEATURE_TYPE_INVALID,
|
||||
g_assert_cmpuint (0, ==, hb_aat_layout_feature_get_selectors (face, HB_AAT_LAYOUT_FEATURE_TYPE_INVALID,
|
||||
NULL, 0, &count, settings));
|
||||
g_assert_cmpuint (0, ==, count);
|
||||
|
||||
g_assert_cmpuint (HB_OT_NAME_ID_INVALID, ==, hb_aat_layout_feature_setting_get_name_id (sbix, HB_AAT_LAYOUT_FEATURE_TYPE_INVALID,
|
||||
(hb_aat_layout_feature_setting_t) 0));
|
||||
g_assert_cmpuint (HB_OT_NAME_ID_INVALID, ==, hb_aat_layout_feature_selector_get_name_id (sbix, HB_AAT_LAYOUT_FEATURE_TYPE_INVALID,
|
||||
(hb_aat_layout_feature_selector_t) 0));
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -105,7 +105,7 @@ main (int argc, char **argv)
|
|||
hb_test_init (&argc, &argv);
|
||||
|
||||
hb_test_add (test_aat_get_features);
|
||||
hb_test_add (test_aat_get_feature_settings);
|
||||
hb_test_add (test_aat_get_feature_selectors);
|
||||
|
||||
face = hb_test_open_font_file ("fonts/aat-feat.ttf");
|
||||
sbix = hb_test_open_font_file ("fonts/chromacheck-sbix.ttf");
|
||||
|
|
Loading…
Reference in New Issue