diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index 5f5dcef7d..42cb7c5a4 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -3,6 +3,16 @@ HB_H_IN HB_OT_H_IN +
+hb-aat +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 +
+
hb-blob hb_blob_create diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc index 9fefd8f96..8fbd29632 100644 --- a/src/hb-aat-layout.cc +++ b/src/hb-aat-layout.cc @@ -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); } diff --git a/src/hb-aat.h b/src/hb-aat.h index 16a5fad5b..27f455270 100644 --- a/src/hb-aat.h +++ b/src/hb-aat.h @@ -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); diff --git a/test/api/test-aat-layout.c b/test/api/test-aat-layout.c index 9d1330366..571090396 100644 --- a/test/api/test-aat-layout.c +++ b/test/api/test-aat-layout.c @@ -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)); }