From c9577a630fd5bd08482ee7b94bc03c91fcf366c7 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Thu, 3 Oct 2019 15:48:35 +0330 Subject: [PATCH] [hmtx] Use more optimal way to access glyf table --- src/hb-ot-hmtx-table.cc | 20 ++++---------------- src/hb-ot-hmtx-table.hh | 4 ++-- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/hb-ot-hmtx-table.cc b/src/hb-ot-hmtx-table.cc index 012a9f2d9..93afd5610 100644 --- a/src/hb-ot-hmtx-table.cc +++ b/src/hb-ot-hmtx-table.cc @@ -29,26 +29,14 @@ namespace OT { -int hmtxvmtx_accelerator_base_t::get_side_bearing_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool vertical) +int hmtxvmtx_accelerator_base_t::get_side_bearing_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical) { - glyf::accelerator_t glyf_accel; - glyf_accel.init (font->face); - - int side_bearing = glyf_accel.get_side_bearing_var (glyph, font->coords, font->num_coords, vertical); - glyf_accel.fini (); - - return side_bearing; + return font->face->table.glyf->get_side_bearing_var (glyph, font->coords, font->num_coords, is_vertical); } -unsigned int hmtxvmtx_accelerator_base_t::get_advance_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool vertical) +unsigned int hmtxvmtx_accelerator_base_t::get_advance_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical) { - glyf::accelerator_t glyf_accel; - glyf_accel.init (font->face); - - unsigned int advance = glyf_accel.get_advance_var (glyph, font->coords, font->num_coords, vertical); - glyf_accel.fini (); - - return advance; + return font->face->table.glyf->get_advance_var (glyph, font->coords, font->num_coords, is_vertical); } } diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh index 90c9c4866..f5c094463 100644 --- a/src/hb-ot-hmtx-table.hh +++ b/src/hb-ot-hmtx-table.hh @@ -55,8 +55,8 @@ struct LongMetric struct hmtxvmtx_accelerator_base_t { - HB_INTERNAL static int get_side_bearing_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool vertical); - HB_INTERNAL static unsigned int get_advance_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool vertical); + HB_INTERNAL static int get_side_bearing_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical); + HB_INTERNAL static unsigned int get_advance_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical); }; template