[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.
This commit is contained in:
Behdad Esfahbod 2016-02-11 16:34:28 +07:00
parent 8474231567
commit 7d8d58ac81
5 changed files with 29 additions and 30 deletions

View File

@ -1512,7 +1512,8 @@ struct GPOS : GSUBGPOS
{ 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 @@ GPOS::position_start (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
}
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);

View File

@ -1268,7 +1268,6 @@ struct GSUB : GSUBGPOS
{ 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 @@ GSUB::substitute_start (hb_font_t *font, hb_buffer_t *buffer)
}
}
void
GSUB::substitute_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer HB_UNUSED)
{
}
/* Out-of-class implementation for methods recursing */

View File

@ -99,21 +99,20 @@ hb_ot_layout_substitute_lookup (OT::hb_apply_context_t *c,
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);

View File

@ -771,12 +771,6 @@ hb_ot_layout_substitute_start (hb_font_t *font, hb_buffer_t *buffer)
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 @@ hb_ot_layout_position_start (hb_font_t *font, hb_buffer_t *buffer)
}
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);
}
/**

View File

@ -584,8 +584,6 @@ hb_ot_substitute_complex (hb_ot_shape_context_t *c)
c->plan->substitute (c->font, buffer);
hb_ot_layout_substitute_finish (c->font, buffer);
return;
}
@ -733,9 +731,10 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
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;
}