/** * SECTION: hb-unicode * @title: hb-unicode * @short_description: Unicode character property access * @include: hb.h * * Unicode functions are used to access Unicode character properties. * With these functions, client programs can query various properties from * the Unicode Character Database for any code point, such as General * Category (gc), Script (sc), Canonical Combining Class (ccc), etc. * * Client programs can optionally pass in their own Unicode functions * that implement the same queries. The set of functions available is * defined by the virtual methods in #hb_unicode_funcs_t. * * HarfBuzz provides built-in default functions for each method in * #hb_unicode_funcs_t.
**/
/** * hb_unicode_funcs_get_default: * * Fetches a pointer to the default Unicode-functions structure that is used * when no functions are explicitly set on #hb_buffer_t. * * Return value: (transfer none): a pointer to the #hb_unicode_funcs_t Unicode-functions structure * * Since: 0.9.2
**/
hb_unicode_funcs_t *
hb_unicode_funcs_get_default ()
{ #if !defined(HB_NO_UNICODE_FUNCS) && !defined(HB_NO_UCD) return hb_ucd_get_unicode_funcs (); #elif !defined(HB_NO_UNICODE_FUNCS) && defined(HAVE_GLIB) return hb_glib_get_unicode_funcs (); #elif !defined(HB_NO_UNICODE_FUNCS) && defined(HAVE_ICU) && defined(HAVE_ICU_BUILTIN) return hb_icu_get_unicode_funcs (); #else #define HB_UNICODE_FUNCS_NIL 1 return hb_unicode_funcs_get_empty (); #endif
}
#if !defined(HB_NO_UNICODE_FUNCS) && defined(HB_UNICODE_FUNCS_NIL) #error"Could not find any Unicode functions implementation, you have to provide your own" #error"Consider building hb-ucd.cc. If you absolutely want to build without any, define HB_NO_UNICODE_FUNCS." #endif
/* We can safely copy user_data from parent since we hold a reference * onto it and it's immutable. We should not copy the destroy notifiers
* though. */
ufuncs->user_data = parent->user_data;
/** * hb_unicode_funcs_reference: (skip) * @ufuncs: The Unicode-functions structure * * Increases the reference count on a Unicode-functions structure. * * Return value: (transfer full): The Unicode-functions structure * * Since: 0.9.2
**/
hb_unicode_funcs_t *
hb_unicode_funcs_reference (hb_unicode_funcs_t *ufuncs)
{ return hb_object_reference (ufuncs);
}
/** * hb_unicode_funcs_destroy: (skip) * @ufuncs: The Unicode-functions structure * * Decreases the reference count on a Unicode-functions structure. When * the reference count reaches zero, the Unicode-functions structure is * destroyed, freeing all memory. * * Since: 0.9.2
**/ void
hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs)
{ if (!hb_object_destroy (ufuncs)) return;
#define HB_UNICODE_FUNC_IMPLEMENT(name) \ if (ufuncs->destroy.name) ufuncs->destroy.name (ufuncs->user_data.name);
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS #undef HB_UNICODE_FUNC_IMPLEMENT
hb_unicode_funcs_destroy (ufuncs->parent);
hb_free (ufuncs);
}
/** * hb_unicode_funcs_set_user_data: (skip) * @ufuncs: The Unicode-functions structure * @key: The user-data key * @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 specified Unicode-functions structure. * * Return value: `true` if success, `false` otherwise * * Since: 0.9.2
**/
hb_bool_t
hb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs,
hb_user_data_key_t *key, void * data,
hb_destroy_func_t destroy,
hb_bool_t replace)
{ return hb_object_set_user_data (ufuncs, key, data, destroy, replace);
}
/** * hb_unicode_funcs_get_user_data: (skip) * @ufuncs: The Unicode-functions structure * @key: The user-data key to query * * Fetches the user-data associated with the specified key, * attached to the specified Unicode-functions structure. * * Return value: (transfer none): A pointer to the user data * * Since: 0.9.2
**/ void *
hb_unicode_funcs_get_user_data (const hb_unicode_funcs_t *ufuncs,
hb_user_data_key_t *key)
{ return hb_object_get_user_data (ufuncs, key);
}
/** * hb_unicode_funcs_make_immutable: * @ufuncs: The Unicode-functions structure * * Makes the specified Unicode-functions structure * immutable. * * Since: 0.9.2
**/ void
hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs)
{ if (hb_object_is_immutable (ufuncs)) return;
hb_object_make_immutable (ufuncs);
}
/** * hb_unicode_funcs_is_immutable: * @ufuncs: The Unicode-functions structure * * Tests whether the specified Unicode-functions structure * is immutable. * * Return value: `true` if @ufuncs is immutable, `false` otherwise * * Since: 0.9.2
**/
hb_bool_t
hb_unicode_funcs_is_immutable (hb_unicode_funcs_t *ufuncs)
{ return hb_object_is_immutable (ufuncs);
}
/** * hb_unicode_funcs_get_parent: * @ufuncs: The Unicode-functions structure * * Fetches the parent of the Unicode-functions structure * @ufuncs. * * Return value: The parent Unicode-functions structure * * Since: 0.9.2
**/
hb_unicode_funcs_t *
hb_unicode_funcs_get_parent (hb_unicode_funcs_t *ufuncs)
{ return ufuncs->parent ? ufuncs->parent : hb_unicode_funcs_get_empty ();
}
/** * hb_unicode_compose: * @ufuncs: The Unicode-functions structure * @a: The first Unicode code point to compose * @b: The second Unicode code point to compose * @ab: (out): The composition of @a, @b * * Fetches the composition of a sequence of two Unicode * code points. * * Calls the composition function of the specified * Unicode-functions structure @ufuncs. * * Return value: `true` if @a and @b composed, `false` otherwise * * Since: 0.9.2
**/
hb_bool_t
hb_unicode_compose (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t a,
hb_codepoint_t b,
hb_codepoint_t *ab)
{ return ufuncs->compose (a, b, ab);
}
/** * hb_unicode_decompose: * @ufuncs: The Unicode-functions structure * @ab: Unicode code point to decompose * @a: (out): The first code point of the decomposition of @ab * @b: (out): The second code point of the decomposition of @ab * * Fetches the decomposition of a Unicode code point. * * Calls the decomposition function of the specified * Unicode-functions structure @ufuncs. * * Return value: `true` if @ab was decomposed, `false` otherwise * * Since: 0.9.2
**/
hb_bool_t
hb_unicode_decompose (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t ab,
hb_codepoint_t *a,
hb_codepoint_t *b)
{ return ufuncs->decompose (ab, a, b);
}
#ifndef HB_DISABLE_DEPRECATED /** * hb_unicode_decompose_compatibility: * @ufuncs: The Unicode-functions structure * @u: Code point to decompose * @decomposed: (out): Compatibility decomposition of @u * * Fetches the compatibility decomposition of a Unicode * code point. Deprecated. * * Return value: length of @decomposed. * * Since: 0.9.2 * Deprecated: 2.0.0
**/ unsignedint
hb_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t u,
hb_codepoint_t *decomposed)
{ return ufuncs->decompose_compatibility (u, decomposed);
} #endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.