[GPOS] Divide position_finish() into two phases, for advances and offsets Right now the position_finish_advances() is empty. To be used for spacing attachments proposal later.
diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 8795c8a..bc18c87 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh
@@ -1512,7 +1512,8 @@ { return CastR<PosLookup> (GSUBGPOS::get_lookup (i)); } static inline void position_start (hb_font_t *font, hb_buffer_t *buffer); - static inline void position_finish (hb_font_t *font, hb_buffer_t *buffer); + static inline void position_finish_advances (hb_font_t *font, hb_buffer_t *buffer); + static inline void position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer); inline bool sanitize (hb_sanitize_context_t *c) const { @@ -1607,7 +1608,13 @@ } void -GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer) +GPOS::position_finish_advances (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer) +{ + //_hb_buffer_assert_gsubgpos_vars (buffer); +} + +void +GPOS::position_finish_offsets (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer) { _hb_buffer_assert_gsubgpos_vars (buffer);
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 459a1a3..38c2c64 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh
@@ -1268,7 +1268,6 @@ { return CastR<SubstLookup> (GSUBGPOS::get_lookup (i)); } static inline void substitute_start (hb_font_t *font, hb_buffer_t *buffer); - static inline void substitute_finish (hb_font_t *font, hb_buffer_t *buffer); inline bool sanitize (hb_sanitize_context_t *c) const { @@ -1297,11 +1296,6 @@ } } -void -GSUB::substitute_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer HB_UNUSED) -{ -} - /* Out-of-class implementation for methods recursing */
diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh index f48184f..da3ba3a 100644 --- a/src/hb-ot-layout-private.hh +++ b/src/hb-ot-layout-private.hh
@@ -99,21 +99,20 @@ const hb_ot_layout_lookup_accelerator_t &accel); -/* Should be called after all the substitute_lookup's are done */ -HB_INTERNAL void -hb_ot_layout_substitute_finish (hb_font_t *font, - hb_buffer_t *buffer); - - -/* Should be called before all the position_lookup's are done. Resets positions to zero. */ +/* Should be called before all the position_lookup's are done. */ HB_INTERNAL void hb_ot_layout_position_start (hb_font_t *font, hb_buffer_t *buffer); -/* Should be called after all the position_lookup's are done */ +/* Should be called after all the position_lookup's are done, to finish advances. */ HB_INTERNAL void -hb_ot_layout_position_finish (hb_font_t *font, - hb_buffer_t *buffer); +hb_ot_layout_position_finish_advances (hb_font_t *font, + hb_buffer_t *buffer); + +/* Should be called after hb_ot_layout_position_finish_advances, to finish offsets. */ +HB_INTERNAL void +hb_ot_layout_position_finish_offsets (hb_font_t *font, + hb_buffer_t *buffer);
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index cdffc61..adf232b 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc
@@ -771,12 +771,6 @@ OT::GSUB::substitute_start (font, buffer); } -void -hb_ot_layout_substitute_finish (hb_font_t *font, hb_buffer_t *buffer) -{ - OT::GSUB::substitute_finish (font, buffer); -} - /** * hb_ot_layout_lookup_substitute_closure: * @@ -811,9 +805,15 @@ } void -hb_ot_layout_position_finish (hb_font_t *font, hb_buffer_t *buffer) +hb_ot_layout_position_finish_advances (hb_font_t *font, hb_buffer_t *buffer) { - OT::GPOS::position_finish (font, buffer); + OT::GPOS::position_finish_advances (font, buffer); +} + +void +hb_ot_layout_position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer) +{ + OT::GPOS::position_finish_offsets (font, buffer); } /**
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 10c52cf..0b02328 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc
@@ -584,8 +584,6 @@ c->plan->substitute (c->font, buffer); - hb_ot_layout_substitute_finish (c->font, buffer); - return; } @@ -733,9 +731,10 @@ break; } + /* Finishing off GPOS has to follow a certain order. */ + hb_ot_layout_position_finish_advances (c->font, c->buffer); hb_ot_zero_width_default_ignorables (c); - - hb_ot_layout_position_finish (c->font, c->buffer); + hb_ot_layout_position_finish_offsets (c->font, c->buffer); return ret; }