@ -332,10 +332,8 @@ initial_reordering_consonant_syllable (const hb_ot_map_t *map, hb_buffer_t *buff
info [ base ] . indic_position ( ) = POS_BASE_C ;
/* Handle beginning Ra */
if ( has_reph ) {
info [ start ] . indic_position ( ) = POS_REPH ;
info [ start ] . mask = mask_array [ RPHF ] ;
}
if ( has_reph )
info [ start ] . indic_position ( ) = POS_RA_TO_BECOME_REPH ;
/* For old-style Indic script tags, move the first post-base Halant after
* last consonant . */
@ -382,6 +380,10 @@ initial_reordering_consonant_syllable (const hb_ot_map_t *map, hb_buffer_t *buff
{
hb_mask_t mask ;
/* Reph */
if ( has_reph )
info [ start ] . mask = mask_array [ RPHF ] ;
/* Pre-base */
mask = mask_array [ HALF ] | mask_array [ AKHN ] | mask_array [ CJCT ] ;
for ( i = start ; i < base ; i + + )
@ -530,8 +532,16 @@ final_reordering_syllable (hb_buffer_t *buffer,
* it will be reordered according to the basic - forms shaping results .
* Possible positions for reph , depending on the script , are ; after main ,
* before post - base consonant forms , and after post - base consonant forms .
*
* 1. If reph should be positioned after post - base consonant forms ,
*/
/* If there's anything after the Ra that has the REPH pos, it ought to be halant.
* Which means that the font has failed to ligate the Reph . In which case , we
* shouldn ' t move . */
if ( start + 1 < end & &
info [ start ] . indic_position ( ) = = POS_RA_TO_BECOME_REPH & &
info [ start + 1 ] . indic_position ( ) ! = POS_RA_TO_BECOME_REPH )
{
/* 1. If reph should be positioned after post-base consonant forms,
* proceed to step 5.
*
* 2. If the reph repositioning class is not after post - base : target
@ -563,8 +573,23 @@ final_reordering_syllable (hb_buffer_t *buffer,
* post - main position .
*
* 6. Otherwise , reorder reph to the end of the syllable .
*
* o Reorder pre - base reordering consonants :
*/
start_of_last_cluster = start ; /* Yay, one big cluster! */
/* Now let's go shopping for a position. */
unsigned int new_reph_pos = end - 1 ;
while ( new_reph_pos > start & & ( FLAG ( info [ new_reph_pos ] . indic_position ( ) ) & ( FLAG ( POS_SMVD ) ) ) )
new_reph_pos - - ;
/* Move */
hb_glyph_info_t reph = info [ start ] ;
memmove ( & info [ start ] , & info [ start + 1 ] , ( new_reph_pos - start ) * sizeof ( info [ 0 ] ) ) ;
info [ new_reph_pos ] = reph ;
}
/* o Reorder pre-base reordering consonants:
*
* If a pre - base reordering consonant is found , reorder it according to
* the following rules :