[indic] Order left-matras inside-out

Fixes https://github.com/harfbuzz/harfbuzz/issues/3863
This commit is contained in:
Behdad Esfahbod 2022-11-04 16:00:34 -06:00
parent 2822b589bc
commit f53ef69d59
6 changed files with 57 additions and 1 deletions

View File

@ -742,14 +742,40 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
/* Sit tight, rock 'n roll! */
hb_stable_sort (info + start, end - start, compare_indic_order);
/* Find base again */
/* Find base again; also flip left-matra sequence. */
unsigned first_left_matra = end;
unsigned last_left_matra = end;
base = end;
for (unsigned int i = start; i < end; i++)
{
if (info[i].indic_position() == POS_BASE_C)
{
base = i;
break;
}
else if (info[i].indic_position() == POS_PRE_M)
{
if (first_left_matra == end)
first_left_matra = i;
last_left_matra = i;
}
}
/* https://github.com/harfbuzz/harfbuzz/issues/3863 */
if (first_left_matra < last_left_matra)
{
/* No need to merge clusters, handled later. */
buffer->reverse_range (first_left_matra, last_left_matra + 1);
/* Reverse back nuktas, etc. */
unsigned i = first_left_matra;
for (unsigned j = i; j <= last_left_matra; j++)
if (info[j].indic_category() == I_Cat(M))
{
buffer->reverse_range (i, j + 1);
i = j + 1;
}
}
/* Things are out-of-control for post base positions, they may shuffle
* around like crazy. In old-spec mode, we move halants around, so in
* that case merge all clusters after base. Otherwise, check the sort

View File

@ -270,6 +270,33 @@ initial_reordering_consonant_syllable (hb_buffer_t *buffer,
/* Sit tight, rock 'n roll! */
buffer->sort (start, end, compare_myanmar_order);
/* Flip left-matra sequence. */
unsigned first_left_matra = end;
unsigned last_left_matra = end;
for (unsigned int i = start; i < end; i++)
{
if (info[i].myanmar_position() == POS_PRE_M)
{
if (first_left_matra == end)
first_left_matra = i;
last_left_matra = i;
}
}
/* https://github.com/harfbuzz/harfbuzz/issues/3863 */
if (first_left_matra < last_left_matra)
{
/* No need to merge clusters, done already? */
buffer->reverse_range (first_left_matra, last_left_matra + 1);
/* Reverse back VS, etc. */
unsigned i = first_left_matra;
for (unsigned j = i; j <= last_left_matra; j++)
if (info[j].myanmar_category() == M_Cat(VPre))
{
buffer->reverse_range (i, j + 1);
i = j + 1;
}
}
}
static void

View File

@ -2,3 +2,5 @@
../fonts/3cae6bfe5b57c07ba81ddbd54c02fe4f3a1e3bf6.ttf;;U+0CB0,U+200D,U+0CCD,U+0C95;[gid2=0+1334|gid6=0+358]
../fonts/3cae6bfe5b57c07ba81ddbd54c02fe4f3a1e3bf6.ttf;;U+0CB0,U+0CCD,U+200D,U+0C95;[gid2=0+1334|gid6=0+358]
../fonts/e716f6bd00a108d186b7e9f47b4515565f784f36.ttf;;U+0C1A,U+0C3F,U+0C32,U+0C4D,U+0C15,U+0C42,U+0C30,U+0C4D;[civoweltelu=0+766|latelu=2+709|uuvowelsigntelu=2+661|kasubscripttelu=2+483|rahalanttelu=6+593]
../fonts/9d8c53cb64b8747abdd2b70755cce2ee0eb42ef7.ttf;;U+0915,U+093F,U+094E,U+093C;[uni094E=0+273|uni093C=0+0|ivowelsign03deva=0+259|uni0915=0+762]
../fonts/9d8c53cb64b8747abdd2b70755cce2ee0eb42ef7.ttf;;U+0915,U+093F,U+093C,U+094E;[uni094E=0+273|ivowelsign00deva=0+259|uni093C=0+0|uni0915=0+762]

View File

@ -1 +1,2 @@
../fonts/065b01e54f35f0d849fd43bd5b936212739a50cb.ttf;;U+101A,U+1035;[ya_e_above=0+1000]
../fonts/a232bb734d4c6c898a44506547d19768f0eba6a6.ttf;;U+1000,U+1031,U+1084;[e_shn=0+592|_e=0+618|ka=0+1124]