[wasm] [experimental] wrap hb_face_create and hb_create_font
This commit is contained in:
parent
0a16c60b42
commit
3fc48d4ada
|
@ -30,6 +30,26 @@
|
||||||
namespace hb {
|
namespace hb {
|
||||||
namespace wasm {
|
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
|
HB_WASM_API (void, blob_free) (HB_WASM_EXEC_ENV
|
||||||
ptr_d(blob_t, blob))
|
ptr_d(blob_t, blob))
|
||||||
|
|
|
@ -85,7 +85,16 @@ HB_WASM_API (unsigned, face_get_upem) (HB_WASM_EXEC_ENV
|
||||||
return hb_face_get_upem (face);
|
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 */
|
#endif /* HB_WASM_API_FACE_HH */
|
||||||
|
|
|
@ -57,6 +57,7 @@ static NativeSymbol _hb_wasm_native_symbols[] =
|
||||||
NATIVE_SYMBOL ("(i)i", script_get_horizontal_direction),
|
NATIVE_SYMBOL ("(i)i", script_get_horizontal_direction),
|
||||||
|
|
||||||
/* blob */
|
/* blob */
|
||||||
|
NATIVE_SYMBOL ("(ii)i", blob_face_create),
|
||||||
NATIVE_SYMBOL ("(i)", blob_free),
|
NATIVE_SYMBOL ("(i)", blob_free),
|
||||||
|
|
||||||
/* buffer */
|
/* buffer */
|
||||||
|
@ -72,6 +73,7 @@ static NativeSymbol _hb_wasm_native_symbols[] =
|
||||||
/* face */
|
/* face */
|
||||||
NATIVE_SYMBOL ("(iii)i", face_copy_table),
|
NATIVE_SYMBOL ("(iii)i", face_copy_table),
|
||||||
NATIVE_SYMBOL ("(i)i", face_get_upem),
|
NATIVE_SYMBOL ("(i)i", face_get_upem),
|
||||||
|
NATIVE_SYMBOL ("(i)i", face_create_font),
|
||||||
|
|
||||||
/* font */
|
/* font */
|
||||||
NATIVE_SYMBOL ("(i)i", font_get_face),
|
NATIVE_SYMBOL ("(i)i", font_get_face),
|
||||||
|
|
|
@ -113,6 +113,9 @@ typedef struct
|
||||||
HB_WASM_API (void, blob_free) (HB_WASM_EXEC_ENV
|
HB_WASM_API (void, blob_free) (HB_WASM_EXEC_ENV
|
||||||
ptr_d(blob_t, blob));
|
ptr_d(blob_t, blob));
|
||||||
|
|
||||||
|
HB_WASM_API (ptr_t(face_t), blob_face_create) (HB_WASM_EXEC_ENV
|
||||||
|
ptr_d(blob_t, blob),
|
||||||
|
unsigned int);
|
||||||
|
|
||||||
/* buffer */
|
/* buffer */
|
||||||
|
|
||||||
|
@ -183,6 +186,8 @@ HB_WASM_API (bool_t, face_copy_table) (HB_WASM_EXEC_ENV
|
||||||
HB_WASM_API (unsigned, face_get_upem) (HB_WASM_EXEC_ENV
|
HB_WASM_API (unsigned, face_get_upem) (HB_WASM_EXEC_ENV
|
||||||
ptr_d(face_t, face));
|
ptr_d(face_t, face));
|
||||||
|
|
||||||
|
HB_WASM_API (ptr_t(font_t), face_create_font) (HB_WASM_EXEC_ENV
|
||||||
|
ptr_d(face_t, face));
|
||||||
|
|
||||||
/* font */
|
/* font */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue