406 static hb_script_t codePointToScript(hb_codepoint_t codepoint) {
407 static hb_unicode_funcs_t* u = 0;
408 if (!u) {
409 u = hb_icu_get_unicode_funcs();
410 }
411 return hb_unicode_script(u, codepoint);
412 }
423 hb_script_t
424 hb_unicode_script (hb_unicode_funcs_t *ufuncs,
425 hb_codepoint_t unicode);
347 hb_unicode_funcs_t *
348 hb_icu_get_unicode_funcs (void)
349 {
350 static const hb_unicode_funcs_t _hb_icu_unicode_funcs = {
351 HB_OBJECT_HEADER_STATIC,
352
353 NULL,
354 true,
355 {
356 #define HB_UNICODE_FUNC_IMPLEMENT(name) hb_icu_unicode_##name,
357 HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
358 #undef HB_UNICODE_FUNC_IMPLEMENT
359 }
360 };
361
362 #if U_ICU_VERSION_MAJOR_NUM >= 49
363 if (!hb_atomic_ptr_get (&normalizer)) {
364 UErrorCode icu_err = U_ZERO_ERROR;
365
366 hb_atomic_ptr_cmpexch (&normalizer, NULL, unorm2_getNFCInstance (&icu_err));
367 }
368 #endif
369 return const_cast<hb_unicode_funcs_t *> (&_hb_icu_unicode_funcs);
370 }
44 #define HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS \
45 HB_UNICODE_FUNC_IMPLEMENT (combining_class) \
46 HB_UNICODE_FUNC_IMPLEMENT (eastasian_width) \
47 HB_UNICODE_FUNC_IMPLEMENT (general_category) \
48 HB_UNICODE_FUNC_IMPLEMENT (mirroring) \
49 HB_UNICODE_FUNC_IMPLEMENT (script) \
50 HB_UNICODE_FUNC_IMPLEMENT (compose) \
51 HB_UNICODE_FUNC_IMPLEMENT (decompose) \
52 HB_UNICODE_FUNC_IMPLEMENT (decompose_compatibility) \
53