|
|
|
@ -34,6 +34,14 @@ test_ot_layout_feature_get_name_ids_and_characters (void) |
|
|
|
|
{ |
|
|
|
|
hb_tag_t cv01 = HB_TAG ('c','v','0','1'); |
|
|
|
|
unsigned int feature_index; |
|
|
|
|
unsigned int num_named_parameters; |
|
|
|
|
hb_ot_name_id_t label_id; |
|
|
|
|
hb_ot_name_id_t tooltip_id; |
|
|
|
|
hb_ot_name_id_t sample_id; |
|
|
|
|
hb_ot_name_id_t first_param_id; |
|
|
|
|
hb_codepoint_t characters[100]; |
|
|
|
|
unsigned int char_count = 100; |
|
|
|
|
unsigned int all_chars; |
|
|
|
|
if (!hb_ot_layout_language_find_feature (face, |
|
|
|
|
HB_OT_TAG_GSUB, |
|
|
|
|
0, |
|
|
|
@ -42,11 +50,6 @@ test_ot_layout_feature_get_name_ids_and_characters (void) |
|
|
|
|
&feature_index)) |
|
|
|
|
g_error ("Failed to find feature index"); |
|
|
|
|
|
|
|
|
|
hb_ot_name_id_t label_id; |
|
|
|
|
hb_ot_name_id_t tooltip_id; |
|
|
|
|
hb_ot_name_id_t sample_id; |
|
|
|
|
unsigned int num_named_parameters; |
|
|
|
|
hb_ot_name_id_t first_param_id; |
|
|
|
|
if (!hb_ot_layout_feature_get_name_ids (face, HB_OT_TAG_GSUB, feature_index, |
|
|
|
|
&label_id, &tooltip_id, &sample_id, |
|
|
|
|
&num_named_parameters, &first_param_id)) |
|
|
|
@ -58,10 +61,6 @@ test_ot_layout_feature_get_name_ids_and_characters (void) |
|
|
|
|
g_assert_cmpint (num_named_parameters, ==, 2); |
|
|
|
|
g_assert_cmpint (first_param_id, ==, 259); |
|
|
|
|
|
|
|
|
|
hb_codepoint_t characters[100]; |
|
|
|
|
unsigned int char_count = 100; |
|
|
|
|
|
|
|
|
|
unsigned int all_chars; |
|
|
|
|
all_chars = hb_ot_layout_feature_get_characters (face, HB_OT_TAG_GSUB, feature_index, |
|
|
|
|
0, &char_count, characters); |
|
|
|
|
|
|
|
|
@ -76,14 +75,16 @@ test_ot_name (void) |
|
|
|
|
{ |
|
|
|
|
unsigned int num_entries; |
|
|
|
|
const hb_ot_name_entry_t *entries; |
|
|
|
|
hb_ot_name_id_t name_id; |
|
|
|
|
hb_language_t lang; |
|
|
|
|
char text[10]; |
|
|
|
|
unsigned int text_size = 10; |
|
|
|
|
entries = hb_ot_name_list_names (face, &num_entries); |
|
|
|
|
g_assert_cmpuint (12, ==, num_entries); |
|
|
|
|
hb_ot_name_id_t name_id = entries[3].name_id; |
|
|
|
|
name_id = entries[3].name_id; |
|
|
|
|
g_assert_cmpuint (3, ==, name_id); |
|
|
|
|
hb_language_t lang = entries[3].language; |
|
|
|
|
lang = entries[3].language; |
|
|
|
|
g_assert_cmpstr (hb_language_to_string (lang), ==, "en"); |
|
|
|
|
char text[10]; |
|
|
|
|
unsigned int text_size = 10; |
|
|
|
|
g_assert_cmpuint (27, ==, hb_ot_name_get_utf8 (face, name_id, lang, &text_size, text)); |
|
|
|
|
g_assert_cmpuint (9, ==, text_size); |
|
|
|
|
g_assert_cmpstr (text, ==, "FontForge"); |
|
|
|
@ -92,13 +93,14 @@ test_ot_name (void) |
|
|
|
|
int |
|
|
|
|
main (int argc, char **argv) |
|
|
|
|
{ |
|
|
|
|
unsigned int status; |
|
|
|
|
g_test_init (&argc, &argv, NULL); |
|
|
|
|
|
|
|
|
|
hb_test_add (test_ot_layout_feature_get_name_ids_and_characters); |
|
|
|
|
hb_test_add (test_ot_name); |
|
|
|
|
|
|
|
|
|
face = hb_test_open_font_file ("fonts/cv01.otf"); |
|
|
|
|
unsigned int status = hb_test_run (); |
|
|
|
|
status = hb_test_run (); |
|
|
|
|
hb_face_destroy (face); |
|
|
|
|
return status; |
|
|
|
|
} |
|
|
|
|