< prev index next >
src/java.desktop/share/native/libfontmanager/harfbuzz/hb-unicode.cc
Print this page
*** 26,40 ****
* Red Hat Author(s): Behdad Esfahbod
* Codethink Author(s): Ryan Lortie
* Google Author(s): Behdad Esfahbod
*/
! #include "hb-private.hh"
! #include "hb-unicode-private.hh"
/*
* hb_unicode_funcs_t
*/
--- 26,54 ----
* Red Hat Author(s): Behdad Esfahbod
* Codethink Author(s): Ryan Lortie
* Google Author(s): Behdad Esfahbod
*/
! #include "hb.hh"
! #include "hb-unicode.hh"
+ /**
+ * SECTION: hb-unicode
+ * @title: hb-unicode
+ * @short_description: Unicode character property access
+ * @include: hb.h
+ *
+ * Unicode functions are used to access Unicode character properties.
+ * Client can pass its own Unicode functions to HarfBuzz, or access
+ * the built-in Unicode functions that come with HarfBuzz.
+ *
+ * With the Unicode functions, one can query variour Unicode character
+ * properties, such as General Category, Script, Combining Class, etc.
+ **/
+
/*
* hb_unicode_funcs_t
*/
*** 107,150 ****
{
return 0;
}
! #define HB_UNICODE_FUNCS_IMPLEMENT_SET \
! HB_UNICODE_FUNCS_IMPLEMENT (glib) \
! HB_UNICODE_FUNCS_IMPLEMENT (icu) \
! HB_UNICODE_FUNCS_IMPLEMENT (ucdn) \
! HB_UNICODE_FUNCS_IMPLEMENT (nil) \
! /* ^--- Add new callbacks before nil */
!
! #define hb_nil_get_unicode_funcs hb_unicode_funcs_get_empty
!
! /* Prototype them all */
! #define HB_UNICODE_FUNCS_IMPLEMENT(set) \
! extern "C" hb_unicode_funcs_t *hb_##set##_get_unicode_funcs (void);
! HB_UNICODE_FUNCS_IMPLEMENT_SET
! #undef HB_UNICODE_FUNCS_IMPLEMENT
!
hb_unicode_funcs_t *
! hb_unicode_funcs_get_default (void)
{
- #define HB_UNICODE_FUNCS_IMPLEMENT(set) \
- return hb_##set##_get_unicode_funcs ();
-
#if defined(HAVE_UCDN)
! HB_UNICODE_FUNCS_IMPLEMENT(ucdn)
#elif defined(HAVE_GLIB)
! HB_UNICODE_FUNCS_IMPLEMENT(glib)
#elif defined(HAVE_ICU) && defined(HAVE_ICU_BUILTIN)
! HB_UNICODE_FUNCS_IMPLEMENT(icu)
#else
#define HB_UNICODE_FUNCS_NIL 1
! HB_UNICODE_FUNCS_IMPLEMENT(nil)
#endif
-
- #undef HB_UNICODE_FUNCS_IMPLEMENT
}
#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-ucdn.c. If you absolutely want to build without any, check the code."
--- 121,147 ----
{
return 0;
}
! extern "C" hb_unicode_funcs_t *hb_glib_get_unicode_funcs ();
! extern "C" hb_unicode_funcs_t *hb_icu_get_unicode_funcs ();
! extern "C" hb_unicode_funcs_t *hb_ucdn_get_unicode_funcs ();
hb_unicode_funcs_t *
! hb_unicode_funcs_get_default ()
{
#if defined(HAVE_UCDN)
! return hb_ucdn_get_unicode_funcs ();
#elif defined(HAVE_GLIB)
! return hb_glib_get_unicode_funcs ();
#elif 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-ucdn.c. If you absolutely want to build without any, check the code."
*** 183,197 ****
return ufuncs;
}
! const hb_unicode_funcs_t _hb_unicode_funcs_nil = {
HB_OBJECT_HEADER_STATIC,
nullptr, /* parent */
- true, /* immutable */
{
#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_##name##_nil,
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_UNICODE_FUNC_IMPLEMENT
}
--- 180,194 ----
return ufuncs;
}
! DEFINE_NULL_INSTANCE (hb_unicode_funcs_t) =
! {
HB_OBJECT_HEADER_STATIC,
nullptr, /* parent */
{
#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_##name##_nil,
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_UNICODE_FUNC_IMPLEMENT
}
*** 205,217 ****
* Return value: (transfer full):
*
* Since: 0.9.2
**/
hb_unicode_funcs_t *
! hb_unicode_funcs_get_empty (void)
{
! return const_cast<hb_unicode_funcs_t *> (&_hb_unicode_funcs_nil);
}
/**
* hb_unicode_funcs_reference: (skip)
* @ufuncs: Unicode functions.
--- 202,214 ----
* Return value: (transfer full):
*
* Since: 0.9.2
**/
hb_unicode_funcs_t *
! hb_unicode_funcs_get_empty ()
{
! return const_cast<hb_unicode_funcs_t *> (&Null(hb_unicode_funcs_t));
}
/**
* hb_unicode_funcs_reference: (skip)
* @ufuncs: Unicode functions.
*** 303,316 ****
* Since: 0.9.2
**/
void
hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs)
{
! if (unlikely (hb_object_is_inert (ufuncs)))
return;
! ufuncs->immutable = true;
}
/**
* hb_unicode_funcs_is_immutable:
* @ufuncs: Unicode functions.
--- 300,313 ----
* 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: Unicode functions.
*** 322,332 ****
* Since: 0.9.2
**/
hb_bool_t
hb_unicode_funcs_is_immutable (hb_unicode_funcs_t *ufuncs)
{
! return ufuncs->immutable;
}
/**
* hb_unicode_funcs_get_parent:
* @ufuncs: Unicode functions.
--- 319,329 ----
* 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: Unicode functions.
*** 350,360 ****
hb_unicode_funcs_set_##name##_func (hb_unicode_funcs_t *ufuncs, \
hb_unicode_##name##_func_t func, \
void *user_data, \
hb_destroy_func_t destroy) \
{ \
! if (ufuncs->immutable) \
return; \
\
if (ufuncs->destroy.name) \
ufuncs->destroy.name (ufuncs->user_data.name); \
\
--- 347,357 ----
hb_unicode_funcs_set_##name##_func (hb_unicode_funcs_t *ufuncs, \
hb_unicode_##name##_func_t func, \
void *user_data, \
hb_destroy_func_t destroy) \
{ \
! if (hb_object_is_immutable (ufuncs)) \
return; \
\
if (ufuncs->destroy.name) \
ufuncs->destroy.name (ufuncs->user_data.name); \
\
*** 437,457 ****
*
*
* Return value:
*
* Since: 0.9.2
**/
unsigned int
hb_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t u,
hb_codepoint_t *decomposed)
{
return ufuncs->decompose_compatibility (u, decomposed);
}
! /* See hb-unicode-private.hh for details. */
const uint8_t
_hb_modified_combining_class[256] =
{
0, /* HB_UNICODE_COMBINING_CLASS_NOT_REORDERED */
1, /* HB_UNICODE_COMBINING_CLASS_OVERLAY */
--- 434,455 ----
*
*
* Return value:
*
* Since: 0.9.2
+ * Deprecated: 2.0.0
**/
unsigned int
hb_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t u,
hb_codepoint_t *decomposed)
{
return ufuncs->decompose_compatibility (u, decomposed);
}
! /* See hb-unicode.hh for details. */
const uint8_t
_hb_modified_combining_class[256] =
{
0, /* HB_UNICODE_COMBINING_CLASS_NOT_REORDERED */
1, /* HB_UNICODE_COMBINING_CLASS_OVERLAY */
*** 559,563 ****
--- 557,577 ----
235, 236, 237, 238, 239,
240, /* HB_UNICODE_COMBINING_CLASS_IOTA_SUBSCRIPT */
241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
255, /* HB_UNICODE_COMBINING_CLASS_INVALID */
};
+
+
+ /*
+ * Emoji
+ */
+
+ #include "hb-unicode-emoji-table.hh"
+
+ bool
+ _hb_unicode_is_emoji_Extended_Pictographic (hb_codepoint_t cp)
+ {
+ return hb_bsearch (&cp, _hb_unicode_emoji_Extended_Pictographic_table,
+ ARRAY_LENGTH (_hb_unicode_emoji_Extended_Pictographic_table),
+ sizeof (hb_unicode_range_t),
+ hb_unicode_range_t::cmp);
+ }
< prev index next >