[ot] Fold hb_ot_face_kern_accelerator_t
diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index 4741601..8d8d68b 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc
@@ -335,27 +335,6 @@ } }; -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<OT::kern>::sanitize (face->reference_table (HB_OT_TAG_kern)); - accel.init (OT::Sanitizer<OT::kern>::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 @@ OT::hb_lazy_loader_t<hb_ot_face_glyf_accelerator_t> glyf; OT::hb_lazy_loader_t<hb_ot_face_cbdt_accelerator_t> cbdt; OT::hb_lazy_loader_t<hb_ot_face_post_accelerator_t> post; - OT::hb_lazy_loader_t<hb_ot_face_kern_accelerator_t> kern; + OT::hb_lazy_loader_t<OT::kern::accelerator_t> kern; };
diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh index 5fd2e20..aa293b8 100644 --- a/src/hb-ot-kern-table.hh +++ b/src/hb-ot-kern-table.hh
@@ -358,17 +358,22 @@ 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<kern>::sanitize (face->reference_table (HB_OT_TAG_kern)); + table = Sanitizer<kern>::lock_instance (blob); + table_length = hb_blob_get_length (blob); } - inline void fini (void) {} + inline void fini (void) + { + hb_blob_destroy (blob); + } 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; };