< prev index next >
src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ucdn.cc
Print this page
*** 12,24 ****
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
! #include "hb-private.hh"
! #include "hb-unicode-private.hh"
#include "ucdn.h"
static const hb_script_t ucdn_script_translate[] =
{
--- 12,24 ----
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
! #include "hb.hh"
! #include "hb-machinery.hh"
#include "ucdn.h"
static const hb_script_t ucdn_script_translate[] =
{
*** 179,197 ****
void *user_data HB_UNUSED)
{
return (hb_unicode_combining_class_t) ucdn_get_combining_class(unicode);
}
- static unsigned int
- hb_ucdn_eastasian_width(hb_unicode_funcs_t *ufuncs HB_UNUSED,
- hb_codepoint_t unicode,
- void *user_data HB_UNUSED)
- {
- int w = ucdn_get_east_asian_width(unicode);
- return (w == UCDN_EAST_ASIAN_F || w == UCDN_EAST_ASIAN_W) ? 2 : 1;
- }
-
static hb_unicode_general_category_t
hb_ucdn_general_category(hb_unicode_funcs_t *ufuncs HB_UNUSED,
hb_codepoint_t unicode,
void *user_data HB_UNUSED)
{
--- 179,188 ----
*** 228,285 ****
void *user_data HB_UNUSED)
{
return ucdn_decompose(ab, a, b);
}
- static unsigned int
- hb_ucdn_decompose_compatibility(hb_unicode_funcs_t *ufuncs HB_UNUSED,
- hb_codepoint_t u, hb_codepoint_t *decomposed,
- void *user_data HB_UNUSED)
- {
- return ucdn_compat_decompose(u, decomposed);
- }
-
- static hb_unicode_funcs_t *static_ucdn_funcs = nullptr;
-
- #ifdef HB_USE_ATEXIT
- static
- void free_static_ucdn_funcs (void)
- {
- retry:
- hb_unicode_funcs_t *ucdn_funcs = (hb_unicode_funcs_t *) hb_atomic_ptr_get (&static_ucdn_funcs);
- if (!hb_atomic_ptr_cmpexch (&static_ucdn_funcs, ucdn_funcs, nullptr))
- goto retry;
! hb_unicode_funcs_destroy (ucdn_funcs);
! }
#endif
! extern "C" HB_INTERNAL
! hb_unicode_funcs_t *
! hb_ucdn_get_unicode_funcs (void)
{
! retry:
! hb_unicode_funcs_t *funcs = (hb_unicode_funcs_t *) hb_atomic_ptr_get (&static_ucdn_funcs);
!
! if (unlikely (!funcs))
{
! funcs = hb_unicode_funcs_create (nullptr);
! #define HB_UNICODE_FUNC_IMPLEMENT(name) \
! hb_unicode_funcs_set_##name##_func (funcs, hb_ucdn_##name, nullptr, nullptr);
! HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
! #undef HB_UNICODE_FUNC_IMPLEMENT
hb_unicode_funcs_make_immutable (funcs);
! if (!hb_atomic_ptr_cmpexch (&static_ucdn_funcs, nullptr, funcs)) {
! hb_unicode_funcs_destroy (funcs);
! goto retry;
}
! #ifdef HB_USE_ATEXIT
! atexit (free_static_ucdn_funcs); /* First person registers atexit() callback. */
#endif
- };
! return hb_unicode_funcs_reference (funcs);
}
--- 219,268 ----
void *user_data HB_UNUSED)
{
return ucdn_decompose(ab, a, b);
}
! #if HB_USE_ATEXIT
! static void free_static_ucdn_funcs ();
#endif
! static struct hb_ucdn_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_t<hb_ucdn_unicode_funcs_lazy_loader_t>
{
! static hb_unicode_funcs_t *create ()
{
! hb_unicode_funcs_t *funcs = hb_unicode_funcs_create (nullptr);
! hb_unicode_funcs_set_combining_class_func (funcs, hb_ucdn_combining_class, nullptr, nullptr);
! hb_unicode_funcs_set_general_category_func (funcs, hb_ucdn_general_category, nullptr, nullptr);
! hb_unicode_funcs_set_mirroring_func (funcs, hb_ucdn_mirroring, nullptr, nullptr);
! hb_unicode_funcs_set_script_func (funcs, hb_ucdn_script, nullptr, nullptr);
! hb_unicode_funcs_set_compose_func (funcs, hb_ucdn_compose, nullptr, nullptr);
! hb_unicode_funcs_set_decompose_func (funcs, hb_ucdn_decompose, nullptr, nullptr);
hb_unicode_funcs_make_immutable (funcs);
! #if HB_USE_ATEXIT
! atexit (free_static_ucdn_funcs);
! #endif
!
! return funcs;
}
+ } static_ucdn_funcs;
! #if HB_USE_ATEXIT
! static
! void free_static_ucdn_funcs ()
! {
! static_ucdn_funcs.free_instance ();
! }
#endif
! extern "C" HB_INTERNAL
! hb_unicode_funcs_t *
! hb_ucdn_get_unicode_funcs ();
!
! hb_unicode_funcs_t *
! hb_ucdn_get_unicode_funcs ()
! {
! return static_ucdn_funcs.get_unconst ();
}
< prev index next >