From 1979f6fedca82fa1e4f65491de491db1aa6dc645 Mon Sep 17 00:00:00 2001 From: Martin Hosken Date: Mon, 23 Nov 2015 10:03:56 +0700 Subject: [PATCH] Fix y_scale problems in hb-gr --- src/hb-graphite2.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc index cd694c140..f41093ae7 100644 --- a/src/hb-graphite2.cc +++ b/src/hb-graphite2.cc @@ -351,6 +351,7 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan, } buffer->len = glyph_count; + float yscale = font->y_scale / font->x_scale; /* Positioning. */ if (!HB_DIRECTION_IS_BACKWARD(buffer->props.direction)) { @@ -359,9 +360,9 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan, is; pPos++, is = gr_slot_next_in_segment (is)) { pPos->x_offset = gr_slot_origin_X (is) - curradvx; - pPos->y_offset = gr_slot_origin_Y (is) - curradvy; + pPos->y_offset = gr_slot_origin_Y (is) * yscale - curradvy; pPos->x_advance = gr_slot_advance_X (is, grface, grfont); - pPos->y_advance = gr_slot_advance_Y (is, grface, grfont); + pPos->y_advance = gr_slot_advance_Y (is, grface, grfont) * yscale; curradvx += pPos->x_advance; curradvy += pPos->y_advance; } @@ -387,17 +388,17 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan, for (tis = is, tinfo = info; tis && tinfo->cluster == currclus; tis = gr_slot_prev_in_segment (tis), tinfo--) { clusx += gr_slot_advance_X (tis, grface, grfont); - clusy += gr_slot_advance_Y (tis, grface, grfont); + clusy += gr_slot_advance_Y (tis, grface, grfont) * yscale; } curradvx += clusx; curradvy += clusy; } pPos->x_advance = gr_slot_advance_X (is, grface, grfont); - pPos->y_advance = gr_slot_advance_Y (is, grface, grfont); + pPos->y_advance = gr_slot_advance_Y (is, grface, grfont) * yscale; curradvx -= pPos->x_advance; curradvy -= pPos->y_advance; pPos->x_offset = gr_slot_origin_X (is) - curradvx; - pPos->y_offset = gr_slot_origin_Y (is) - curradvy; + pPos->y_offset = gr_slot_origin_Y (is) * yscale - curradvy; } hb_buffer_reverse_clusters (buffer); }