[indic/myanmar] Move is_consonant to .cc files
This commit is contained in:
parent
1c657460ef
commit
10a5485136
|
@ -72,6 +72,30 @@ set_indic_properties (hb_glyph_info_t &info)
|
||||||
info.indic_position() = (indic_position_t) (type >> 8);
|
info.indic_position() = (indic_position_t) (type >> 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
is_one_of (const hb_glyph_info_t &info, unsigned int flags)
|
||||||
|
{
|
||||||
|
/* If it ligated, all bets are off. */
|
||||||
|
if (_hb_glyph_info_ligated (&info)) return false;
|
||||||
|
return !!(FLAG_UNSAFE (info.indic_category()) & flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Note:
|
||||||
|
*
|
||||||
|
* We treat Vowels and placeholders as if they were consonants. This is safe because Vowels
|
||||||
|
* cannot happen in a consonant syllable. The plus side however is, we can call the
|
||||||
|
* consonant syllable logic from the vowel syllable function and get it all right!
|
||||||
|
*
|
||||||
|
* Keep in sync with consonant_categories in the generator. */
|
||||||
|
#define CONSONANT_FLAGS_INDIC (FLAG (I_Cat(C)) | FLAG (I_Cat(CS)) | FLAG (I_Cat(Ra)) | FLAG (I_Cat(CM)) | FLAG (I_Cat(V)) | FLAG (I_Cat(PLACEHOLDER)) | FLAG (I_Cat(DOTTEDCIRCLE)))
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
is_consonant (const hb_glyph_info_t &info)
|
||||||
|
{
|
||||||
|
return is_one_of (info, CONSONANT_FLAGS_INDIC);
|
||||||
|
}
|
||||||
|
|
||||||
#define JOINER_FLAGS (FLAG (I_Cat(ZWJ)) | FLAG (I_Cat(ZWNJ)))
|
#define JOINER_FLAGS (FLAG (I_Cat(ZWJ)) | FLAG (I_Cat(ZWNJ)))
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
|
|
|
@ -92,16 +92,6 @@ enum ot_category_t {
|
||||||
OT_ML = 42, // Consonant medials
|
OT_ML = 42, // Consonant medials
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Note:
|
|
||||||
*
|
|
||||||
* We treat Vowels and placeholders as if they were consonants. This is safe because Vowels
|
|
||||||
* cannot happen in a consonant syllable. The plus side however is, we can call the
|
|
||||||
* consonant syllable logic from the vowel syllable function and get it all right!
|
|
||||||
*
|
|
||||||
* Keep in sync with consonant_categories in the generator. */
|
|
||||||
#define CONSONANT_FLAGS (FLAG (OT_C) | FLAG (OT_CS) | FLAG (OT_Ra) | FLAG (OT_CM) | FLAG (OT_V) | FLAG (OT_PLACEHOLDER) | FLAG (OT_DOTTEDCIRCLE))
|
|
||||||
|
|
||||||
|
|
||||||
/* Visual positions in a syllable from left to right. */
|
/* Visual positions in a syllable from left to right. */
|
||||||
enum ot_position_t {
|
enum ot_position_t {
|
||||||
POS_START = 0,
|
POS_START = 0,
|
||||||
|
@ -134,18 +124,4 @@ HB_INTERNAL uint16_t
|
||||||
hb_indic_get_categories (hb_codepoint_t u);
|
hb_indic_get_categories (hb_codepoint_t u);
|
||||||
|
|
||||||
|
|
||||||
static inline bool
|
|
||||||
is_one_of (const hb_glyph_info_t &info, unsigned int flags)
|
|
||||||
{
|
|
||||||
/* If it ligated, all bets are off. */
|
|
||||||
if (_hb_glyph_info_ligated (&info)) return false;
|
|
||||||
return !!(FLAG_UNSAFE (info.indic_category()) & flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool
|
|
||||||
is_consonant (const hb_glyph_info_t &info)
|
|
||||||
{
|
|
||||||
return is_one_of (info, CONSONANT_FLAGS);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* HB_OT_SHAPER_INDIC_HH */
|
#endif /* HB_OT_SHAPER_INDIC_HH */
|
||||||
|
|
|
@ -108,6 +108,31 @@ set_myanmar_properties (hb_glyph_info_t &info)
|
||||||
info.myanmar_category() = (myanmar_category_t) (type & 0xFFu);
|
info.myanmar_category() = (myanmar_category_t) (type & 0xFFu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
is_one_of_myanmar (const hb_glyph_info_t &info, unsigned int flags)
|
||||||
|
{
|
||||||
|
/* If it ligated, all bets are off. */
|
||||||
|
if (_hb_glyph_info_ligated (&info)) return false;
|
||||||
|
return !!(FLAG_UNSAFE (info.indic_category()) & flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Note:
|
||||||
|
*
|
||||||
|
* We treat Vowels and placeholders as if they were consonants. This is safe because Vowels
|
||||||
|
* cannot happen in a consonant syllable. The plus side however is, we can call the
|
||||||
|
* consonant syllable logic from the vowel syllable function and get it all right!
|
||||||
|
*
|
||||||
|
* Keep in sync with consonant_categories in the generator. */
|
||||||
|
#define CONSONANT_FLAGS_MYANMAR (FLAG (M_Cat(C)) | FLAG (M_Cat(CS)) | FLAG (M_Cat(Ra)) | /* FLAG (M_Cat(CM)) | */ FLAG (M_Cat(IV)) | FLAG (M_Cat(GB)) | FLAG (M_Cat(DOTTEDCIRCLE)))
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
is_consonant_myanmar (const hb_glyph_info_t &info)
|
||||||
|
{
|
||||||
|
return is_one_of_myanmar (info, CONSONANT_FLAGS_MYANMAR);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup_syllables_myanmar (const hb_ot_shape_plan_t *plan,
|
setup_syllables_myanmar (const hb_ot_shape_plan_t *plan,
|
||||||
hb_font_t *font,
|
hb_font_t *font,
|
||||||
|
@ -210,7 +235,7 @@ initial_reordering_consonant_syllable (hb_buffer_t *buffer,
|
||||||
base = limit;
|
base = limit;
|
||||||
|
|
||||||
for (unsigned int i = limit; i < end; i++)
|
for (unsigned int i = limit; i < end; i++)
|
||||||
if (is_consonant (info[i]))
|
if (is_consonant_myanmar (info[i]))
|
||||||
{
|
{
|
||||||
base = i;
|
base = i;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue