diff --git a/src/hb-wasm-api-buffer.hh b/src/hb-wasm-api-buffer.hh index 2130167b9..38ebf7c76 100644 --- a/src/hb-wasm-api-buffer.hh +++ b/src/hb-wasm-api-buffer.hh @@ -35,7 +35,7 @@ namespace wasm { void buffer_copy_contents (HB_WASM_EXEC_ENV_COMPOUND - buffer_t bufferref) + ptr_t(buffer_t) bufferref) { HB_RETURN_TYPE (buffer_contents_t, ret); HB_REF2OBJ (buffer); diff --git a/src/hb-wasm-api-face.hh b/src/hb-wasm-api-face.hh index 1e6dcece1..bd7d0bb02 100644 --- a/src/hb-wasm-api-face.hh +++ b/src/hb-wasm-api-face.hh @@ -33,7 +33,7 @@ namespace wasm { void face_reference_table (HB_WASM_EXEC_ENV_COMPOUND - face_t faceref, + ptr_t(face_t) faceref, tag_t table_tag) { HB_RETURN_TYPE (blob_t, ret); diff --git a/src/hb-wasm-api-font.hh b/src/hb-wasm-api-font.hh index d077b4857..e495e8acd 100644 --- a/src/hb-wasm-api-font.hh +++ b/src/hb-wasm-api-font.hh @@ -31,9 +31,9 @@ namespace hb { namespace wasm { -face_t +ptr_t(face_t) font_get_face (HB_WASM_EXEC_ENV - font_t fontref) + ptr_t(font_t) fontref) { HB_REF2OBJ (font); diff --git a/src/hb-wasm-api.h b/src/hb-wasm-api.h index f919fc0d8..25bd0fc30 100644 --- a/src/hb-wasm-api.h +++ b/src/hb-wasm-api.h @@ -65,9 +65,6 @@ HB_WASM_BEGIN_DECLS #ifndef bool_t #define bool_t uint32_t #endif -#ifndef ref_t -#define ref_t uint32_t -#endif #ifndef ptr_t #define ptr_t(type_t) type_t * #endif @@ -78,10 +75,6 @@ typedef uint32_t hb_mask_t; typedef uint32_t tag_t; #define TAG(c1,c2,c3,c4) ((tag_t)((((uint32_t)(c1)&0xFF)<<24)|(((uint32_t)(c2)&0xFF)<<16)|(((uint32_t)(c3)&0xFF)<<8)|((uint32_t)(c4)&0xFF))) -typedef ref_t face_t; -typedef ref_t font_t; -typedef ref_t buffer_t; - /* blob */ @@ -124,28 +117,34 @@ typedef struct /* TODO buffer_contents_free */ +typedef struct buffer_t buffer_t; + HB_WASM_API_COMPOUND (buffer_contents_t, buffer_copy_contents) (HB_WASM_EXEC_ENV_COMPOUND - buffer_t bufferref); + ptr_t(buffer_t)); /* face */ +typedef struct face_t face_t; + HB_WASM_API_COMPOUND (blob_t, face_reference_table) (HB_WASM_EXEC_ENV_COMPOUND - face_t faceref, + ptr_t(face_t), tag_t table_tag); /* font */ -HB_WASM_API (face_t, font_get_face) (HB_WASM_EXEC_ENV - font_t fontref); +typedef struct font_t font_t; + +HB_WASM_API (ptr_t(face_t), font_get_face) (HB_WASM_EXEC_ENV + ptr_t(font_t)); /* shape interface */ HB_WASM_INTERFACE (bool_t, shape) (HB_WASM_EXEC_ENV - font_t fontref, - buffer_t bufferref); + ptr_t(font_t), + ptr_t(buffer_t)); HB_WASM_END_DECLS diff --git a/src/wasm-sample/shape.c b/src/wasm-sample/shape.c index 89ea28242..c2b15ea9a 100644 --- a/src/wasm-sample/shape.c +++ b/src/wasm-sample/shape.c @@ -8,9 +8,9 @@ void debugprint1 (char *s, int32_t); void debugprint2 (char *s, int32_t, int32_t); bool_t -shape (font_t font, buffer_t buffer) +shape (font_t *font, buffer_t *buffer) { - face_t face = font_get_face (font); + face_t *face = font_get_face (font); blob_t blob = face_reference_table (face, TAG ('c','m','a','p'));