[wasm-api] Bind buffer_reverse_clusters

This commit is contained in:
Behdad Esfahbod 2023-02-24 10:13:21 -07:00
parent 0a51ed31b0
commit a08dbf41cd
5 changed files with 15 additions and 4 deletions

View File

@ -137,6 +137,14 @@ buffer_get_direction (HB_WASM_EXEC_ENV
return (direction_t) hb_buffer_get_direction (buffer); 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);
}
}} }}

View File

@ -60,6 +60,7 @@ static NativeSymbol _hb_wasm_native_symbols[] =
NATIVE_SYMBOL ("(ii)", buffer_copy_contents), NATIVE_SYMBOL ("(ii)", buffer_copy_contents),
NATIVE_SYMBOL ("(ii)i", buffer_set_contents), NATIVE_SYMBOL ("(ii)i", buffer_set_contents),
NATIVE_SYMBOL ("(i)i", buffer_get_direction), NATIVE_SYMBOL ("(i)i", buffer_get_direction),
NATIVE_SYMBOL ("(i)", buffer_reverse_clusters),
/* face */ /* face */
NATIVE_SYMBOL ("(iii)", face_reference_table), NATIVE_SYMBOL ("(iii)", face_reference_table),

View File

@ -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 HB_WASM_API (direction_t, buffer_get_direction) (HB_WASM_EXEC_ENV
ptr_t(buffer_t)); ptr_t(buffer_t));
HB_WASM_API (void, buffer_reverse_clusters) (HB_WASM_EXEC_ENV
ptr_t(buffer_t));
/* face */ /* face */

View File

@ -1,4 +1,4 @@
all: test.wasm.ttf all: CharisSIL-R.wasm.ttf Scheherazade-R.wasm.ttf
%.wasm: %.cc ../hb-wasm-api.h %.wasm: %.cc ../hb-wasm-api.h
emcc \ emcc \

View File

@ -180,6 +180,7 @@ shape (font_t *font, buffer_t *buffer)
pPos->y_advance = gr_slot_advance_Y (is, grface, nullptr) * yscale; pPos->y_advance = gr_slot_advance_Y (is, grface, nullptr) * yscale;
curradvy += pPos->y_advance; curradvy += pPos->y_advance;
} }
buffer_set_contents (buffer, &contents);
} }
else 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->x_offset = gr_slot_origin_X (is) * xscale - info->var1 - curradvx + pPos->x_advance;
pPos->y_offset = gr_slot_origin_Y (is) * yscale - curradvy; 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); gr_seg_destroy (seg);
buffer_set_contents (buffer, &contents);
bool ret = glyph_count; bool ret = glyph_count;
return ret; return ret;