Fix vertical GPOS

This was brorken earlier, though, it's really hard to notice it.
Unlike the glyph_h_origin(), an unset glyph_v_origin() does NOT
mean that the vertical origin is at 0,0.

Related to https://github.com/behdad/harfbuzz/issues/187
This commit is contained in:
Behdad Esfahbod 2015-11-26 18:48:42 -05:00
parent 1c6a057dd1
commit 67a36a725e
1 changed files with 8 additions and 5 deletions

View File

@ -662,6 +662,7 @@ hb_ot_position_default (hb_ot_shape_context_t *c)
{
for (unsigned int i = 0; i < count; i++)
pos[i].x_advance = c->font->get_glyph_h_advance (info[i].codepoint);
/* The nil glyph_h_origin() func returns 0, so no need to apply it. */
if (c->font->has_glyph_h_origin_func ())
for (unsigned int i = 0; i < count; i++)
c->font->subtract_glyph_h_origin (info[i].codepoint,
@ -671,13 +672,13 @@ hb_ot_position_default (hb_ot_shape_context_t *c)
else
{
for (unsigned int i = 0; i < count; i++)
{
pos[i].y_advance = c->font->get_glyph_v_advance (info[i].codepoint);
if (c->font->has_glyph_v_origin_func ())
for (unsigned int i = 0; i < count; i++)
c->font->subtract_glyph_v_origin (info[i].codepoint,
&pos[i].x_offset,
&pos[i].y_offset);
}
}
if (c->buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK)
_hb_ot_shape_fallback_spaces (c->plan, c->font, c->buffer);
}
@ -726,6 +727,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
/* Change glyph origin to what GPOS expects (horizontal), apply GPOS, change it back. */
/* The nil glyph_h_origin() func returns 0, so no need to apply it. */
if (c->font->has_glyph_h_origin_func ())
for (unsigned int i = 0; i < count; i++)
c->font->add_glyph_h_origin (info[i].codepoint,
@ -734,6 +736,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
c->plan->position (c->font, c->buffer);
/* The nil glyph_h_origin() func returns 0, so no need to apply it. */
if (c->font->has_glyph_h_origin_func ())
for (unsigned int i = 0; i < count; i++)
c->font->subtract_glyph_h_origin (info[i].codepoint,