[kern] Apply erlier, where GPOS/kerx are applied

This commit is contained in:
Behdad Esfahbod 2018-11-07 13:58:41 -05:00
parent f4bad0086e
commit 0c3b061ac2
3 changed files with 15 additions and 9 deletions

View File

@ -889,8 +889,7 @@ struct KerxTable
if (HB_DIRECTION_IS_HORIZONTAL (c->buffer->props.direction) != st->u.header.is_horizontal ())
goto skip;
reverse = T::Types::extended /* TODO remove after kern application is moved earlier. */ &&
bool (st->u.header.coverage & st->u.header.Backwards) !=
reverse = bool (st->u.header.coverage & st->u.header.Backwards) !=
HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction);
if (!c->buffer->message (c->font, "start %c%c%c%c subtable %d", HB_UNTAG (thiz()->tableTag), c->lookup_index))

View File

@ -464,9 +464,18 @@ _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan,
!font->has_glyph_h_kerning_func () :
!font->has_glyph_v_kerning_func ())
return;
bool reverse = HB_DIRECTION_IS_BACKWARD (buffer->props.direction);
if (reverse)
buffer->reverse ();
hb_ot_shape_fallback_kern_driver_t driver (font, buffer);
OT::hb_kern_machine_t<hb_ot_shape_fallback_kern_driver_t> machine (driver);
machine.kern (font, buffer, plan->kern_mask, false);
if (reverse)
buffer->reverse ();
}

View File

@ -866,10 +866,15 @@ hb_ot_position_complex (const hb_ot_shape_context_t *c)
break;
}
/* XXX Clean up relationship between these. */
if (c->plan->apply_gpos)
c->plan->position (c->font, c->buffer);
else if (c->plan->apply_kerx)
hb_aat_layout_position (c->plan, c->font, c->buffer);
else if (c->plan->apply_kern)
hb_ot_layout_kern (c->plan, c->font, c->buffer);
else if (c->plan->fallback_kerning)
_hb_ot_shape_fallback_kern (c->plan, c->font, c->buffer);
if (c->plan->apply_trak)
hb_aat_layout_track (c->plan, c->font, c->buffer);
@ -915,13 +920,6 @@ hb_ot_position (const hb_ot_shape_context_t *c)
if (HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction))
hb_buffer_reverse (c->buffer);
/* Visual fallback goes here. */
if (c->plan->apply_kern)
hb_ot_layout_kern (c->plan, c->font, c->buffer);
else if (c->plan->fallback_kerning)
_hb_ot_shape_fallback_kern (c->plan, c->font, c->buffer);
_hb_buffer_deallocate_gsubgpos_vars (c->buffer);
}