[wasm-api] Bind font_glyph_to_string
This commit is contained in:
parent
7537d48f08
commit
1acff90b03
|
@ -88,6 +88,18 @@ font_get_glyph_v_advance (HB_WASM_EXEC_ENV
|
|||
return hb_font_get_glyph_v_advance (font, glyph);
|
||||
}
|
||||
|
||||
void
|
||||
font_glyph_to_string (HB_WASM_EXEC_ENV
|
||||
ptr_t(font_t) fontref,
|
||||
codepoint_t glyph,
|
||||
char *s, uint32_t size)
|
||||
{
|
||||
HB_REF2OBJ (font);
|
||||
|
||||
hb_font_glyph_to_string (font, glyph, s, size);
|
||||
}
|
||||
|
||||
|
||||
}}
|
||||
|
||||
#endif /* HB_WASM_API_FONT_HH */
|
||||
|
|
|
@ -72,6 +72,7 @@ static NativeSymbol _hb_wasm_native_symbols[] =
|
|||
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),
|
||||
NATIVE_SYMBOL ("(ii$*)", font_glyph_to_string),
|
||||
|
||||
/* shape */
|
||||
NATIVE_SYMBOL ("(ii$)i", shape_with),
|
||||
|
|
|
@ -188,6 +188,11 @@ HB_WASM_API (position_t, font_get_glyph_v_advance) (HB_WASM_EXEC_ENV
|
|||
ptr_t(font_t),
|
||||
codepoint_t glyph);
|
||||
|
||||
HB_WASM_API (void, font_glyph_to_string) (HB_WASM_EXEC_ENV
|
||||
ptr_t(font_t),
|
||||
codepoint_t glyph,
|
||||
char *s, uint32_t size);
|
||||
|
||||
|
||||
/* shape */
|
||||
|
||||
|
|
|
@ -15,6 +15,9 @@ void *memset(void *s, int c, size_t n);
|
|||
void debugprint1 (char *s, int32_t);
|
||||
void debugprint2 (char *s, int32_t, int32_t);
|
||||
|
||||
__attribute__((visibility("default")))
|
||||
uint32_t heap_size = 2 * 1024 * 1024;
|
||||
|
||||
static const void *copy_table (const void *data, unsigned int tag, size_t *len)
|
||||
{
|
||||
face_t *face = (face_t *) data;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <hb-wasm-api.h>
|
||||
|
||||
extern "C" {
|
||||
void debugprint (const char *s);
|
||||
void debugprint1 (const char *s, int32_t);
|
||||
void debugprint2 (const char *s, int32_t, int32_t);
|
||||
}
|
||||
|
@ -24,7 +25,12 @@ shape (font_t *font, buffer_t *buffer)
|
|||
|
||||
for (unsigned i = 0; i < contents.length; i++)
|
||||
{
|
||||
debugprint2 ("Codepoint", i, contents.info[i].codepoint);
|
||||
char name[64];
|
||||
|
||||
font_glyph_to_string (font, contents.info[i].codepoint, name, sizeof (name));
|
||||
|
||||
debugprint (name);
|
||||
|
||||
contents.info[i].codepoint = font_get_glyph (font, contents.info[i].codepoint, 0);
|
||||
contents.pos[i].x_advance = font_get_glyph_h_advance (font, contents.info[i].codepoint);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue