diff --git a/src/hb-glib.cc b/src/hb-glib.cc index af43cab71..61dff5e3d 100644 --- a/src/hb-glib.cc +++ b/src/hb-glib.cc @@ -382,3 +382,14 @@ hb_glib_get_unicode_funcs (void) return const_cast (&_hb_glib_unicode_funcs); } +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_destroy_func_t) g_bytes_unref); +} diff --git a/src/hb-glib.h b/src/hb-glib.h index 63a9d3366..1a8f42ea5 100644 --- a/src/hb-glib.h +++ b/src/hb-glib.h @@ -46,6 +46,9 @@ hb_glib_script_from_script (hb_script_t script); hb_unicode_funcs_t * hb_glib_get_unicode_funcs (void); +hb_blob_t * +hb_glib_blob_create (GBytes *gbytes); + HB_END_DECLS