[wasm-api] Bind font_glyph_to_string
diff --git a/src/hb-wasm-api-font.hh b/src/hb-wasm-api-font.hh
index 2956109..319814c 100644
--- a/src/hb-wasm-api-font.hh
+++ b/src/hb-wasm-api-font.hh
@@ -88,6 +88,18 @@
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 */
diff --git a/src/hb-wasm-api-list.hh b/src/hb-wasm-api-list.hh
index 5cd0ea6..25f02f9 100644
--- a/src/hb-wasm-api-list.hh
+++ b/src/hb-wasm-api-list.hh
@@ -72,6 +72,7 @@
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),
diff --git a/src/hb-wasm-api.h b/src/hb-wasm-api.h
index 45d881c..758f5aa 100644
--- a/src/hb-wasm-api.h
+++ b/src/hb-wasm-api.h
@@ -188,6 +188,11 @@
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 */
diff --git a/src/wasm-graphite/shape.cc b/src/wasm-graphite/shape.cc
index b4da4c4..fcf87c0 100644
--- a/src/wasm-graphite/shape.cc
+++ b/src/wasm-graphite/shape.cc
@@ -15,6 +15,9 @@
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;
diff --git a/src/wasm-sample/shape-fallback.cc b/src/wasm-sample/shape-fallback.cc
index 344ab0e..11853c4 100644
--- a/src/wasm-sample/shape-fallback.cc
+++ b/src/wasm-sample/shape-fallback.cc
@@ -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 @@
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);
}