[feat] Apply @drott and @jfkthame comments
This commit is contained in:
parent
b791bbbae4
commit
3aff3f822f
@ -87,7 +87,7 @@ struct FeatureName
|
||||
hb_aat_feature_setting_t *default_setting,
|
||||
unsigned int start_offset,
|
||||
unsigned int *records_count,
|
||||
hb_aat_feature_option_record_t *records_buffer) const
|
||||
hb_aat_feature_type_selector_t *records_buffer) const
|
||||
{
|
||||
bool exclusive = featureFlags & Exclusive;
|
||||
bool not_default = featureFlags & NotDefault;
|
||||
@ -105,12 +105,10 @@ struct FeatureName
|
||||
}
|
||||
if (default_setting)
|
||||
{
|
||||
if (exclusive)
|
||||
{
|
||||
if (settings_count && !not_default) *default_setting = settings[0].setting;
|
||||
else if (not_default) *default_setting = featureFlags & IndexMask;
|
||||
}
|
||||
else *default_setting = HB_AAT_FEATURE_NO_DEFAULT_INDEX;
|
||||
unsigned int index = not_default ? featureFlags & IndexMask : 0;
|
||||
if (exclusive && index < settings_count)
|
||||
*default_setting = settings[index].setting;
|
||||
else *default_setting = HB_AAT_FEATURE_NO_DEFAULT_SETTING;
|
||||
}
|
||||
if (records_count) *records_count = len;
|
||||
return settings_count;
|
||||
@ -158,7 +156,7 @@ struct feat
|
||||
hb_aat_feature_setting_t *default_setting, /* OUT. May be NULL. */
|
||||
unsigned int start_offset,
|
||||
unsigned int *records_count, /* IN/OUT. May be NULL. */
|
||||
hb_aat_feature_option_record_t *records_buffer) const
|
||||
hb_aat_feature_type_selector_t *records_buffer) const
|
||||
{
|
||||
return get_feature (type).get_settings (this, default_setting,
|
||||
start_offset, records_count, records_buffer);
|
||||
|
@ -309,14 +309,16 @@ _hb_aat_language_get (hb_face_t *face,
|
||||
/**
|
||||
* hb_aat_get_feature_settings:
|
||||
* @face: a font face.
|
||||
* @identifier: aat feature id you are querying.
|
||||
* @default_setting: (out): default value for the type. If it is HB_AAT_FEATURE_NO_DEFAULT_INDEX
|
||||
* means non is default and it is not exclusive also.
|
||||
* @identifier: AAT feature id you are querying, for example 1 for
|
||||
* "Ligatures" feature, 37 for the "Lower Case" feature,
|
||||
* 38 for the "Upper Case" feature, etc.
|
||||
* @default_setting: (out): default value for the type. If it is HB_AAT_FEATURE_NO_DEFAULT_SETTING
|
||||
* means none is selected as default and the feature is not exclusive.
|
||||
* @start_offset: start offset, if you are iterating
|
||||
* @records_count: (inout): gets input buffer size, puts number of filled one
|
||||
* @records_buffer: (out): buffer of records
|
||||
*
|
||||
* Returns: Total number of records available for the feature.
|
||||
* Returns: Total number of feature selector records available for the feature.
|
||||
*
|
||||
* Since: REPLACEME
|
||||
*/
|
||||
@ -326,7 +328,7 @@ hb_aat_get_feature_settings (hb_face_t *face,
|
||||
hb_aat_feature_setting_t *default_setting, /* OUT. May be NULL. */
|
||||
unsigned int start_offset,
|
||||
unsigned int *records_count, /* IN/OUT. May be NULL. */
|
||||
hb_aat_feature_option_record_t *records_buffer /* OUT. May be NULL. */)
|
||||
hb_aat_feature_type_selector_t *records_buffer /* OUT. May be NULL. */)
|
||||
{
|
||||
return _get_feat (face).get_settings (identifier, default_setting,
|
||||
start_offset, records_count, records_buffer);
|
||||
|
@ -49,22 +49,22 @@ typedef uint16_t hb_aat_feature_type_t;
|
||||
typedef uint16_t hb_aat_feature_setting_t;
|
||||
|
||||
/**
|
||||
* hb_aat_feature_option_record_t:
|
||||
* hb_aat_feature_type_selector_t:
|
||||
*
|
||||
* Feature type record
|
||||
*
|
||||
* Since: REPLACEME
|
||||
**/
|
||||
typedef struct hb_aat_feature_option_record_t
|
||||
typedef struct hb_aat_feature_type_selector_t
|
||||
{
|
||||
hb_aat_feature_setting_t setting;
|
||||
hb_ot_name_id_t name_id;
|
||||
} hb_aat_feature_option_record_t;
|
||||
} hb_aat_feature_type_selector_t;
|
||||
|
||||
/*
|
||||
* Since: REPLACEME
|
||||
*/
|
||||
#define HB_AAT_FEATURE_NO_DEFAULT_INDEX ((hb_aat_feature_setting_t) -1)
|
||||
#define HB_AAT_FEATURE_NO_DEFAULT_SETTING ((hb_aat_feature_setting_t) -1)
|
||||
|
||||
HB_EXTERN unsigned int
|
||||
hb_aat_get_feature_settings (hb_face_t *face,
|
||||
@ -72,7 +72,7 @@ hb_aat_get_feature_settings (hb_face_t *face,
|
||||
hb_aat_feature_setting_t *default_setting, /* OUT. May be NULL. */
|
||||
unsigned int start_offset,
|
||||
unsigned int *records_count, /* IN/OUT. May be NULL. */
|
||||
hb_aat_feature_option_record_t *records_buffer /* OUT. May be NULL. */);
|
||||
hb_aat_feature_type_selector_t *records_buffer /* OUT. May be NULL. */);
|
||||
|
||||
HB_END_DECLS
|
||||
|
||||
|
@ -32,7 +32,7 @@ static void
|
||||
test_aat_get_feature_settings (void)
|
||||
{
|
||||
hb_aat_feature_setting_t default_setting;
|
||||
hb_aat_feature_option_record_t records[3];
|
||||
hb_aat_feature_type_selector_t records[3];
|
||||
unsigned int count = 3;
|
||||
|
||||
hb_face_t *face = hb_test_open_font_file ("fonts/aat-feat.ttf");
|
||||
@ -65,7 +65,7 @@ test_aat_get_feature_settings (void)
|
||||
g_assert_cmpuint (1, ==, hb_aat_get_feature_settings (face, 14, &default_setting,
|
||||
0, &count, records));
|
||||
g_assert_cmpuint (1, ==, count);
|
||||
g_assert_cmpuint (HB_AAT_FEATURE_NO_DEFAULT_INDEX, ==, default_setting);
|
||||
g_assert_cmpuint (HB_AAT_FEATURE_NO_DEFAULT_SETTING, ==, default_setting);
|
||||
|
||||
g_assert_cmpuint (8, ==, records[0].setting);
|
||||
g_assert_cmpuint (308, ==, records[0].name_id);
|
||||
|
Loading…
Reference in New Issue
Block a user