[feat] Apply renamings and add documentation

This commit is contained in:
Ebrahim Byagowi 2018-11-23 11:44:53 +03:30 committed by Behdad Esfahbod
parent a8726cb483
commit 9c64b216ec
4 changed files with 65 additions and 23 deletions

View File

@ -3,6 +3,16 @@ HB_H_IN
HB_OT_H_IN
</SECTION>
<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_type_t
hb_aat_layout_get_features
</SECTION>
<SECTION>
<FILE>hb-blob</FILE>
hb_blob_create

View File

@ -302,6 +302,12 @@ _hb_aat_language_get (hb_face_t *face,
/**
* hb_aat_layout_get_features:
* @face: a face object
* @start_offset: iteration's start offset
* @count: (inout): buffer size as input, filled size as output
* @features: (out): features buffer
*
* Return value: Number of all available features
*
* Since: REPLACEME
*/
@ -315,22 +321,43 @@ hb_aat_layout_get_features (hb_face_t *face,
}
/**
* hb_aat_layout_get_feature_name_id:
* hb_aat_layout_feature_get_name_id:
* @face: a face object
* @feature: feature id
*
* Return value: Name ID index
*
* Since: REPLACEME
*/
hb_ot_name_id_t
hb_aat_layout_get_feature_name_id (hb_face_t *face,
hb_aat_layout_feature_get_name_id (hb_face_t *face,
hb_aat_layout_feature_type_t feature)
{ return face->table.feat->get_feature_name_id (feature); }
/**
* hb_aat_layout_get_feature_settings:
* hb_aat_layout_feature_get_settings:
* @face: a face object
* @feature: feature id
* @default_setting: (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
*
* Per spec:
* For feature types that don't have exclusive settings,
* there will always be a pair of values. One value turns
* a selector on and a second value turns the selector off.
* The on setting must be even and the off setting must be one
* greater than the corresponding on setting. The off setting
* is therefore always odd. As a result, only the on setting
* should have an entry in the setting name array.
*
* Return value: Number of all available features
*
* Since: REPLACEME
*/
unsigned int
hb_aat_layout_get_feature_settings (hb_face_t *face,
hb_aat_layout_feature_get_settings (hb_face_t *face,
hb_aat_layout_feature_type_t feature,
hb_aat_layout_feature_setting_t *default_setting, /* OUT. May be NULL. */
unsigned int start_offset,
@ -342,12 +369,17 @@ hb_aat_layout_get_feature_settings (hb_face_t *face,
}
/**
* hb_aat_layout_get_feature_setting_name_id:
* hb_aat_layout_feature_setting_get_name_id:
* @face: a face object
* @feature: feature id
* @setting: setting value
*
* Return value: Name ID index
*
* Since: REPLACEME
*/
hb_ot_name_id_t
hb_aat_layout_get_feature_setting_name_id (hb_face_t *face,
hb_aat_layout_feature_setting_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); }

View File

@ -423,12 +423,12 @@ hb_aat_layout_get_features (hb_face_t *face,
hb_aat_layout_feature_type_t *features /* OUT. May be NULL. */);
HB_EXTERN hb_ot_name_id_t
hb_aat_layout_get_feature_name_id (hb_face_t *face,
hb_aat_layout_feature_get_name_id (hb_face_t *face,
hb_aat_layout_feature_type_t feature);
HB_EXTERN unsigned int
hb_aat_layout_get_feature_settings (hb_face_t *face,
hb_aat_layout_feature_get_settings (hb_face_t *face,
hb_aat_layout_feature_type_t feature,
hb_aat_layout_feature_setting_t *default_setting, /* OUT. May be NULL. */
unsigned int start_offset,
@ -436,7 +436,7 @@ hb_aat_layout_get_feature_settings (hb_face_t *face,
hb_aat_layout_feature_setting_t *settings /* OUT. May be NULL. */);
HB_EXTERN hb_ot_name_id_t
hb_aat_layout_get_feature_setting_name_id (hb_face_t *face,
hb_aat_layout_feature_setting_get_name_id (hb_face_t *face,
hb_aat_layout_feature_type_t feature,
hb_aat_layout_feature_setting_t setting);

View File

@ -44,9 +44,9 @@ test_aat_get_features (void)
g_assert_cmpuint (3, ==, features[1]);
g_assert_cmpuint (6, ==, features[2]);
g_assert_cmpuint (258, ==, hb_aat_layout_get_feature_name_id (face, features[0]));
g_assert_cmpuint (261, ==, hb_aat_layout_get_feature_name_id (face, features[1]));
g_assert_cmpuint (265, ==, hb_aat_layout_get_feature_name_id (face, features[2]));
g_assert_cmpuint (258, ==, hb_aat_layout_feature_get_name_id (face, features[0]));
g_assert_cmpuint (261, ==, hb_aat_layout_feature_get_name_id (face, features[1]));
g_assert_cmpuint (265, ==, hb_aat_layout_feature_get_name_id (face, features[2]));
}
static void
@ -56,46 +56,46 @@ test_aat_get_feature_settings (void)
hb_aat_layout_feature_setting_t settings[3];
unsigned int count = 3;
g_assert_cmpuint (4, ==, hb_aat_layout_get_feature_settings (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE,
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 (3, ==, count);
g_assert_cmpuint (0, ==, default_setting);
g_assert_cmpuint (0, ==, settings[0]);
g_assert_cmpuint (294, ==, hb_aat_layout_get_feature_setting_name_id (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE, 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 (1, ==, settings[1]);
g_assert_cmpuint (295, ==, hb_aat_layout_get_feature_setting_name_id (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE, 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 (2, ==, settings[2]);
g_assert_cmpuint (296, ==, hb_aat_layout_get_feature_setting_name_id (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE, 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 (HB_OT_NAME_ID_INVALID, ==, hb_aat_layout_get_feature_setting_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_setting_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_get_feature_settings (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE,
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 (1, ==, count);
g_assert_cmpuint (0, ==, default_setting);
g_assert_cmpuint (3, ==, settings[0]);
g_assert_cmpuint (297, ==, hb_aat_layout_get_feature_setting_name_id (face, HB_AAT_LAYOUT_FEATURE_TYPE_DESIGN_COMPLEXITY_TYPE, 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]));
count = 1;
g_assert_cmpuint (1, ==, hb_aat_layout_get_feature_settings (face, HB_AAT_LAYOUT_FEATURE_TYPE_TYPOGRAPHIC_EXTRAS,
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, ==, count);
g_assert_cmpuint (HB_AAT_LAYOUT_FEATURE_TYPE_INVALID, ==, default_setting);
g_assert_cmpuint (8, ==, settings[0]);
g_assert_cmpuint (308, ==, hb_aat_layout_get_feature_setting_name_id (face, HB_AAT_LAYOUT_FEATURE_TYPE_TYPOGRAPHIC_EXTRAS, settings[0]));
g_assert_cmpuint (308, ==, hb_aat_layout_feature_setting_get_name_id (face, HB_AAT_LAYOUT_FEATURE_TYPE_TYPOGRAPHIC_EXTRAS, settings[0]));
count = 100;
g_assert_cmpuint (0, ==, hb_aat_layout_get_feature_settings (face, HB_AAT_LAYOUT_FEATURE_TYPE_INVALID,
g_assert_cmpuint (0, ==, hb_aat_layout_feature_get_settings (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_get_feature_setting_name_id (sbix, HB_AAT_LAYOUT_FEATURE_TYPE_INVALID,
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));
}