Loading gfx/harfbuzz/src/hb-glib.cc +53 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ **/ #if !GLIB_CHECK_VERSION(2,29,14) static const hb_script_t glib_script_to_script[] = { Loading Loading @@ -170,6 +171,7 @@ glib_script_to_script[] = HB_SCRIPT_SORA_SOMPENG, HB_SCRIPT_TAKRI }; #endif /** * hb_glib_script_to_script: Loading @@ -185,6 +187,9 @@ glib_script_to_script[] = hb_script_t hb_glib_script_to_script (GUnicodeScript script) { #if GLIB_CHECK_VERSION(2,29,14) return (hb_script_t) g_unicode_script_to_iso15924 (script); #else if (likely ((unsigned int) script < ARRAY_LENGTH (glib_script_to_script))) return glib_script_to_script[script]; Loading @@ -192,6 +197,7 @@ hb_glib_script_to_script (GUnicodeScript script) return HB_SCRIPT_INVALID; return HB_SCRIPT_UNKNOWN; #endif } /** Loading @@ -208,6 +214,9 @@ hb_glib_script_to_script (GUnicodeScript script) GUnicodeScript hb_glib_script_from_script (hb_script_t script) { #if GLIB_CHECK_VERSION(2,29,14) return g_unicode_script_from_iso15924 (script); #else unsigned int count = ARRAY_LENGTH (glib_script_to_script); for (unsigned int i = 0; i < count; i++) if (glib_script_to_script[i] == script) Loading @@ -217,6 +226,7 @@ hb_glib_script_from_script (hb_script_t script) return G_UNICODE_SCRIPT_INVALID_CODE; return G_UNICODE_SCRIPT_UNKNOWN; #endif } Loading Loading @@ -263,6 +273,10 @@ hb_glib_unicode_compose (hb_unicode_funcs_t *ufuncs HB_UNUSED, hb_codepoint_t *ab, void *user_data HB_UNUSED) { #if GLIB_CHECK_VERSION(2,29,12) return g_unichar_compose (a, b, ab); #endif /* We don't ifdef-out the fallback code such that compiler always * sees it and makes sure it's compilable. */ Loading Loading @@ -296,6 +310,10 @@ hb_glib_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED, hb_codepoint_t *b, void *user_data HB_UNUSED) { #if GLIB_CHECK_VERSION(2,29,12) return g_unichar_decompose (ab, a, b); #endif /* We don't ifdef-out the fallback code such that compiler always * sees it and makes sure it's compilable. */ Loading Loading @@ -397,4 +415,39 @@ hb_glib_get_unicode_funcs () return static_glib_funcs.get_unconst (); } #if GLIB_CHECK_VERSION(2,31,10) static void _hb_g_bytes_unref (void *data) { g_bytes_unref ((GBytes *) data); } /** * hb_glib_blob_create: * @gbytes: the GBytes structure to work upon * * Creates an #hb_blob_t blob from the specified * GBytes data structure. * * Return value: (transfer full): the new #hb_blob_t blob object * * Since: 0.9.38 **/ hb_blob_t * hb_glib_blob_create (GBytes *gbytes) { gsize size = 0; gconstpointer data = g_bytes_get_data (gbytes, &size); return hb_blob_create ((const char *) data, size, HB_MEMORY_MODE_READONLY, g_bytes_ref (gbytes), _hb_g_bytes_unref); } #endif #endif gfx/harfbuzz/src/hb-glib.h +5 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,11 @@ hb_glib_script_from_script (hb_script_t script); HB_EXTERN hb_unicode_funcs_t * hb_glib_get_unicode_funcs (void); #if GLIB_CHECK_VERSION(2,31,10) HB_EXTERN hb_blob_t * hb_glib_blob_create (GBytes *gbytes); #endif HB_END_DECLS #endif /* HB_GLIB_H */ Loading
gfx/harfbuzz/src/hb-glib.cc +53 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ **/ #if !GLIB_CHECK_VERSION(2,29,14) static const hb_script_t glib_script_to_script[] = { Loading Loading @@ -170,6 +171,7 @@ glib_script_to_script[] = HB_SCRIPT_SORA_SOMPENG, HB_SCRIPT_TAKRI }; #endif /** * hb_glib_script_to_script: Loading @@ -185,6 +187,9 @@ glib_script_to_script[] = hb_script_t hb_glib_script_to_script (GUnicodeScript script) { #if GLIB_CHECK_VERSION(2,29,14) return (hb_script_t) g_unicode_script_to_iso15924 (script); #else if (likely ((unsigned int) script < ARRAY_LENGTH (glib_script_to_script))) return glib_script_to_script[script]; Loading @@ -192,6 +197,7 @@ hb_glib_script_to_script (GUnicodeScript script) return HB_SCRIPT_INVALID; return HB_SCRIPT_UNKNOWN; #endif } /** Loading @@ -208,6 +214,9 @@ hb_glib_script_to_script (GUnicodeScript script) GUnicodeScript hb_glib_script_from_script (hb_script_t script) { #if GLIB_CHECK_VERSION(2,29,14) return g_unicode_script_from_iso15924 (script); #else unsigned int count = ARRAY_LENGTH (glib_script_to_script); for (unsigned int i = 0; i < count; i++) if (glib_script_to_script[i] == script) Loading @@ -217,6 +226,7 @@ hb_glib_script_from_script (hb_script_t script) return G_UNICODE_SCRIPT_INVALID_CODE; return G_UNICODE_SCRIPT_UNKNOWN; #endif } Loading Loading @@ -263,6 +273,10 @@ hb_glib_unicode_compose (hb_unicode_funcs_t *ufuncs HB_UNUSED, hb_codepoint_t *ab, void *user_data HB_UNUSED) { #if GLIB_CHECK_VERSION(2,29,12) return g_unichar_compose (a, b, ab); #endif /* We don't ifdef-out the fallback code such that compiler always * sees it and makes sure it's compilable. */ Loading Loading @@ -296,6 +310,10 @@ hb_glib_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED, hb_codepoint_t *b, void *user_data HB_UNUSED) { #if GLIB_CHECK_VERSION(2,29,12) return g_unichar_decompose (ab, a, b); #endif /* We don't ifdef-out the fallback code such that compiler always * sees it and makes sure it's compilable. */ Loading Loading @@ -397,4 +415,39 @@ hb_glib_get_unicode_funcs () return static_glib_funcs.get_unconst (); } #if GLIB_CHECK_VERSION(2,31,10) static void _hb_g_bytes_unref (void *data) { g_bytes_unref ((GBytes *) data); } /** * hb_glib_blob_create: * @gbytes: the GBytes structure to work upon * * Creates an #hb_blob_t blob from the specified * GBytes data structure. * * Return value: (transfer full): the new #hb_blob_t blob object * * Since: 0.9.38 **/ hb_blob_t * hb_glib_blob_create (GBytes *gbytes) { gsize size = 0; gconstpointer data = g_bytes_get_data (gbytes, &size); return hb_blob_create ((const char *) data, size, HB_MEMORY_MODE_READONLY, g_bytes_ref (gbytes), _hb_g_bytes_unref); } #endif #endif
gfx/harfbuzz/src/hb-glib.h +5 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,11 @@ hb_glib_script_from_script (hb_script_t script); HB_EXTERN hb_unicode_funcs_t * hb_glib_get_unicode_funcs (void); #if GLIB_CHECK_VERSION(2,31,10) HB_EXTERN hb_blob_t * hb_glib_blob_create (GBytes *gbytes); #endif HB_END_DECLS #endif /* HB_GLIB_H */