From a08dbf41cd20bf36828b58a4e4b448671ee036c1 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 24 Feb 2023 10:13:21 -0700 Subject: [PATCH] [wasm-api] Bind buffer_reverse_clusters --- src/hb-wasm-api-buffer.hh | 8 ++++++++ src/hb-wasm-api-list.hh | 1 + src/hb-wasm-api.h | 2 ++ src/wasm-graphite/Makefile | 2 +- src/wasm-graphite/shape.cc | 6 +++--- 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/hb-wasm-api-buffer.hh b/src/hb-wasm-api-buffer.hh index bb78cd924..1f66f49e1 100644 --- a/src/hb-wasm-api-buffer.hh +++ b/src/hb-wasm-api-buffer.hh @@ -137,6 +137,14 @@ buffer_get_direction (HB_WASM_EXEC_ENV return (direction_t) hb_buffer_get_direction (buffer); } +void +buffer_reverse_clusters (HB_WASM_EXEC_ENV + ptr_t(buffer_t) bufferref) +{ + HB_REF2OBJ (buffer); + + hb_buffer_reverse_clusters (buffer); +} }} diff --git a/src/hb-wasm-api-list.hh b/src/hb-wasm-api-list.hh index 53faca01e..e857e4d9e 100644 --- a/src/hb-wasm-api-list.hh +++ b/src/hb-wasm-api-list.hh @@ -60,6 +60,7 @@ static NativeSymbol _hb_wasm_native_symbols[] = NATIVE_SYMBOL ("(ii)", buffer_copy_contents), NATIVE_SYMBOL ("(ii)i", buffer_set_contents), NATIVE_SYMBOL ("(i)i", buffer_get_direction), + NATIVE_SYMBOL ("(i)", buffer_reverse_clusters), /* face */ NATIVE_SYMBOL ("(iii)", face_reference_table), diff --git a/src/hb-wasm-api.h b/src/hb-wasm-api.h index a0ab24058..3f3b035d3 100644 --- a/src/hb-wasm-api.h +++ b/src/hb-wasm-api.h @@ -148,6 +148,8 @@ HB_WASM_API (bool_t, buffer_set_contents) (HB_WASM_EXEC_ENV HB_WASM_API (direction_t, buffer_get_direction) (HB_WASM_EXEC_ENV ptr_t(buffer_t)); +HB_WASM_API (void, buffer_reverse_clusters) (HB_WASM_EXEC_ENV + ptr_t(buffer_t)); /* face */ diff --git a/src/wasm-graphite/Makefile b/src/wasm-graphite/Makefile index 6997a1956..7b486ea6b 100644 --- a/src/wasm-graphite/Makefile +++ b/src/wasm-graphite/Makefile @@ -1,4 +1,4 @@ -all: test.wasm.ttf +all: CharisSIL-R.wasm.ttf Scheherazade-R.wasm.ttf %.wasm: %.cc ../hb-wasm-api.h emcc \ diff --git a/src/wasm-graphite/shape.cc b/src/wasm-graphite/shape.cc index b8e848a66..d537e34d8 100644 --- a/src/wasm-graphite/shape.cc +++ b/src/wasm-graphite/shape.cc @@ -180,6 +180,7 @@ shape (font_t *font, buffer_t *buffer) pPos->y_advance = gr_slot_advance_Y (is, grface, nullptr) * yscale; curradvy += pPos->y_advance; } + buffer_set_contents (buffer, &contents); } else { @@ -199,13 +200,12 @@ shape (font_t *font, buffer_t *buffer) pPos->x_offset = gr_slot_origin_X (is) * xscale - info->var1 - curradvx + pPos->x_advance; pPos->y_offset = gr_slot_origin_Y (is) * yscale - curradvy; } - //buffer_reverse_clusters (buffer); + buffer_set_contents (buffer, &contents); + buffer_reverse_clusters (buffer); } gr_seg_destroy (seg); - buffer_set_contents (buffer, &contents); - bool ret = glyph_count; return ret;