From b38e49dcfa8c8cf11b4586ce93784ce7523b5f48 Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Wed, 9 Jun 2021 10:57:58 -0700 Subject: [PATCH] [subset] add get/set user data methods to subset input. --- src/hb-subset-input.cc | 42 ++++++++++++++++++++++++++++++++++++++++++ src/hb-subset.h | 10 ++++++++++ 2 files changed, 52 insertions(+) diff --git a/src/hb-subset-input.cc b/src/hb-subset-input.cc index f56d8a468..8917f87f0 100644 --- a/src/hb-subset-input.cc +++ b/src/hb-subset-input.cc @@ -378,3 +378,45 @@ hb_subset_input_get_no_prune_unicode_ranges (hb_subset_input_t *subset_input) return subset_input->no_prune_unicode_ranges; } +/** + * hb_subset_input_set_user_data: (skip) + * @face: A subset input object + * @key: The user-data key to set + * @data: A pointer to the user data + * @destroy: (nullable): A callback to call when @data is not needed anymore + * @replace: Whether to replace an existing data with the same key + * + * Attaches a user-data key/data pair to the given subset input object. + * + * Return value: %true if success, %false otherwise + * + * Since: REPLACE + **/ +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) +{ + return hb_object_set_user_data (input, key, data, destroy, replace); +} + +/** + * hb_subset_input_get_user_data: (skip) + * @face: A subset input object + * @key: The user-data key to query + * + * Fetches the user data associated with the specified key, + * attached to the specified subset input object. + * + * Return value: (transfer none): A pointer to the user data + * + * Since: REPLACE + **/ +void * +hb_subset_input_get_user_data (const hb_subset_input_t *input, + hb_user_data_key_t *key) +{ + return hb_object_get_user_data (input, key); +} diff --git a/src/hb-subset.h b/src/hb-subset.h index 1df8cfbbf..786dd1af5 100644 --- a/src/hb-subset.h +++ b/src/hb-subset.h @@ -121,6 +121,16 @@ hb_subset_input_get_no_prune_unicode_ranges (hb_subset_input_t *subset_input); HB_EXTERN hb_face_t * hb_subset (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