diff --git a/src/hb-ot-layout-gpos-private.h b/src/hb-ot-layout-gpos-private.h index b0b951353..056131b26 100644 --- a/src/hb-ot-layout-gpos-private.h +++ b/src/hb-ot-layout-gpos-private.h @@ -843,16 +843,24 @@ struct PosLookup : Lookup { if (HB_UNLIKELY (!buffer->in_length)) return false; - _hb_buffer_clear_positions (buffer); + layout->gpos_info.last = 0xFFFF; /* no last valid glyph for cursive pos. */ + buffer->in_pos = 0; while (buffer->in_pos < buffer->in_length) { - if ((~IN_PROPERTIES (buffer->in_pos) & mask) && - position_once (layout, buffer)) - ret = true; - else - _hb_buffer_next_glyph (buffer); + bool done; + if (~IN_PROPERTIES (buffer->in_pos) & mask) { + done = position_once (layout, buffer); + ret |= done; + } else { + done = false; + /* Contrary to properties defined in GDEF, user-defined properties + will always stop a possible cursive positioning. */ + layout->gpos_info.last = 0xFFFF; + } + if (!done) + buffer->in_pos++; } return ret; diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 46f455537..4bb2eb586 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -531,6 +531,19 @@ hb_ot_layout_substitute_lookup (hb_ot_layout_t *layout, return layout->gsub->substitute_lookup (layout, buffer, lookup_index, mask); } +/* + * GPOS + */ + +hb_bool_t +hb_ot_layout_position_lookup (hb_ot_layout_t *layout, + hb_buffer_t *buffer, + unsigned int lookup_index, + hb_ot_layout_feature_mask_t mask) +{ + return layout->gpos->position_lookup (layout, buffer, lookup_index, mask); +} + /* TODO dupped, until he old code can be removed */ diff --git a/src/hb-ot-layout.h b/src/hb-ot-layout.h index f6c0c448e..f907b65b3 100644 --- a/src/hb-ot-layout.h +++ b/src/hb-ot-layout.h @@ -207,6 +207,11 @@ hb_ot_layout_substitute_lookup (hb_ot_layout_t *layout, unsigned int lookup_index, hb_ot_layout_feature_mask_t mask); +hb_bool_t +hb_ot_layout_position_lookup (hb_ot_layout_t *layout, + hb_buffer_t *buffer, + unsigned int lookup_index, + hb_ot_layout_feature_mask_t mask);