[khmer] Remove Halant from Khmer shaper
This commit is contained in:
parent
9761f9d782
commit
961ebf85f1
|
@ -73,7 +73,6 @@ enum indic_category_t {
|
||||||
* consonant syllable logic from the vowel syllable function and get it all right! */
|
* consonant syllable logic from the vowel syllable function and get it all right! */
|
||||||
#define CONSONANT_FLAGS (FLAG (OT_C) | FLAG (OT_CS) | FLAG (OT_Ra) | MEDIAL_FLAGS | FLAG (OT_V) | FLAG (OT_PLACEHOLDER) | FLAG (OT_DOTTEDCIRCLE))
|
#define CONSONANT_FLAGS (FLAG (OT_C) | FLAG (OT_CS) | FLAG (OT_Ra) | MEDIAL_FLAGS | FLAG (OT_V) | FLAG (OT_PLACEHOLDER) | FLAG (OT_DOTTEDCIRCLE))
|
||||||
#define JOINER_FLAGS (FLAG (OT_ZWJ) | FLAG (OT_ZWNJ))
|
#define JOINER_FLAGS (FLAG (OT_ZWJ) | FLAG (OT_ZWNJ))
|
||||||
#define HALANT_OR_COENG_FLAGS (FLAG (OT_H) | FLAG (OT_Coeng))
|
|
||||||
|
|
||||||
|
|
||||||
/* Visual positions in a syllable from left to right. */
|
/* Visual positions in a syllable from left to right. */
|
||||||
|
|
|
@ -62,7 +62,6 @@ CS = 19;
|
||||||
c = (C | Ra); # is_consonant
|
c = (C | Ra); # is_consonant
|
||||||
n = ((ZWNJ?.RS)? (N.N?)?); # is_consonant_modifier
|
n = ((ZWNJ?.RS)? (N.N?)?); # is_consonant_modifier
|
||||||
z = ZWJ|ZWNJ; # is_joiner
|
z = ZWJ|ZWNJ; # is_joiner
|
||||||
h = H | Coeng; # is_halant_or_coeng
|
|
||||||
reph = (Ra H | Repha); # possible reph
|
reph = (Ra H | Repha); # possible reph
|
||||||
|
|
||||||
cn = c.ZWJ?.n?;
|
cn = c.ZWJ?.n?;
|
||||||
|
@ -71,10 +70,10 @@ symbol = Symbol.N?;
|
||||||
matra_group = z{0,3}.M.N?.(H | forced_rakar)?;
|
matra_group = z{0,3}.M.N?.(H | forced_rakar)?;
|
||||||
syllable_tail = (z?.SM.SM?.ZWNJ?)? A{0,3}? VD{0,2};
|
syllable_tail = (z?.SM.SM?.ZWNJ?)? A{0,3}? VD{0,2};
|
||||||
place_holder = PLACEHOLDER | DOTTEDCIRCLE;
|
place_holder = PLACEHOLDER | DOTTEDCIRCLE;
|
||||||
halant_group = (z?.h.(ZWJ.N?)?);
|
halant_group = (z?.Coeng.(ZWJ.N?)?);
|
||||||
final_halant_group = halant_group | h.ZWNJ;
|
final_halant_group = halant_group | Coeng.ZWNJ;
|
||||||
medial_group = CM?;
|
medial_group = CM?;
|
||||||
halant_or_matra_group = (final_halant_group | (h.ZWJ)? matra_group{0,4}) (Coeng (cn|V))?;
|
halant_or_matra_group = (final_halant_group | (Coeng.ZWJ)? matra_group{0,4}) (Coeng (cn|V))?;
|
||||||
|
|
||||||
|
|
||||||
consonant_syllable = (Repha|CS)? (cn.halant_group){0,4} cn medial_group halant_or_matra_group syllable_tail;
|
consonant_syllable = (Repha|CS)? (cn.halant_group){0,4} cn medial_group halant_or_matra_group syllable_tail;
|
||||||
|
|
|
@ -161,9 +161,9 @@ is_consonant (const hb_glyph_info_t &info)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
is_halant_or_coeng (const hb_glyph_info_t &info)
|
is_coeng (const hb_glyph_info_t &info)
|
||||||
{
|
{
|
||||||
return is_one_of (info, HALANT_OR_COENG_FLAGS);
|
return is_one_of (info, FLAG (OT_Coeng));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
@ -971,7 +971,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
|
||||||
khmer_position_t last_pos = POS_START;
|
khmer_position_t last_pos = POS_START;
|
||||||
for (unsigned int i = start; i < end; i++)
|
for (unsigned int i = start; i < end; i++)
|
||||||
{
|
{
|
||||||
if ((FLAG_UNSAFE (info[i].khmer_category()) & (JOINER_FLAGS | FLAG (OT_N) | FLAG (OT_RS) | MEDIAL_FLAGS | HALANT_OR_COENG_FLAGS)))
|
if ((FLAG_UNSAFE (info[i].khmer_category()) & (JOINER_FLAGS | FLAG (OT_N) | FLAG (OT_RS) | MEDIAL_FLAGS | FLAG (OT_Coeng))))
|
||||||
{
|
{
|
||||||
info[i].khmer_position() = last_pos;
|
info[i].khmer_position() = last_pos;
|
||||||
if (unlikely (info[i].khmer_category() == OT_H &&
|
if (unlikely (info[i].khmer_category() == OT_H &&
|
||||||
|
@ -1313,7 +1313,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
|
||||||
_hb_glyph_info_ligated (&info[i]) &&
|
_hb_glyph_info_ligated (&info[i]) &&
|
||||||
_hb_glyph_info_multiplied (&info[i]))
|
_hb_glyph_info_multiplied (&info[i]))
|
||||||
{
|
{
|
||||||
/* This will make sure that this glyph passes is_halant_or_coeng() test. */
|
/* This will make sure that this glyph passes is_coeng() test. */
|
||||||
info[i].khmer_category() = OT_H;
|
info[i].khmer_category() = OT_H;
|
||||||
_hb_glyph_info_clear_ligated_and_multiplied (&info[i]);
|
_hb_glyph_info_clear_ligated_and_multiplied (&info[i]);
|
||||||
}
|
}
|
||||||
|
@ -1346,7 +1346,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
|
||||||
/* Ok, this was a 'pref' candidate but didn't form any.
|
/* Ok, this was a 'pref' candidate but didn't form any.
|
||||||
* Base is around here... */
|
* Base is around here... */
|
||||||
base = i;
|
base = i;
|
||||||
while (base < end && is_halant_or_coeng (info[base]))
|
while (base < end && is_coeng (info[base]))
|
||||||
base++;
|
base++;
|
||||||
info[base].khmer_position() = POS_BASE_C;
|
info[base].khmer_position() = POS_BASE_C;
|
||||||
|
|
||||||
|
@ -1362,7 +1362,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
|
||||||
{
|
{
|
||||||
while (i < end && is_joiner (info[i]))
|
while (i < end && is_joiner (info[i]))
|
||||||
i++;
|
i++;
|
||||||
if (i == end || !is_halant_or_coeng (info[i]))
|
if (i == end || !is_coeng (info[i]))
|
||||||
break;
|
break;
|
||||||
i++; /* Skip halant. */
|
i++; /* Skip halant. */
|
||||||
while (i < end && is_joiner (info[i]))
|
while (i < end && is_joiner (info[i]))
|
||||||
|
@ -1384,7 +1384,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
|
||||||
base--;
|
base--;
|
||||||
if (base < end)
|
if (base < end)
|
||||||
while (start < base &&
|
while (start < base &&
|
||||||
is_one_of (info[base], (FLAG (OT_N) | HALANT_OR_COENG_FLAGS)))
|
is_one_of (info[base], (FLAG (OT_N) | FLAG (OT_Coeng))))
|
||||||
base--;
|
base--;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1410,13 +1410,13 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
|
||||||
if (buffer->props.script != HB_SCRIPT_MALAYALAM && buffer->props.script != HB_SCRIPT_TAMIL)
|
if (buffer->props.script != HB_SCRIPT_MALAYALAM && buffer->props.script != HB_SCRIPT_TAMIL)
|
||||||
{
|
{
|
||||||
while (new_pos > start &&
|
while (new_pos > start &&
|
||||||
!(is_one_of (info[new_pos], (FLAG (OT_M) | HALANT_OR_COENG_FLAGS))))
|
!(is_one_of (info[new_pos], (FLAG (OT_M) | FLAG (OT_Coeng)))))
|
||||||
new_pos--;
|
new_pos--;
|
||||||
|
|
||||||
/* If we found no Halant we are done.
|
/* If we found no Halant we are done.
|
||||||
* Otherwise only proceed if the Halant does
|
* Otherwise only proceed if the Halant does
|
||||||
* not belong to the Matra itself! */
|
* not belong to the Matra itself! */
|
||||||
if (is_halant_or_coeng (info[new_pos]) &&
|
if (is_coeng (info[new_pos]) &&
|
||||||
info[new_pos].khmer_position() != POS_PRE_M)
|
info[new_pos].khmer_position() != POS_PRE_M)
|
||||||
{
|
{
|
||||||
/* -> If ZWJ or ZWNJ follow this halant, position is moved after it. */
|
/* -> If ZWJ or ZWNJ follow this halant, position is moved after it. */
|
||||||
|
@ -1506,10 +1506,10 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
new_reph_pos = start + 1;
|
new_reph_pos = start + 1;
|
||||||
while (new_reph_pos < base && !is_halant_or_coeng (info[new_reph_pos]))
|
while (new_reph_pos < base && !is_coeng (info[new_reph_pos]))
|
||||||
new_reph_pos++;
|
new_reph_pos++;
|
||||||
|
|
||||||
if (new_reph_pos < base && is_halant_or_coeng (info[new_reph_pos]))
|
if (new_reph_pos < base && is_coeng (info[new_reph_pos]))
|
||||||
{
|
{
|
||||||
/* ->If ZWJ or ZWNJ are following this halant, position is moved after it. */
|
/* ->If ZWJ or ZWNJ are following this halant, position is moved after it. */
|
||||||
if (new_reph_pos + 1 < base && is_joiner (info[new_reph_pos + 1]))
|
if (new_reph_pos + 1 < base && is_joiner (info[new_reph_pos + 1]))
|
||||||
|
@ -1558,10 +1558,10 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
|
||||||
{
|
{
|
||||||
/* Copied from step 2. */
|
/* Copied from step 2. */
|
||||||
new_reph_pos = start + 1;
|
new_reph_pos = start + 1;
|
||||||
while (new_reph_pos < base && !is_halant_or_coeng (info[new_reph_pos]))
|
while (new_reph_pos < base && !is_coeng (info[new_reph_pos]))
|
||||||
new_reph_pos++;
|
new_reph_pos++;
|
||||||
|
|
||||||
if (new_reph_pos < base && is_halant_or_coeng (info[new_reph_pos]))
|
if (new_reph_pos < base && is_coeng (info[new_reph_pos]))
|
||||||
{
|
{
|
||||||
/* ->If ZWJ or ZWNJ are following this halant, position is moved after it. */
|
/* ->If ZWJ or ZWNJ are following this halant, position is moved after it. */
|
||||||
if (new_reph_pos + 1 < base && is_joiner (info[new_reph_pos + 1]))
|
if (new_reph_pos + 1 < base && is_joiner (info[new_reph_pos + 1]))
|
||||||
|
@ -1585,7 +1585,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
|
||||||
* TEST: U+0930,U+094D,U+0915,U+094B,U+094D
|
* TEST: U+0930,U+094D,U+0915,U+094B,U+094D
|
||||||
*/
|
*/
|
||||||
if (!hb_options ().uniscribe_bug_compatible &&
|
if (!hb_options ().uniscribe_bug_compatible &&
|
||||||
unlikely (is_halant_or_coeng (info[new_reph_pos]))) {
|
unlikely (is_coeng (info[new_reph_pos]))) {
|
||||||
for (unsigned int i = base + 1; i < new_reph_pos; i++)
|
for (unsigned int i = base + 1; i < new_reph_pos; i++)
|
||||||
if (info[i].khmer_category() == OT_M) {
|
if (info[i].khmer_category() == OT_M) {
|
||||||
/* Ok, got it. */
|
/* Ok, got it. */
|
||||||
|
@ -1646,7 +1646,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
|
||||||
if (buffer->props.script != HB_SCRIPT_MALAYALAM && buffer->props.script != HB_SCRIPT_TAMIL)
|
if (buffer->props.script != HB_SCRIPT_MALAYALAM && buffer->props.script != HB_SCRIPT_TAMIL)
|
||||||
{
|
{
|
||||||
while (new_pos > start &&
|
while (new_pos > start &&
|
||||||
!(is_one_of (info[new_pos - 1], FLAG(OT_M) | HALANT_OR_COENG_FLAGS)))
|
!(is_one_of (info[new_pos - 1], FLAG(OT_M) | FLAG (OT_Coeng))))
|
||||||
new_pos--;
|
new_pos--;
|
||||||
|
|
||||||
/* In Khmer coeng model, a H,Ra can go *after* matras. If it goes after a
|
/* In Khmer coeng model, a H,Ra can go *after* matras. If it goes after a
|
||||||
|
@ -1663,7 +1663,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_pos > start && is_halant_or_coeng (info[new_pos - 1]))
|
if (new_pos > start && is_coeng (info[new_pos - 1]))
|
||||||
{
|
{
|
||||||
/* -> If ZWJ or ZWNJ follow this halant, position is moved after it. */
|
/* -> If ZWJ or ZWNJ follow this halant, position is moved after it. */
|
||||||
if (new_pos < end && is_joiner (info[new_pos]))
|
if (new_pos < end && is_joiner (info[new_pos]))
|
||||||
|
|
Loading…
Reference in New Issue