[subset] add subset plan reference, set/get user data functions.
diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc
index aca96bf..8a94031 100644
--- a/src/hb-subset-plan.cc
+++ b/src/hb-subset-plan.cc
@@ -641,3 +641,62 @@
{
return plan->codepoint_to_glyph;
}
+
+/**
+ * hb_subset_plan_reference: (skip)
+ * @plan: a #hb_subset_plan_t object.
+ *
+ * Increases the reference count on @plan.
+ *
+ * Return value: @plan.
+ *
+ * Since: REPLACEME
+ **/
+hb_subset_plan_t *
+hb_subset_plan_reference (hb_subset_plan_t *plan)
+{
+ return hb_object_reference (plan);
+}
+
+/**
+ * hb_subset_plan_set_user_data: (skip)
+ * @plan: a #hb_subset_plan_t 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 plan object.
+ *
+ * Return value: %true if success, %false otherwise
+ *
+ * Since: REPLACEME
+ **/
+hb_bool_t
+hb_subset_plan_set_user_data (hb_subset_plan_t *plan,
+ hb_user_data_key_t *key,
+ void *data,
+ hb_destroy_func_t destroy,
+ hb_bool_t replace)
+{
+ return hb_object_set_user_data (plan, key, data, destroy, replace);
+}
+
+/**
+ * hb_subset_plan_get_user_data: (skip)
+ * @plan: a #hb_subset_plan_t object.
+ * @key: The user-data key to query
+ *
+ * Fetches the user data associated with the specified key,
+ * attached to the specified subset plan object.
+ *
+ * Return value: (transfer none): A pointer to the user data
+ *
+ * Since: REPLACEME
+ **/
+void *
+hb_subset_plan_get_user_data (const hb_subset_plan_t *plan,
+ hb_user_data_key_t *key)
+{
+ return hb_object_get_user_data (plan, key);
+}
diff --git a/src/hb-subset.cc b/src/hb-subset.cc
index a45e57f..292229c 100644
--- a/src/hb-subset.cc
+++ b/src/hb-subset.cc
@@ -349,7 +349,7 @@
return nullptr;
}
- hb_face_t * result = hb_subset_from_plan_or_fail (plan);
+ hb_face_t * result = hb_subset_plan_execute_or_fail (plan);
hb_subset_plan_destroy (plan);
return result;
}
@@ -365,7 +365,7 @@
* Since: REPLACEME
**/
hb_face_t *
-hb_subset_from_plan_or_fail (hb_subset_plan_t *plan)
+hb_subset_plan_execute_or_fail (hb_subset_plan_t *plan)
{
if (unlikely (plan->in_error ())) {
return nullptr;
diff --git a/src/hb-subset.h b/src/hb-subset.h
index 919c4e7..4872d89 100644
--- a/src/hb-subset.h
+++ b/src/hb-subset.h
@@ -133,7 +133,7 @@
HB_EXTERN void *
hb_subset_input_get_user_data (const hb_subset_input_t *input,
- hb_user_data_key_t *key);
+ hb_user_data_key_t *key);
HB_EXTERN hb_set_t *
hb_subset_input_unicode_set (hb_subset_input_t *input);
@@ -155,10 +155,10 @@
hb_subset_or_fail (hb_face_t *source, const hb_subset_input_t *input);
HB_EXTERN hb_face_t *
-hb_subset_from_plan_or_fail (hb_subset_plan_t *plan);
+hb_subset_plan_execute_or_fail (hb_subset_plan_t *plan);
HB_EXTERN hb_subset_plan_t *
-hb_subset_plan_create (hb_face_t *face,
+hb_subset_plan_create (hb_face_t *face,
const hb_subset_input_t *input);
HB_EXTERN void
@@ -173,6 +173,22 @@
HB_EXTERN const hb_map_t*
hb_subset_plan_codepoint_to_old_glyph_mapping (const hb_subset_plan_t *plan);
+
+HB_EXTERN hb_subset_plan_t *
+hb_subset_plan_reference (hb_subset_plan_t *plan);
+
+HB_EXTERN hb_bool_t
+hb_subset_plan_set_user_data (hb_subset_plan_t *plan,
+ hb_user_data_key_t *key,
+ void *data,
+ hb_destroy_func_t destroy,
+ hb_bool_t replace);
+
+HB_EXTERN void *
+hb_subset_plan_get_user_data (const hb_subset_plan_t *plan,
+ hb_user_data_key_t *key);
+
+
HB_END_DECLS
#endif /* HB_SUBSET_H */
diff --git a/test/api/test-subset.c b/test/api/test-subset.c
index a4211dc..1dcc5ff 100644
--- a/test/api/test-subset.c
+++ b/test/api/test-subset.c
@@ -180,7 +180,7 @@
mapping = hb_subset_plan_codepoint_to_old_glyph_mapping (plan);
g_assert (hb_map_get (mapping, 0x63) == 3);
- hb_face_t* face_abc_subset = hb_subset_from_plan_or_fail (plan);
+ hb_face_t* face_abc_subset = hb_subset_plan_execute_or_fail (plan);
hb_subset_test_check (face_ac, face_abc_subset, HB_TAG ('l','o','c', 'a'));
hb_subset_test_check (face_ac, face_abc_subset, HB_TAG ('g','l','y','f'));