From 2663a9b6f98a4afebe43ee213c5c14af6c2c5ce5 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 31 Mar 2023 17:38:23 -0600 Subject: [PATCH] [wasm] Rename a couple APIs --- src/hb-wasm-api-blob.hh | 20 -------------------- src/hb-wasm-api-face.hh | 27 ++++++++++++++++++--------- src/hb-wasm-api-font.hh | 11 +++++++++++ src/hb-wasm-api-list.hh | 4 ++-- src/hb-wasm-api.h | 10 +++++----- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/hb-wasm-api-blob.hh b/src/hb-wasm-api-blob.hh index ee80c14ce..310f4023f 100644 --- a/src/hb-wasm-api-blob.hh +++ b/src/hb-wasm-api-blob.hh @@ -30,26 +30,6 @@ namespace hb { namespace wasm { -HB_WASM_API (ptr_t(face_t), blob_face_create) (HB_WASM_EXEC_ENV - ptr_d(blob_t, blob), - unsigned int index) -{ - HB_PTR_PARAM (blob_t, blob); - hb_blob_t *hb_blob = hb_blob_create( - HB_ARRAY_APP2NATIVE(char, blob->data, blob->length), - blob->length, - (hb_memory_mode_t)0, - NULL, - NULL - ); - - hb_face_t *face = hb_face_create(hb_blob, index); - - HB_OBJ2REF (face); - return faceref; -} - - HB_WASM_API (void, blob_free) (HB_WASM_EXEC_ENV ptr_d(blob_t, blob)) diff --git a/src/hb-wasm-api-face.hh b/src/hb-wasm-api-face.hh index b8d208066..e59cedc67 100644 --- a/src/hb-wasm-api-face.hh +++ b/src/hb-wasm-api-face.hh @@ -31,6 +31,24 @@ namespace hb { namespace wasm { +HB_WASM_API (ptr_t(face_t), face_create) (HB_WASM_EXEC_ENV + ptr_d(blob_t, blob), + unsigned int index) +{ + HB_PTR_PARAM (blob_t, blob); + hb_blob_t *hb_blob = hb_blob_create( + HB_ARRAY_APP2NATIVE (char, blob->data, blob->length), + blob->length, + HB_MEMORY_MODE_DUPLICATE, + NULL, + NULL); + + hb_face_t *face = hb_face_create(hb_blob, index); + + HB_OBJ2REF (face); + return faceref; +} + HB_WASM_API (bool_t, face_copy_table) (HB_WASM_EXEC_ENV ptr_d(face_t, face), tag_t table_tag, @@ -85,16 +103,7 @@ HB_WASM_API (unsigned, face_get_upem) (HB_WASM_EXEC_ENV return hb_face_get_upem (face); } -HB_WASM_API (ptr_t(font_t), face_create_font) (HB_WASM_EXEC_ENV - ptr_d(face_t, face)) -{ - HB_REF2OBJ (face); - hb_font_t *font = hb_font_create (face); - - HB_OBJ2REF (font); - return fontref; -} }} #endif /* HB_WASM_API_FACE_HH */ diff --git a/src/hb-wasm-api-font.hh b/src/hb-wasm-api-font.hh index cda3b9ea9..9c004a110 100644 --- a/src/hb-wasm-api-font.hh +++ b/src/hb-wasm-api-font.hh @@ -33,6 +33,17 @@ namespace hb { namespace wasm { +HB_WASM_API (ptr_t(font_t), font_create) (HB_WASM_EXEC_ENV + ptr_d(face_t, face)) +{ + HB_REF2OBJ (face); + + hb_font_t *font = hb_font_create (face); + + HB_OBJ2REF (font); + return fontref; +} + HB_WASM_API (ptr_t(face_t), font_get_face) (HB_WASM_EXEC_ENV ptr_d(font_t, font)) { diff --git a/src/hb-wasm-api-list.hh b/src/hb-wasm-api-list.hh index 8674eb124..5db45c74c 100644 --- a/src/hb-wasm-api-list.hh +++ b/src/hb-wasm-api-list.hh @@ -57,7 +57,6 @@ static NativeSymbol _hb_wasm_native_symbols[] = NATIVE_SYMBOL ("(i)i", script_get_horizontal_direction), /* blob */ - NATIVE_SYMBOL ("(ii)i", blob_face_create), NATIVE_SYMBOL ("(i)", blob_free), /* buffer */ @@ -71,11 +70,12 @@ static NativeSymbol _hb_wasm_native_symbols[] = NATIVE_SYMBOL ("(i)", buffer_reverse_clusters), /* face */ + NATIVE_SYMBOL ("(ii)i", face_create), NATIVE_SYMBOL ("(iii)i", face_copy_table), NATIVE_SYMBOL ("(i)i", face_get_upem), - NATIVE_SYMBOL ("(i)i", face_create_font), /* font */ + NATIVE_SYMBOL ("(i)i", font_create), NATIVE_SYMBOL ("(i)i", font_get_face), NATIVE_SYMBOL ("(iii)", font_get_scale), NATIVE_SYMBOL ("(iii)i", font_get_glyph), diff --git a/src/hb-wasm-api.h b/src/hb-wasm-api.h index 8f1f04e73..f9bd98e5e 100644 --- a/src/hb-wasm-api.h +++ b/src/hb-wasm-api.h @@ -174,9 +174,9 @@ HB_WASM_API (void, buffer_reverse_clusters) (HB_WASM_EXEC_ENV typedef struct face_t face_t; -HB_WASM_API (ptr_t(face_t), blob_face_create) (HB_WASM_EXEC_ENV - ptr_d(blob_t, blob), - unsigned int); +HB_WASM_API (ptr_t(face_t), face_create) (HB_WASM_EXEC_ENV + ptr_d(blob_t, blob), + unsigned int); HB_WASM_API (bool_t, face_copy_table) (HB_WASM_EXEC_ENV ptr_d(face_t, face), @@ -190,8 +190,8 @@ HB_WASM_API (unsigned, face_get_upem) (HB_WASM_EXEC_ENV typedef struct font_t font_t; -HB_WASM_API (ptr_t(font_t), face_create_font) (HB_WASM_EXEC_ENV - ptr_d(face_t, face)); +HB_WASM_API (ptr_t(font_t), font_create) (HB_WASM_EXEC_ENV + ptr_d(face_t, face)); HB_WASM_API (ptr_t(face_t), font_get_face) (HB_WASM_EXEC_ENV ptr_d(font_t, font));