[subset] add subset plan reference, set/get user data functions.
This commit is contained in:
parent
b65e48a786
commit
ae8d373bcf
|
@ -641,3 +641,62 @@ hb_subset_plan_codepoint_to_old_glyph_mapping (const hb_subset_plan_t *plan)
|
||||||
{
|
{
|
||||||
return plan->codepoint_to_glyph;
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -349,7 +349,7 @@ hb_subset_or_fail (hb_face_t *source, const hb_subset_input_t *input)
|
||||||
return nullptr;
|
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);
|
hb_subset_plan_destroy (plan);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -365,7 +365,7 @@ hb_subset_or_fail (hb_face_t *source, const hb_subset_input_t *input)
|
||||||
* Since: REPLACEME
|
* Since: REPLACEME
|
||||||
**/
|
**/
|
||||||
hb_face_t *
|
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 ())) {
|
if (unlikely (plan->in_error ())) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -133,7 +133,7 @@ hb_subset_input_set_user_data (hb_subset_input_t *input,
|
||||||
|
|
||||||
HB_EXTERN void *
|
HB_EXTERN void *
|
||||||
hb_subset_input_get_user_data (const hb_subset_input_t *input,
|
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_EXTERN hb_set_t *
|
||||||
hb_subset_input_unicode_set (hb_subset_input_t *input);
|
hb_subset_input_unicode_set (hb_subset_input_t *input);
|
||||||
|
@ -155,10 +155,10 @@ HB_EXTERN hb_face_t *
|
||||||
hb_subset_or_fail (hb_face_t *source, const hb_subset_input_t *input);
|
hb_subset_or_fail (hb_face_t *source, const hb_subset_input_t *input);
|
||||||
|
|
||||||
HB_EXTERN hb_face_t *
|
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_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);
|
const hb_subset_input_t *input);
|
||||||
|
|
||||||
HB_EXTERN void
|
HB_EXTERN void
|
||||||
|
@ -173,6 +173,22 @@ hb_subset_plan_new_to_old_glyph_mapping (const hb_subset_plan_t *plan);
|
||||||
HB_EXTERN const hb_map_t*
|
HB_EXTERN const hb_map_t*
|
||||||
hb_subset_plan_codepoint_to_old_glyph_mapping (const hb_subset_plan_t *plan);
|
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
|
HB_END_DECLS
|
||||||
|
|
||||||
#endif /* HB_SUBSET_H */
|
#endif /* HB_SUBSET_H */
|
||||||
|
|
|
@ -180,7 +180,7 @@ test_subset_plan (void)
|
||||||
mapping = hb_subset_plan_codepoint_to_old_glyph_mapping (plan);
|
mapping = hb_subset_plan_codepoint_to_old_glyph_mapping (plan);
|
||||||
g_assert (hb_map_get (mapping, 0x63) == 3);
|
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 ('l','o','c', 'a'));
|
||||||
hb_subset_test_check (face_ac, face_abc_subset, HB_TAG ('g','l','y','f'));
|
hb_subset_test_check (face_ac, face_abc_subset, HB_TAG ('g','l','y','f'));
|
||||||
|
|
Loading…
Reference in New Issue