[subset] always return a valid face from hb_subset_preprocess.

This commit is contained in:
Garret Rieger 2022-12-05 19:40:49 +00:00
parent a80cae4453
commit 76d5482a7c
1 changed files with 7 additions and 0 deletions

View File

@ -464,6 +464,8 @@ HB_EXTERN hb_face_t *
hb_subset_preprocess (hb_face_t *source)
{
hb_subset_input_t* input = hb_subset_input_create_or_fail ();
if (!input)
return source;
hb_set_clear (hb_subset_input_set(input, HB_SUBSET_SETS_UNICODE));
hb_set_invert (hb_subset_input_set(input, HB_SUBSET_SETS_UNICODE));
@ -505,6 +507,11 @@ hb_subset_preprocess (hb_face_t *source)
hb_face_t* new_source = hb_subset_or_fail (source, input);
hb_subset_input_destroy (input);
if (!new_source) {
DEBUG_MSG (SUBSET, nullptr, "Preprocessing failed due to subset failure.");
return source;
}
return new_source;
}
#endif