From 78c09bf21335a0f2b538b37de6647af08e3b1161 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 10 Oct 2018 11:50:46 -0400 Subject: [PATCH] Move subtable array into lookup accel --- src/hb-null.hh | 2 +- src/hb-ot-layout-gsubgpos.hh | 14 +++++++++++--- src/hb-ot-layout.cc | 16 ++++++---------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/hb-null.hh b/src/hb-null.hh index 88c1c9cb6..2509296fb 100644 --- a/src/hb-null.hh +++ b/src/hb-null.hh @@ -36,7 +36,7 @@ /* Global nul-content Null pool. Enlarge as necessary. */ -#define HB_NULL_POOL_SIZE 264 +#define HB_NULL_POOL_SIZE 512 extern HB_INTERNAL hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)]; diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index a11d5dcc5..21a45d50e 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -286,7 +286,7 @@ struct hb_get_subtables_context_t : hb_apply_func_t apply_func; }; - typedef hb_auto_t > array_t; + typedef hb_vector_t array_t; /* Dispatch interface. */ inline const char *get_name (void) { return "GET_SUBTABLES"; } @@ -2619,14 +2619,22 @@ struct hb_ot_layout_lookup_accelerator_t { digest.init (); lookup.add_coverage (&digest); + + subtables.init (); + OT::hb_get_subtables_context_t c_get_subtables (subtables); + lookup.dispatch (&c_get_subtables); + } + inline void fini (void) + { + subtables.fini (); } - inline void fini (void) {} inline bool may_have (hb_codepoint_t g) const { return digest.may_have (g); } - private: + public: hb_set_digest_t digest; + hb_get_subtables_context_t::array_t subtables; }; struct GSUBGPOS diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 572e4cb92..adb1da28a 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -1114,11 +1114,11 @@ struct GPOSProxy static inline bool apply_forward (OT::hb_ot_apply_context_t *c, - const OT::hb_ot_layout_lookup_accelerator_t &accel, - const OT::hb_get_subtables_context_t::array_t &subtables) + const OT::hb_ot_layout_lookup_accelerator_t &accel) { bool ret = false; hb_buffer_t *buffer = c->buffer; + const OT::hb_get_subtables_context_t::array_t &subtables = accel.subtables; while (buffer->idx < buffer->len && buffer->successful) { bool applied = false; @@ -1144,11 +1144,11 @@ apply_forward (OT::hb_ot_apply_context_t *c, static inline bool apply_backward (OT::hb_ot_apply_context_t *c, - const OT::hb_ot_layout_lookup_accelerator_t &accel, - const OT::hb_get_subtables_context_t::array_t &subtables) + const OT::hb_ot_layout_lookup_accelerator_t &accel) { bool ret = false; hb_buffer_t *buffer = c->buffer; + const OT::hb_get_subtables_context_t::array_t &subtables = accel.subtables; do { if (accel.may_have (buffer->cur().codepoint) && @@ -1183,10 +1183,6 @@ apply_string (OT::hb_ot_apply_context_t *c, c->set_lookup_props (lookup.get_props ()); - OT::hb_get_subtables_context_t::array_t subtables; - OT::hb_get_subtables_context_t c_get_subtables (subtables); - lookup.dispatch (&c_get_subtables); - if (likely (!lookup.is_reverse ())) { /* in/out forward substitution/positioning */ @@ -1195,7 +1191,7 @@ apply_string (OT::hb_ot_apply_context_t *c, buffer->idx = 0; bool ret; - ret = apply_forward (c, accel, subtables); + ret = apply_forward (c, accel); if (ret) { if (!Proxy::inplace) @@ -1211,7 +1207,7 @@ apply_string (OT::hb_ot_apply_context_t *c, buffer->remove_output (); buffer->idx = buffer->len - 1; - apply_backward (c, accel, subtables); + apply_backward (c, accel); } }