[wasm-api] Wrap some of hb-font
This commit is contained in:
parent
af1f41a43e
commit
e0fec1dda0
|
@ -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);
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
|
|
|
@ -63,6 +63,9 @@ static NativeSymbol _hb_wasm_native_symbols[] =
|
|||
|
||||
/* font */
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue