[kerx] Don't loop over kerning subtables if kerning disabled

This commit is contained in:
Behdad Esfahbod 2018-10-10 18:10:05 -04:00
parent 38a7a8a89e
commit 60f86d32d7
3 changed files with 15 additions and 2 deletions

View File

@ -59,6 +59,9 @@ struct KerxSubTableFormat0
{ {
TRACE_APPLY (this); TRACE_APPLY (this);
if (!c->plan->requested_kerning)
return false;
hb_kern_machine_t<KerxSubTableFormat0> machine (*this); hb_kern_machine_t<KerxSubTableFormat0> machine (*this);
machine.kern (c->font, c->buffer, c->plan->kern_mask); machine.kern (c->font, c->buffer, c->plan->kern_mask);
@ -85,6 +88,9 @@ struct KerxSubTableFormat1
{ {
TRACE_APPLY (this); TRACE_APPLY (this);
if (!c->plan->requested_kerning)
return false;
/* TODO */ /* TODO */
return_trace (true); return_trace (true);
@ -123,6 +129,9 @@ struct KerxSubTableFormat2
{ {
TRACE_APPLY (this); TRACE_APPLY (this);
if (!c->plan->requested_kerning)
return false;
accelerator_t accel (*this, accelerator_t accel (*this,
c->sanitizer.end, c->sanitizer.end,
c->face->get_num_glyphs ()); c->face->get_num_glyphs ());
@ -203,6 +212,9 @@ struct KerxSubTableFormat6
{ {
TRACE_APPLY (this); TRACE_APPLY (this);
if (!c->plan->requested_kerning)
return false;
/* TODO */ /* TODO */
return_trace (true); return_trace (true);

View File

@ -71,7 +71,7 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan,
HB_TAG ('k','e','r','n') : HB_TAG ('v','k','r','n'); HB_TAG ('k','e','r','n') : HB_TAG ('v','k','r','n');
plan.kern_mask = plan.map.get_mask (kern_tag); plan.kern_mask = plan.map.get_mask (kern_tag);
bool kerning_requested = !!plan.kern_mask; plan.requested_kerning = !!plan.kern_mask;
bool has_gpos_kern = plan.map.get_feature_index (1, kern_tag) != HB_OT_LAYOUT_NO_FEATURE_INDEX; bool has_gpos_kern = plan.map.get_feature_index (1, kern_tag) != HB_OT_LAYOUT_NO_FEATURE_INDEX;
bool disable_gpos = plan.shaper->gpos_tag && bool disable_gpos = plan.shaper->gpos_tag &&
plan.shaper->gpos_tag != plan.map.chosen_script[1]; plan.shaper->gpos_tag != plan.map.chosen_script[1];
@ -100,7 +100,7 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan,
else if (hb_aat_layout_has_positioning (face)) else if (hb_aat_layout_has_positioning (face))
plan.apply_kerx = true; plan.apply_kerx = true;
if (kerning_requested) if (plan.requested_kerning)
{ {
if (plan.apply_kerx) if (plan.apply_kerx)
;/* kerx supercedes kern. */ ;/* kerx supercedes kern. */

View File

@ -43,6 +43,7 @@ struct hb_ot_shape_plan_t
hb_mask_t rtlm_mask, frac_mask, numr_mask, dnom_mask; hb_mask_t rtlm_mask, frac_mask, numr_mask, dnom_mask;
hb_mask_t kern_mask; hb_mask_t kern_mask;
bool requested_kerning : 1;
bool has_frac : 1; bool has_frac : 1;
bool has_gpos_mark : 1; bool has_gpos_mark : 1;
bool fallback_glyph_classes : 1; bool fallback_glyph_classes : 1;