diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index 47416012c9d860e810c1b3adc99275cfaaeea7cf..8d8d68b19477c5672d233127de5479a4346022cb 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -335,27 +335,6 @@ struct hb_ot_face_post_accelerator_t } }; -struct hb_ot_face_kern_accelerator_t -{ - hb_blob_t *kern_blob; - OT::kern::accelerator_t accel; - - inline void init (hb_face_t *face) - { - hb_blob_t *blob = this->kern_blob = OT::Sanitizer::sanitize (face->reference_table (HB_OT_TAG_kern)); - accel.init (OT::Sanitizer::lock_instance (blob), hb_blob_get_length (blob)); - } - - inline void fini (void) - { - accel.fini (); - hb_blob_destroy (this->kern_blob); - } - - inline int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right) const - { return accel.get_h_kerning (left, right); } -}; - typedef bool (*hb_cmap_get_glyph_func_t) (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph); @@ -492,7 +471,7 @@ struct hb_ot_font_t OT::hb_lazy_loader_t glyf; OT::hb_lazy_loader_t cbdt; OT::hb_lazy_loader_t post; - OT::hb_lazy_loader_t kern; + OT::hb_lazy_loader_t kern; }; diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh index 5fd2e20e67dd5054c6404d38b6fec43f066664b7..aa293b8de59f3be49c0dfb6054a306294411856e 100644 --- a/src/hb-ot-kern-table.hh +++ b/src/hb-ot-kern-table.hh @@ -358,17 +358,22 @@ struct kern struct accelerator_t { - inline void init (const kern *table_, unsigned int table_length_) + inline void init (hb_face_t *face) { - table = table_; - table_length = table_length_; + blob = Sanitizer::sanitize (face->reference_table (HB_OT_TAG_kern)); + table = Sanitizer::lock_instance (blob); + table_length = hb_blob_get_length (blob); + } + inline void fini (void) + { + hb_blob_destroy (blob); } - inline void fini (void) {} inline int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right) const { return table->get_h_kerning (left, right, table_length); } private: + hb_blob_t *blob; const kern *table; unsigned int table_length; };