[wasm-api] Wrap some of hb-font

This commit is contained in:
Simon Cozens authored and Behdad Esfahbod committed 2023-03-31 17:33:44 -06:00
1 parent af1f41a43e
commit e0fec1dda0
3 files changed
+46 -1

No files matched your search

+31
View File
@@ -43,6 +43,37 @@ font_get_face (HB_WASM_EXEC_ENV
return faceref;
}
hb_codepoint_t
font_get_glyph (HB_WASM_EXEC_ENV
ptr_t(font_t) fontref,
hb_codepoint_t unicode,
hb_codepoint_t variation_selector)
{
HB_REF2OBJ (font);
hb_codepoint_t glyph;
hb_font_get_glyph (font, unicode, variation_selector, &glyph);
return glyph;
}
hb_position_t
font_get_glyph_h_advance (HB_WASM_EXEC_ENV
ptr_t(font_t) fontref,
hb_codepoint_t glyph)
{
HB_REF2OBJ (font);
return hb_font_get_glyph_h_advance (font, glyph);
}
hb_position_t
font_get_glyph_v_advance (HB_WASM_EXEC_ENV
ptr_t(font_t) fontref,
hb_codepoint_t glyph)
{
HB_REF2OBJ (font);
return hb_font_get_glyph_v_advance (font, glyph);
}
}}
+4 -1
View File
@@ -62,7 +62,10 @@ static NativeSymbol _hb_wasm_native_symbols[] =
NATIVE_SYMBOL ("(iii)", face_reference_table),
/* font */
NATIVE_SYMBOL ("(i)i", font_get_face),
NATIVE_SYMBOL ("(i)i", font_get_face),
NATIVE_SYMBOL ("(iii)i", font_get_glyph),
NATIVE_SYMBOL ("(ii)i", font_get_glyph_h_advance),
NATIVE_SYMBOL ("(ii)i", font_get_glyph_v_advance),
/* debug */
#ifdef HB_DEBUG_WASM
+11
View File
@@ -140,7 +140,18 @@ typedef struct font_t font_t;
HB_WASM_API (ptr_t(face_t), font_get_face) (HB_WASM_EXEC_ENV
ptr_t(font_t));
HB_WASM_API (hb_codepoint_t, font_get_glyph) (HB_WASM_EXEC_ENV
ptr_t(font_t),
hb_codepoint_t unicode,
hb_codepoint_t variation_selector);
HB_WASM_API (hb_position_t, font_get_glyph_h_advance) (HB_WASM_EXEC_ENV
ptr_t(font_t),
hb_codepoint_t glyph);
HB_WASM_API (hb_position_t, font_get_glyph_v_advance) (HB_WASM_EXEC_ENV
ptr_t(font_t),
hb_codepoint_t glyph);
/* shape interface */
HB_WASM_INTERFACE (bool_t, shape) (HB_WASM_EXEC_ENV