diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh index b667140e3..739474f2f 100644 --- a/src/hb-ot-hmtx-table.hh +++ b/src/hb-ot-hmtx-table.hh @@ -128,7 +128,19 @@ struct hmtxvmtx if (unlikely (!table_prime)) return_trace (false); accelerator_t _mtx (c->plan->source); - unsigned num_advances = _mtx.num_advances_for_subset (c->plan); + unsigned num_advances; + { + /* Determine num_advances to encode. */ + auto& plan = c->plan; + num_advances = plan->num_output_glyphs (); + hb_codepoint_t old_gid = 0; + unsigned int last_advance = plan->old_gid_for_new_gid (num_advances - 1, &old_gid) ? _mtx.get_advance (old_gid) : 0; + while (num_advances > 1 && + last_advance == (plan->old_gid_for_new_gid (num_advances - 2, &old_gid) ? _mtx.get_advance (old_gid) : 0)) + { + num_advances--; + } + } auto it = + hb_range (c->plan->num_output_glyphs ()) @@ -259,20 +271,6 @@ struct hmtxvmtx #endif } - unsigned int num_advances_for_subset (const hb_subset_plan_t *plan) const - { - unsigned int num_advances = plan->num_output_glyphs (); - hb_codepoint_t old_gid = 0; - unsigned int last_advance = plan->old_gid_for_new_gid (num_advances - 1, &old_gid) ? get_advance (old_gid) : 0; - while (num_advances > 1 && - last_advance == (plan->old_gid_for_new_gid (num_advances - 2, &old_gid) ? get_advance (old_gid) : 0)) - { - num_advances--; - } - - return num_advances; - } - protected: unsigned int num_metrics; unsigned int num_advances;