diff --git a/src/hb-ot-face.hh b/src/hb-ot-face.hh index 6e629eb41..caa1d97ef 100644 --- a/src/hb-ot-face.hh +++ b/src/hb-ot-face.hh @@ -67,7 +67,7 @@ HB_OT_ACCELERATOR(OT, hmtx) \ HB_OT_ACCELERATOR(OT, vmtx) \ HB_OT_ACCELERATOR(OT, post) \ - HB_OT_ACCELERATOR(OT, kern) \ + HB_OT_TABLE(OT, kern) \ HB_OT_ACCELERATOR(OT, glyf) \ HB_OT_TABLE(OT, VORG) \ HB_OT_ACCELERATOR(OT, name) \ diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh index 4f196789f..8c436f990 100644 --- a/src/hb-ot-kern-table.hh +++ b/src/hb-ot-kern-table.hh @@ -503,49 +503,26 @@ struct kern } } - struct accelerator_t + inline int get_kerning (hb_codepoint_t first, hb_codepoint_t second) const + { return get_h_kerning (first, second); } + + inline void apply (hb_font_t *font, + hb_buffer_t *buffer, + hb_mask_t kern_mask) const { - inline void init (hb_face_t *face) - { - blob = hb_sanitize_context_t().reference_table (face); - table = blob->as (); - } - inline void fini (void) - { - hb_blob_destroy (blob); - } + /* We only apply horizontal kerning in this table. */ + if (!HB_DIRECTION_IS_HORIZONTAL (buffer->props.direction)) + return; - inline bool has_data (void) const - { return table->has_data (); } + hb_kern_machine_t machine (*this); - inline int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right) const - { return table->get_h_kerning (left, right); } + if (!buffer->message (font, "start kern table")) + return; - inline int get_kerning (hb_codepoint_t first, hb_codepoint_t second) const - { return get_h_kerning (first, second); } + machine.kern (font, buffer, kern_mask); - inline void apply (hb_font_t *font, - hb_buffer_t *buffer, - hb_mask_t kern_mask) const - { - /* We only apply horizontal kerning in this table. */ - if (!HB_DIRECTION_IS_HORIZONTAL (buffer->props.direction)) - return; - - hb_kern_machine_t machine (*this); - - if (!buffer->message (font, "start kern table")) - return; - - machine.kern (font, buffer, kern_mask); - - (void) buffer->message (font, "end kern table"); - } - - private: - hb_blob_t *blob; - const kern *table; - }; + (void) buffer->message (font, "end kern table"); + } protected: union { @@ -558,8 +535,6 @@ struct kern DEFINE_SIZE_UNION (4, version32); }; -struct kern_accelerator_t : kern::accelerator_t {}; - } /* namespace OT */ diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index e1b6b2e30..f4ae840b6 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -55,9 +55,9 @@ **/ -static const OT::kern::accelerator_t& _get_kern (hb_face_t *face) +static const OT::kern& _get_kern (hb_face_t *face) { - if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::kern::accelerator_t); + if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::kern); return *hb_ot_face_data (face)->kern; } const OT::GDEF& _get_gdef (hb_face_t *face)