Merge pull request #181 from mhosken/master

Fix y_scale problems in hb-gr
This commit is contained in:
Behdad Esfahbod 2015-11-24 15:29:44 -06:00
commit 662acd26d1
1 changed files with 6 additions and 5 deletions

View File

@ -351,6 +351,7 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
} }
buffer->len = glyph_count; buffer->len = glyph_count;
float yscale = font->y_scale / font->x_scale;
/* Positioning. */ /* Positioning. */
if (!HB_DIRECTION_IS_BACKWARD(buffer->props.direction)) 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)) is; pPos++, is = gr_slot_next_in_segment (is))
{ {
pPos->x_offset = gr_slot_origin_X (is) - curradvx; 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->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; curradvx += pPos->x_advance;
curradvy += pPos->y_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--) 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); 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; curradvx += clusx;
curradvy += clusy; curradvy += clusy;
} }
pPos->x_advance = gr_slot_advance_X (is, grface, grfont); 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; curradvx -= pPos->x_advance;
curradvy -= pPos->y_advance; curradvy -= pPos->y_advance;
pPos->x_offset = gr_slot_origin_X (is) - curradvx; 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); hb_buffer_reverse_clusters (buffer);
} }