[Indic] Don't attach SM/VD to other characters

This commit is contained in:
Behdad Esfahbod 2012-07-20 15:10:02 -04:00
parent efb4ad7356
commit 81202bd860
2 changed files with 24 additions and 17 deletions

View File

@ -83,6 +83,8 @@ enum indic_category_t {
/* Visual positions in a syllable from left to right. */ /* Visual positions in a syllable from left to right. */
enum indic_position_t { enum indic_position_t {
POS_START,
POS_RA_TO_BECOME_REPH, POS_RA_TO_BECOME_REPH,
POS_PRE_M, POS_PRE_M,
POS_PRE_C, POS_PRE_C,
@ -102,6 +104,7 @@ enum indic_position_t {
POS_FINAL_C, POS_FINAL_C,
POS_SMVD, POS_SMVD,
POS_END POS_END
}; };

View File

@ -634,29 +634,32 @@ initial_reordering_consonant_syllable (const hb_ot_map_t *map, hb_buffer_t *buff
} }
} }
/* Attach ZWJ, ZWNJ, nukta, and halant to previous char to move with them. */ /* Attach misc marks to previous char to move with them. */
if (!indic_options ().uniscribe_bug_compatible) {
indic_position_t last_pos = POS_START;
for (unsigned int i = start; i < end; i++)
{
if ((FLAG (info[i].indic_category()) & (JOINER_FLAGS | FLAG (OT_N) | FLAG (OT_RS) | HALANT_OR_COENG_FLAGS)))
{
info[i].indic_position() = last_pos;
if (unlikely (indic_options ().uniscribe_bug_compatible &&
info[i].indic_category() == OT_H &&
info[i].indic_position() == POS_PRE_M))
{ {
/* Please update the Uniscribe branch when touching this! */
for (unsigned int i = start + 1; i < end; i++)
if ((FLAG (info[i].indic_category()) & (FLAG (OT_ZWNJ) | FLAG (OT_ZWJ) | FLAG (OT_N) | FLAG (OT_RS) | FLAG (OT_H))))
info[i].indic_position() = info[i - 1].indic_position();
} else {
/* /*
* Uniscribe doesn't move the Halant with Left Matra. * Uniscribe doesn't move the Halant with Left Matra.
* TEST: U+092B,U+093F,U+094DE * TEST: U+092B,U+093F,U+094DE
*/ */
/* Please update the non-Uniscribe branch when touching this! */
for (unsigned int i = start + 1; i < end; i++)
if ((FLAG (info[i].indic_category()) & (FLAG (OT_ZWNJ) | FLAG (OT_ZWJ) | FLAG (OT_N) | FLAG (OT_RS) | FLAG (OT_H)))) {
info[i].indic_position() = info[i - 1].indic_position();
if (info[i].indic_category() == OT_H && info[i].indic_position() == POS_PRE_M)
for (unsigned int j = i; j > start; j--) for (unsigned int j = i; j > start; j--)
if (info[j - 1].indic_position() != POS_PRE_M) { if (info[j - 1].indic_position() != POS_PRE_M) {
info[i].indic_position() = info[j - 1].indic_position(); info[i].indic_position() = info[j - 1].indic_position();
break; break;
} }
} }
} else if (info[i].indic_position() != POS_SMVD) {
last_pos = (indic_position_t) info[i].indic_position();
}
}
} }
/* Re-attach ZWJ, ZWNJ, and halant to next char, for after-base consonants. */ /* Re-attach ZWJ, ZWNJ, and halant to next char, for after-base consonants. */
{ {
@ -666,6 +669,7 @@ initial_reordering_consonant_syllable (const hb_ot_map_t *map, hb_buffer_t *buff
last_halant = i; last_halant = i;
else if (is_consonant (info[i])) { else if (is_consonant (info[i])) {
for (unsigned int j = last_halant; j < i; j++) for (unsigned int j = last_halant; j < i; j++)
if (info[j].indic_position() != POS_SMVD)
info[j].indic_position() = info[i].indic_position(); info[j].indic_position() = info[i].indic_position();
} }
} }