diff options
Diffstat (limited to 'src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc')
-rw-r--r-- | src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc | 58 |
1 files changed, 39 insertions, 19 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc index 520deff710..183726e63c 100644 --- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc +++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc @@ -33,6 +33,7 @@ #include "hb-ot-layout-gdef-table.hh" #include "hb-ot-layout-gsub-table.hh" #include "hb-ot-layout-gpos-table.hh" +#include "hb-ot-layout-jstf-table.hh" #include "hb-ot-map-private.hh" @@ -413,6 +414,24 @@ hb_ot_layout_feature_get_lookups (hb_face_t *face, return f.get_lookup_indexes (start_offset, lookup_count, lookup_indexes); } +unsigned int +hb_ot_layout_table_get_lookup_count (hb_face_t *face, + hb_tag_t table_tag) +{ + switch (table_tag) + { + case HB_OT_TAG_GSUB: + { + return hb_ot_layout_from_face (face)->gsub_lookup_count; + } + case HB_OT_TAG_GPOS: + { + return hb_ot_layout_from_face (face)->gpos_lookup_count; + } + } + return 0; +} + static void _hb_ot_layout_collect_lookups_lookups (hb_face_t *face, hb_tag_t table_tag, @@ -764,6 +783,7 @@ hb_ot_layout_get_size_params (hb_face_t *face, struct GSUBProxy { static const unsigned int table_index = 0; + static const bool inplace = false; typedef OT::SubstLookup Lookup; GSUBProxy (hb_face_t *face) : @@ -777,6 +797,7 @@ struct GSUBProxy struct GPOSProxy { static const unsigned int table_index = 1; + static const bool inplace = true; typedef OT::PosLookup Lookup; GPOSProxy (hb_face_t *face) : @@ -804,10 +825,9 @@ apply_string (OT::hb_apply_context_t *c, const hb_ot_layout_lookup_accelerator_t &accel) { bool ret = false; - OT::hb_is_inplace_context_t inplace_c (c->face); - bool inplace = lookup.is_inplace (&inplace_c); + hb_buffer_t *buffer = c->buffer; - if (unlikely (!c->buffer->len || !c->lookup_mask)) + if (unlikely (!buffer->len || !c->lookup_mask)) return false; c->set_lookup (lookup); @@ -816,43 +836,43 @@ apply_string (OT::hb_apply_context_t *c, { /* in/out forward substitution/positioning */ if (Proxy::table_index == 0) - c->buffer->clear_output (); - c->buffer->idx = 0; + buffer->clear_output (); + buffer->idx = 0; - while (c->buffer->idx < c->buffer->len) + while (buffer->idx < buffer->len) { - if (accel.digest.may_have (c->buffer->cur().codepoint) && - (c->buffer->cur().mask & c->lookup_mask) && + if (accel.digest.may_have (buffer->cur().codepoint) && + (buffer->cur().mask & c->lookup_mask) && apply_once (c, lookup)) ret = true; else - c->buffer->next_glyph (); + buffer->next_glyph (); } if (ret) { - if (!inplace) - c->buffer->swap_buffers (); + if (!Proxy::inplace) + buffer->swap_buffers (); else - assert (!c->buffer->has_separate_output ()); + assert (!buffer->has_separate_output ()); } } else { /* in-place backward substitution/positioning */ if (Proxy::table_index == 0) - c->buffer->remove_output (); - c->buffer->idx = c->buffer->len - 1; + buffer->remove_output (); + buffer->idx = buffer->len - 1; do { - if (accel.digest.may_have (c->buffer->cur().codepoint) && - (c->buffer->cur().mask & c->lookup_mask) && + if (accel.digest.may_have (buffer->cur().codepoint) && + (buffer->cur().mask & c->lookup_mask) && apply_once (c, lookup)) ret = true; - else - c->buffer->idx--; + /* The reverse lookup doesn't "advance" cursor (for good reason). */ + buffer->idx--; } - while ((int) c->buffer->idx >= 0); + while ((int) buffer->idx >= 0); } return ret; |