[indic-like] Move allocation of syllable() buffer var to shapers that use it
In indic, we don't have a pause location release the var.
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 35e887b..299a712 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -260,7 +260,6 @@
{
_hb_glyph_info_set_glyph_props (&buffer->info[i], gdef.get_glyph_props (buffer->info[i].codepoint));
_hb_glyph_info_clear_lig_props (&buffer->info[i]);
- buffer->info[i].syllable() = 0;
}
}
diff --git a/src/hb-ot-layout.hh b/src/hb-ot-layout.hh
index 75bba0b..6395f06 100644
--- a/src/hb-ot-layout.hh
+++ b/src/hb-ot-layout.hh
@@ -589,13 +589,11 @@
{
HB_BUFFER_ALLOCATE_VAR (buffer, glyph_props);
HB_BUFFER_ALLOCATE_VAR (buffer, lig_props);
- HB_BUFFER_ALLOCATE_VAR (buffer, syllable);
}
static inline void
_hb_buffer_deallocate_gsubgpos_vars (hb_buffer_t *buffer)
{
- HB_BUFFER_DEALLOCATE_VAR (buffer, syllable);
HB_BUFFER_DEALLOCATE_VAR (buffer, lig_props);
HB_BUFFER_DEALLOCATE_VAR (buffer, glyph_props);
}
@@ -605,7 +603,6 @@
{
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... */
diff --git a/src/hb-ot-shaper-indic.cc b/src/hb-ot-shaper-indic.cc
index 2c8f7c5..c239170 100644
--- a/src/hb-ot-shaper-indic.cc
+++ b/src/hb-ot-shaper-indic.cc
@@ -356,6 +356,7 @@
hb_font_t *font HB_UNUSED,
hb_buffer_t *buffer)
{
+ HB_BUFFER_ALLOCATE_VAR (buffer, syllable);
find_syllables_indic (buffer);
foreach_syllable (buffer, start, end)
buffer->unsafe_to_break (start, end);
diff --git a/src/hb-ot-shaper-khmer.cc b/src/hb-ot-shaper-khmer.cc
index 7aca156..a7c35ad 100644
--- a/src/hb-ot-shaper-khmer.cc
+++ b/src/hb-ot-shaper-khmer.cc
@@ -115,7 +115,7 @@
map->add_feature (khmer_features[i]);
/* https://github.com/harfbuzz/harfbuzz/issues/3531 */
- map->add_gsub_pause (nullptr);
+ map->add_gsub_pause (hb_syllabic_clear_var); // Don't need syllables anymore, use stop to free buffer var
for (; i < KHMER_NUM_FEATURES; i++)
map->add_feature (khmer_features[i]);
@@ -187,6 +187,7 @@
hb_font_t *font HB_UNUSED,
hb_buffer_t *buffer)
{
+ HB_BUFFER_ALLOCATE_VAR (buffer, syllable);
find_syllables_khmer (buffer);
foreach_syllable (buffer, start, end)
buffer->unsafe_to_break (start, end);
diff --git a/src/hb-ot-shaper-myanmar.cc b/src/hb-ot-shaper-myanmar.cc
index 8cc373a..ecb4cf1 100644
--- a/src/hb-ot-shaper-myanmar.cc
+++ b/src/hb-ot-shaper-myanmar.cc
@@ -92,6 +92,7 @@
map->enable_feature (myanmar_basic_features[i], F_MANUAL_ZWJ | F_PER_SYLLABLE);
map->add_gsub_pause (nullptr);
}
+ map->add_gsub_pause (hb_syllabic_clear_var); // Don't need syllables anymore, use stop to free buffer var
for (unsigned int i = 0; i < ARRAY_LENGTH (myanmar_other_features); i++)
map->enable_feature (myanmar_other_features[i], F_MANUAL_ZWJ);
@@ -118,6 +119,7 @@
hb_font_t *font HB_UNUSED,
hb_buffer_t *buffer)
{
+ HB_BUFFER_ALLOCATE_VAR (buffer, syllable);
find_syllables_myanmar (buffer);
foreach_syllable (buffer, start, end)
buffer->unsafe_to_break (start, end);
diff --git a/src/hb-ot-shaper-syllabic.cc b/src/hb-ot-shaper-syllabic.cc
index 686015d..58d6942 100644
--- a/src/hb-ot-shaper-syllabic.cc
+++ b/src/hb-ot-shaper-syllabic.cc
@@ -99,5 +99,13 @@
buffer->sync ();
}
+HB_INTERNAL void
+hb_syllabic_clear_var (const hb_ot_shape_plan_t *plan,
+ hb_font_t *font,
+ hb_buffer_t *buffer)
+{
+ HB_BUFFER_DEALLOCATE_VAR (buffer, syllable);
+}
+
#endif
diff --git a/src/hb-ot-shaper-syllabic.hh b/src/hb-ot-shaper-syllabic.hh
index a250967..e8a15bb 100644
--- a/src/hb-ot-shaper-syllabic.hh
+++ b/src/hb-ot-shaper-syllabic.hh
@@ -38,5 +38,10 @@
int repha_category = -1,
int dottedcircle_position = -1);
+HB_INTERNAL void
+hb_syllabic_clear_var (const hb_ot_shape_plan_t *plan,
+ hb_font_t *font,
+ hb_buffer_t *buffer);
+
#endif /* HB_OT_SHAPER_SYLLABIC_HH */
diff --git a/src/hb-ot-shaper-use.cc b/src/hb-ot-shaper-use.cc
index 98f0f99..b4cdf6d 100644
--- a/src/hb-ot-shaper-use.cc
+++ b/src/hb-ot-shaper-use.cc
@@ -133,6 +133,7 @@
map->enable_feature (use_basic_features[i], F_MANUAL_ZWJ | F_PER_SYLLABLE);
map->add_gsub_pause (reorder_use);
+ map->add_gsub_pause (hb_syllabic_clear_var); // Don't need syllables anymore, use stop to free buffer var
/* "Topographical features" */
for (unsigned int i = 0; i < ARRAY_LENGTH (use_topographical_features); i++)
@@ -297,6 +298,7 @@
hb_font_t *font HB_UNUSED,
hb_buffer_t *buffer)
{
+ HB_BUFFER_ALLOCATE_VAR (buffer, syllable);
find_syllables_use (buffer);
foreach_syllable (buffer, start, end)
buffer->unsafe_to_break (start, end);