From 702d86ba6b4a2e41cbee46fea18b3f8eb8986dc9 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 14 Nov 2017 19:25:38 -0800 Subject: [PATCH] [ot] Fold hb_ot_face_kern_accelerator_t --- src/hb-ot-font.cc | 23 +---------------------- src/hb-ot-kern-table.hh | 13 +++++++++---- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index 47416012c..8d8d68b19 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 5fd2e20e6..aa293b8de 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; };