[indic/khmer/myanmar/use] Clarify clear_syllable

No logic change.
This commit is contained in:
Behdad Esfahbod 2018-10-26 15:40:12 -07:00
parent 143ffe65aa
commit 982c2f4a65
4 changed files with 43 additions and 36 deletions

View File

@ -116,7 +116,8 @@ indic_features[] =
{HB_TAG('c','j','c','t'), F_GLOBAL_MANUAL_JOINERS},
/*
* Other features.
* These features are applied all at once, after final_reordering.
* These features are applied all at once, after final_reordering
* but before clearing syllables.
* Default Bengali font in Windows for example has intermixed
* lookups for init,pres,abvs,blws features.
*/

View File

@ -46,7 +46,7 @@ khmer_features[] =
{HB_TAG('c','f','a','r'), F_MANUAL_JOINERS},
/*
* Other features.
* These features are applied all at once.
* These features are applied all at once after clearing syllables.
*/
{HB_TAG('p','r','e','s'), F_GLOBAL_MANUAL_JOINERS},
{HB_TAG('a','b','v','s'), F_GLOBAL_MANUAL_JOINERS},
@ -438,8 +438,6 @@ clear_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED,
hb_font_t *font HB_UNUSED,
hb_buffer_t *buffer)
{
/* TODO: In USE, we clear syllables right after reorder. Figure out
* what Uniscribe does. */
hb_glyph_info_t *info = buffer->info;
unsigned int count = buffer->len;
for (unsigned int i = 0; i < count; i++)

View File

@ -36,7 +36,7 @@ basic_features[] =
{
/*
* Basic features.
* These features are applied in order, one at a time, after initial_reordering.
* These features are applied in order, one at a time, after reordering.
*/
HB_TAG('r','p','h','f'),
HB_TAG('p','r','e','f'),
@ -48,7 +48,7 @@ other_features[] =
{
/*
* Other features.
* These features are applied all at once, after final_reordering.
* These features are applied all at once, after clearing syllables.
*/
HB_TAG('p','r','e','s'),
HB_TAG('a','b','v','s'),
@ -80,11 +80,11 @@ setup_syllables (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer);
static void
initial_reordering (const hb_ot_shape_plan_t *plan,
reorder (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer);
static void
final_reordering (const hb_ot_shape_plan_t *plan,
clear_syllables (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer);
@ -102,7 +102,7 @@ collect_features_myanmar (hb_ot_shape_planner_t *plan)
map->enable_feature (HB_TAG('c','c','m','p'));
map->add_gsub_pause (initial_reordering);
map->add_gsub_pause (reorder);
for (unsigned int i = 0; i < ARRAY_LENGTH (basic_features); i++)
{
@ -110,7 +110,7 @@ collect_features_myanmar (hb_ot_shape_planner_t *plan)
map->add_gsub_pause (nullptr);
}
map->add_gsub_pause (final_reordering);
map->add_gsub_pause (clear_syllables);
for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++)
map->enable_feature (other_features[i], F_MANUAL_ZWJ);
@ -348,7 +348,7 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED,
}
static void
initial_reordering (const hb_ot_shape_plan_t *plan,
reorder (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer)
{
@ -356,22 +356,20 @@ initial_reordering (const hb_ot_shape_plan_t *plan,
foreach_syllable (buffer, start, end)
initial_reordering_syllable (plan, font->face, buffer, start, end);
HB_BUFFER_DEALLOCATE_VAR (buffer, myanmar_category);
HB_BUFFER_DEALLOCATE_VAR (buffer, myanmar_position);
}
static void
final_reordering (const hb_ot_shape_plan_t *plan,
clear_syllables (const hb_ot_shape_plan_t *plan,
hb_font_t *font HB_UNUSED,
hb_buffer_t *buffer)
{
hb_glyph_info_t *info = buffer->info;
unsigned int count = buffer->len;
/* Zero syllables now... */
for (unsigned int i = 0; i < count; i++)
info[i].syllable() = 0;
HB_BUFFER_DEALLOCATE_VAR (buffer, myanmar_category);
HB_BUFFER_DEALLOCATE_VAR (buffer, myanmar_position);
}

View File

@ -80,7 +80,8 @@ other_features[] =
{
/*
* Other features.
* These features are applied all at once, after reordering.
* These features are applied all at once, after reordering and
* clearing syllables.
*/
HB_TAG('a','b','v','s'),
HB_TAG('b','l','w','s'),
@ -120,6 +121,10 @@ static void
reorder (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer);
static void
clear_syllables (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer);
static void
collect_features_use (hb_ot_shape_planner_t *plan)
@ -148,6 +153,7 @@ collect_features_use (hb_ot_shape_planner_t *plan)
map->enable_feature (basic_features[i], F_MANUAL_ZWJ);
map->add_gsub_pause (reorder);
map->add_gsub_pause (clear_syllables);
/* "Topographical features" */
for (unsigned int i = 0; i < ARRAY_LENGTH (arabic_features); i++)
@ -559,17 +565,21 @@ reorder (const hb_ot_shape_plan_t *plan,
{
insert_dotted_circles (plan, font, buffer);
hb_glyph_info_t *info = buffer->info;
foreach_syllable (buffer, start, end)
reorder_syllable (buffer, start, end);
/* Zero syllables now... */
HB_BUFFER_DEALLOCATE_VAR (buffer, use_category);
}
static void
clear_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED,
hb_font_t *font HB_UNUSED,
hb_buffer_t *buffer)
{
hb_glyph_info_t *info = buffer->info;
unsigned int count = buffer->len;
for (unsigned int i = 0; i < count; i++)
info[i].syllable() = 0;
HB_BUFFER_DEALLOCATE_VAR (buffer, use_category);
}