diff --git a/src/hb-wasm-api-face.hh b/src/hb-wasm-api-face.hh index 30d21aa21..cdbc08d6d 100644 --- a/src/hb-wasm-api-face.hh +++ b/src/hb-wasm-api-face.hh @@ -50,6 +50,15 @@ face_reference_table (HB_WASM_EXEC_ENV_COMPOUND hb_blob_destroy (blob); } +unsigned +face_get_upem (HB_WASM_EXEC_ENV + ptr_t(face_t) faceref) +{ + HB_REF2OBJ (face); + + return hb_face_get_upem (face); +} + }} diff --git a/src/hb-wasm-api-list.hh b/src/hb-wasm-api-list.hh index cb60ee76a..7a833d900 100644 --- a/src/hb-wasm-api-list.hh +++ b/src/hb-wasm-api-list.hh @@ -62,6 +62,7 @@ static NativeSymbol _hb_wasm_native_symbols[] = /* face */ NATIVE_SYMBOL ("(iii)", face_reference_table), + NATIVE_SYMBOL ("(i)i", face_get_upem), /* font */ NATIVE_SYMBOL ("(i)i", font_get_face), diff --git a/src/hb-wasm-api.h b/src/hb-wasm-api.h index 405189ed3..f7162fbe7 100644 --- a/src/hb-wasm-api.h +++ b/src/hb-wasm-api.h @@ -140,6 +140,9 @@ HB_WASM_API_COMPOUND (blob_t, face_reference_table) (HB_WASM_EXEC_ENV_COMPOUND ptr_t(face_t), tag_t table_tag); +HB_WASM_API (unsigned, face_get_upem) (HB_WASM_EXEC_ENV + ptr_t(face_t)); + /* font */ @@ -160,6 +163,8 @@ HB_WASM_API (hb_position_t, font_get_glyph_h_advance) (HB_WASM_EXEC_ENV 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 diff --git a/src/wasm-graphite/shape.cc b/src/wasm-graphite/shape.cc index 963a00651..a4a5e8302 100644 --- a/src/wasm-graphite/shape.cc +++ b/src/wasm-graphite/shape.cc @@ -85,7 +85,7 @@ shape (font_t *font, buffer_t *buffer) memset (clusters, 0, sizeof (clusters[0]) * length); hb_codepoint_t *pg = gids; clusters[0].cluster = contents.info[0].cluster; - unsigned int upem = 2048;//hb_face_get_upem (face); + unsigned int upem = face_get_upem (face); float xscale = 10;//(float) font->x_scale / upem; float yscale = 10;//(float) font->y_scale / upem; yscale *= yscale / xscale; @@ -196,7 +196,7 @@ 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; } - //hb_buffer_reverse_clusters (buffer); + //buffer_reverse_clusters (buffer); } gr_seg_destroy (seg);