[hmtx] Use more optimal way to access glyf table

This commit is contained in:
Ebrahim Byagowi 2019-10-03 15:48:35 +03:30
parent b9ff43c162
commit c9577a630f
2 changed files with 6 additions and 18 deletions

View File

@ -29,26 +29,14 @@
namespace OT { 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; return font->face->table.glyf->get_side_bearing_var (glyph, font->coords, font->num_coords, is_vertical);
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;
} }
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; return font->face->table.glyf->get_advance_var (glyph, font->coords, font->num_coords, is_vertical);
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;
} }
} }

View File

@ -55,8 +55,8 @@ struct LongMetric
struct hmtxvmtx_accelerator_base_t 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 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 vertical); HB_INTERNAL static unsigned int get_advance_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical);
}; };
template <typename T, typename H> template <typename T, typename H>