[subset] Remove hb_subset(). Leaving just hb_subset_or_fail().

This commit is contained in:
Garret Rieger 2021-06-23 13:38:47 -07:00
parent e5c887fc0f
commit 9ab751ac9f
9 changed files with 28 additions and 46 deletions

View File

@ -309,21 +309,6 @@ _subset_table (hb_subset_plan_t *plan, hb_tag_t tag)
}
}
/**
* hb_subset:
* @source: font face data to be subset.
* @input: input to use for the subsetting.
*
* Subsets a font according to provided input.
**/
hb_face_t *
hb_subset (hb_face_t *source, const hb_subset_input_t *input)
{
hb_face_t* result = hb_subset_or_fail (source, input);
if (unlikely (!result)) return hb_face_get_empty ();
return result;
}
/**
* hb_subset_or_fail:
* @source: font face data to be subset.

View File

@ -79,6 +79,17 @@ hb_subset_input_reference (hb_subset_input_t *subset_input);
HB_EXTERN void
hb_subset_input_destroy (hb_subset_input_t *subset_input);
HB_EXTERN hb_bool_t
hb_subset_input_set_user_data (hb_subset_input_t *input,
hb_user_data_key_t *key,
void * data,
hb_destroy_func_t destroy,
hb_bool_t replace);
HB_EXTERN void *
hb_subset_input_get_user_data (const hb_subset_input_t *input,
hb_user_data_key_t *key);
HB_EXTERN hb_set_t *
hb_subset_input_unicode_set (hb_subset_input_t *subset_input);
@ -145,17 +156,6 @@ hb_subset (hb_face_t *source, const hb_subset_input_t *input);
HB_EXTERN hb_face_t *
hb_subset_or_fail (hb_face_t *source, const hb_subset_input_t *input);
HB_EXTERN hb_bool_t
hb_subset_input_set_user_data (hb_subset_input_t *input,
hb_user_data_key_t *key,
void * data,
hb_destroy_func_t destroy,
hb_bool_t replace);
HB_EXTERN void *
hb_subset_input_get_user_data (const hb_subset_input_t *input,
hb_user_data_key_t *key);
HB_END_DECLS
#endif /* HB_SUBSET_H */

View File

@ -83,7 +83,7 @@ static inline hb_face_t *
hb_subset_test_create_subset (hb_face_t *source,
hb_subset_input_t *input)
{
hb_face_t *subset = hb_subset (source, input);
hb_face_t *subset = hb_subset_or_fail (source, input);
g_assert (subset);
hb_subset_input_destroy (input);

View File

@ -42,7 +42,8 @@ test_subset_drop_tables (void)
hb_set_add (hb_subset_input_drop_tables_set (input), HB_TAG ('h', 'm', 't', 'x'));
hb_set_destroy (codepoints);
hb_face_t* subset = hb_subset (face, input);
hb_face_t* subset = hb_subset_or_fail (face, input);
g_assert (subset);
hb_blob_t *hdmx = hb_face_reference_table (subset, HB_TAG ('h', 'd', 'm', 'x'));
hb_blob_t *hmtx = hb_face_reference_table (subset, HB_TAG ('h', 'm', 't', 'x'));

View File

@ -301,11 +301,10 @@ test_subset_glyf_strip_hints_invalid (void)
hb_subset_input_set_flag (input, HB_SUBSET_FLAG_HINTING, false);
hb_set_destroy (codepoints);
face_subset = hb_subset_test_create_subset (face, input);
g_assert (face_subset);
g_assert (face_subset == hb_face_get_empty ());
face_subset = hb_subset_or_fail (face, input);
g_assert (!face_subset);
hb_face_destroy (face_subset);
hb_subset_input_destroy (input);
hb_face_destroy (face);
}

View File

@ -82,9 +82,8 @@ test_subset_hdmx_invalid (void)
hb_set_add (codepoints, 'b');
hb_set_add (codepoints, 'c');
subset = hb_subset (face, input);
g_assert (subset);
g_assert (subset == hb_face_get_empty ());
subset = hb_subset_or_fail (face, input);
g_assert (!subset);
hb_subset_input_destroy (input);
hb_face_destroy (subset);

View File

@ -162,9 +162,8 @@ test_subset_invalid_hmtx (void)
hb_set_add (codepoints, 'b');
hb_set_add (codepoints, 'c');
subset = hb_subset (face, input);
g_assert (subset);
g_assert (subset == hb_face_get_empty ());
subset = hb_subset_or_fail (face, input);
g_assert (!subset);
hb_subset_input_destroy (input);
hb_face_destroy (subset);

View File

@ -42,7 +42,7 @@ test_subset_32_tables (void)
hb_set_add (codepoints, 'b');
hb_set_add (codepoints, 'c');
subset = hb_subset (face, input);
subset = hb_subset_or_fail (face, input);
g_assert (subset);
g_assert (subset != hb_face_get_empty ());
@ -64,9 +64,8 @@ test_subset_no_inf_loop (void)
hb_set_add (codepoints, 'b');
hb_set_add (codepoints, 'c');
subset = hb_subset (face, input);
g_assert (subset);
g_assert (subset == hb_face_get_empty ());
subset = hb_subset_or_fail (face, input);
g_assert (!subset);
hb_subset_input_destroy (input);
hb_face_destroy (subset);
@ -86,9 +85,8 @@ test_subset_crash (void)
hb_set_add (codepoints, 'b');
hb_set_add (codepoints, 'c');
subset = hb_subset (face, input);
g_assert (subset);
g_assert (subset == hb_face_get_empty ());
subset = hb_subset_or_fail (face, input);
g_assert (!subset);
hb_subset_input_destroy (input);
hb_face_destroy (subset);

View File

@ -31,7 +31,8 @@ trySubset (hb_face_t *face,
for (int i = 0; i < text_length; i++)
hb_set_add (codepoints, text[i]);
hb_face_t *result = hb_subset (face, input);
hb_face_t *result = hb_subset_or_fail (face, input);
if (result)
{
hb_blob_t *blob = hb_face_reference_blob (result);
unsigned int length;