[khmer] Shave off some more from the grammar
This commit is contained in:
parent
014494d5c0
commit
e6618f3bdf
|
@ -46,7 +46,6 @@ ZWNJ = 5;
|
|||
ZWJ = 6;
|
||||
M = 7;
|
||||
SM = 8;
|
||||
VD = 9;
|
||||
A = 10;
|
||||
PLACEHOLDER = 11;
|
||||
DOTTEDCIRCLE = 12;
|
||||
|
@ -60,22 +59,18 @@ z = ZWJ|ZWNJ; # is_joiner
|
|||
|
||||
cn = c.ZWJ?.n?;
|
||||
matra_group = z{0,3}.M.N?.Coeng?;
|
||||
syllable_tail = (z?.SM.SM?.ZWNJ?)? A{0,3}? VD{0,2};
|
||||
syllable_tail = (z?.SM.SM?.ZWNJ?)? A{0,3}?;
|
||||
halant_group = (z?.Coeng.(ZWJ.N?)?);
|
||||
final_halant_group = halant_group | Coeng.ZWNJ;
|
||||
halant_or_matra_group = (final_halant_group | (Coeng.ZWJ)? matra_group{0,4}) (Coeng (cn|V))?;
|
||||
|
||||
|
||||
consonant_syllable = (cn.halant_group){0,4} cn halant_or_matra_group syllable_tail;
|
||||
vowel_syllable = V.n? (ZWJ | (halant_group.cn){0,4} halant_or_matra_group syllable_tail);
|
||||
standalone_cluster = (PLACEHOLDER | DOTTEDCIRCLE).n? (halant_group.cn){0,4} halant_or_matra_group syllable_tail;
|
||||
consonant_syllable = (c|V|PLACEHOLDER|DOTTEDCIRCLE).n? (halant_group.cn){0,4} halant_or_matra_group syllable_tail;
|
||||
broken_cluster = n? (halant_group.cn){0,4} halant_or_matra_group syllable_tail;
|
||||
other = any;
|
||||
|
||||
main := |*
|
||||
consonant_syllable => { found_syllable (consonant_syllable); };
|
||||
vowel_syllable => { found_syllable (vowel_syllable); };
|
||||
standalone_cluster => { found_syllable (standalone_cluster); };
|
||||
broken_cluster => { found_syllable (broken_cluster); };
|
||||
other => { found_syllable (non_khmer_cluster); };
|
||||
*|;
|
||||
|
|
|
@ -124,7 +124,7 @@ set_khmer_properties (hb_glyph_info_t &info)
|
|||
{
|
||||
pos = matra_position (pos);
|
||||
}
|
||||
else if ((FLAG_UNSAFE (cat) & (FLAG (OT_SM) | FLAG (OT_VD) | FLAG (OT_A) | FLAG (OT_Symbol))))
|
||||
else if ((FLAG_UNSAFE (cat) & (FLAG (OT_SM) | FLAG (OT_A) | FLAG (OT_Symbol))))
|
||||
{
|
||||
pos = POS_SMVD;
|
||||
}
|
||||
|
@ -341,9 +341,6 @@ data_destroy_khmer (void *data)
|
|||
|
||||
enum syllable_type_t {
|
||||
consonant_syllable,
|
||||
vowel_syllable,
|
||||
standalone_cluster,
|
||||
symbol_cluster,
|
||||
broken_cluster,
|
||||
non_khmer_cluster,
|
||||
};
|
||||
|
@ -547,27 +544,6 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
initial_reordering_standalone_cluster (const hb_ot_shape_plan_t *plan,
|
||||
hb_face_t *face,
|
||||
hb_buffer_t *buffer,
|
||||
unsigned int start, unsigned int end)
|
||||
{
|
||||
/* We treat placeholder/dotted-circle as if they are consonants, so we
|
||||
* should just chain. Only if not in compatibility mode that is... */
|
||||
|
||||
if (hb_options ().uniscribe_bug_compatible)
|
||||
{
|
||||
/* For dotted-circle, this is what Uniscribe does:
|
||||
* If dotted-circle is the last glyph, it just does nothing.
|
||||
* Ie. It doesn't form Reph. */
|
||||
if (buffer->info[end - 1].khmer_category() == OT_DOTTEDCIRCLE)
|
||||
return;
|
||||
}
|
||||
|
||||
initial_reordering_consonant_syllable (plan, face, buffer, start, end);
|
||||
}
|
||||
|
||||
static void
|
||||
initial_reordering_syllable (const hb_ot_shape_plan_t *plan,
|
||||
hb_face_t *face,
|
||||
|
@ -577,17 +553,11 @@ initial_reordering_syllable (const hb_ot_shape_plan_t *plan,
|
|||
syllable_type_t syllable_type = (syllable_type_t) (buffer->info[start].syllable() & 0x0F);
|
||||
switch (syllable_type)
|
||||
{
|
||||
case vowel_syllable: /* We made the vowels look like consonants. So let's call the consonant logic! */
|
||||
case broken_cluster: /* We already inserted dotted-circles, so just call the consonant_syllable. */
|
||||
case consonant_syllable:
|
||||
initial_reordering_consonant_syllable (plan, face, buffer, start, end);
|
||||
break;
|
||||
|
||||
case broken_cluster: /* We already inserted dotted-circles, so just call the standalone_cluster. */
|
||||
case standalone_cluster:
|
||||
initial_reordering_standalone_cluster (plan, face, buffer, start, end);
|
||||
break;
|
||||
|
||||
case symbol_cluster:
|
||||
case non_khmer_cluster:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue