diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index d8e3e6e11..8e2860c91 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -1589,6 +1589,8 @@ 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) { + _hb_buffer_assert_gsubgpos_vars (buffer); + unsigned int len; hb_glyph_position_t *pos = hb_buffer_get_glyph_positions (buffer, &len); hb_direction_t direction = buffer->props.direction; @@ -1600,8 +1602,6 @@ GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer) /* Handle attachments */ for (unsigned int i = 0; i < len; i++) fix_mark_attachment (pos, i, direction); - - _hb_buffer_deallocate_gsubgpos_vars (buffer); } diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index e1939735d..2b421a94f 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -1338,7 +1338,7 @@ struct GSUB : GSUBGPOS void GSUB::substitute_start (hb_font_t *font, hb_buffer_t *buffer) { - _hb_buffer_allocate_gsubgpos_vars (buffer); + _hb_buffer_assert_gsubgpos_vars (buffer); const GDEF &gdef = *hb_ot_layout_from_face (font->face)->gdef; unsigned int count = buffer->len; diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh index d94ac5072..ae7daa6db 100644 --- a/src/hb-ot-layout-private.hh +++ b/src/hb-ot-layout-private.hh @@ -419,6 +419,13 @@ _hb_buffer_deallocate_unicode_vars (hb_buffer_t *buffer) HB_BUFFER_DEALLOCATE_VAR (buffer, unicode_props1); } +static inline void +_hb_buffer_assert_unicode_vars (hb_buffer_t *buffer) +{ + HB_BUFFER_ASSERT_VAR (buffer, unicode_props0); + HB_BUFFER_ASSERT_VAR (buffer, unicode_props1); +} + static inline void _hb_buffer_allocate_gsubgpos_vars (hb_buffer_t *buffer) { @@ -435,6 +442,14 @@ _hb_buffer_deallocate_gsubgpos_vars (hb_buffer_t *buffer) HB_BUFFER_DEALLOCATE_VAR (buffer, glyph_props); } +static inline void +_hb_buffer_assert_gsubgpos_vars (hb_buffer_t *buffer) +{ + HB_BUFFER_ASSERT_VAR (buffer, glyph_props); + HB_BUFFER_ASSERT_VAR (buffer, lig_props); + HB_BUFFER_ASSERT_VAR (buffer, syllable); +} + /* Make sure no one directly touches our props... */ #undef unicode_props0 #undef unicode_props1 diff --git a/src/hb-ot-shape-complex-arabic-fallback.hh b/src/hb-ot-shape-complex-arabic-fallback.hh index e62cea479..e5b7ed489 100644 --- a/src/hb-ot-shape-complex-arabic-fallback.hh +++ b/src/hb-ot-shape-complex-arabic-fallback.hh @@ -271,7 +271,7 @@ arabic_fallback_plan_init_unicode (arabic_fallback_plan_t *fallback_plan, const hb_ot_shape_plan_t *plan, hb_font_t *font) { - ASSERT_STATIC (ARRAY_LENGTH(arabic_fallback_features) <= ARABIC_FALLBACK_MAX_LOOKUPS); + ASSERT_STATIC (ARRAY_LENGTH_CONST(arabic_fallback_features) <= ARABIC_FALLBACK_MAX_LOOKUPS); unsigned int j = 0; for (unsigned int i = 0; i < ARRAY_LENGTH(arabic_fallback_features) ; i++) { diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc index a774f9518..80d7da82f 100644 --- a/src/hb-ot-shape-fallback.cc +++ b/src/hb-ot-shape-fallback.cc @@ -415,6 +415,8 @@ _hb_ot_shape_fallback_position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) { + _hb_buffer_assert_gsubgpos_vars (buffer); + unsigned int start = 0; unsigned int last_cluster = buffer->info[0].cluster; unsigned int count = buffer->len; diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc index 2a6a43900..4287253ae 100644 --- a/src/hb-ot-shape-normalize.cc +++ b/src/hb-ot-shape-normalize.cc @@ -289,6 +289,8 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan, hb_buffer_t *buffer, hb_font_t *font) { + _hb_buffer_assert_unicode_vars (buffer); + hb_ot_shape_normalization_mode_t mode = plan->shaper->normalization_preference; const hb_ot_shape_normalize_context_t c = { plan, diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 0933ca25b..a0b503ab0 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -448,6 +448,7 @@ hb_ot_substitute_complex (hb_ot_shape_context_t *c) { hb_buffer_t *buffer = c->buffer; + _hb_buffer_allocate_gsubgpos_vars (buffer); hb_ot_layout_substitute_start (c->font, buffer); if (!hb_ot_layout_has_glyph_classes (c->face)) @@ -636,6 +637,8 @@ hb_ot_position (hb_ot_shape_context_t *c) if (fallback) _hb_ot_shape_fallback_kern (c->plan, c->font, c->buffer); + + _hb_buffer_deallocate_gsubgpos_vars (c->buffer); }