diff --git a/src/hb-ot-shape-complex-indic-private.hh b/src/hb-ot-shape-complex-indic-private.hh index 4d700f74e16b6e56f6393de717ea784823dabf77..8c152c92fca65d5283757a85fb6f16b33c994b2b 100644 --- a/src/hb-ot-shape-complex-indic-private.hh +++ b/src/hb-ot-shape-complex-indic-private.hh @@ -190,6 +190,31 @@ hb_indic_get_categories (hb_codepoint_t u); #define indic_category() complex_var_u8_0() /* indic_category_t */ #define indic_position() complex_var_u8_1() /* indic_position_t */ +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_joiner (const hb_glyph_info_t &info) +{ + return is_one_of (info, JOINER_FLAGS); +} + +static inline bool +is_consonant (const hb_glyph_info_t &info) +{ + return is_one_of (info, CONSONANT_FLAGS); +} + +static inline bool +is_halant (const hb_glyph_info_t &info) +{ + return is_one_of (info, FLAG (OT_H)); +} #define IN_HALF_BLOCK(u, Base) (((u) & ~0x7Fu) == (Base)) @@ -245,7 +270,7 @@ hb_indic_get_categories (hb_codepoint_t u); ) static inline indic_position_t -matra_position (hb_codepoint_t u, indic_position_t side) +matra_position_indic (hb_codepoint_t u, indic_position_t side) { switch ((int) side) { @@ -355,7 +380,7 @@ set_indic_properties (hb_glyph_info_t &info) } else if (cat == OT_M) { - pos = matra_position (u, pos); + pos = matra_position_indic (u, pos); } else if ((FLAG_UNSAFE (cat) & (FLAG (OT_SM) /* | FLAG (OT_VD) */ | FLAG (OT_A) | FLAG (OT_Symbol)))) { diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 5594f8bde53a64f3ef5609b16c66c3af0f489eec..32ad86a5f32735ae29f27ed1af1a9648c2e0e690 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -33,33 +33,6 @@ */ -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_joiner (const hb_glyph_info_t &info) -{ - return is_one_of (info, JOINER_FLAGS); -} - -static inline bool -is_consonant (const hb_glyph_info_t &info) -{ - return is_one_of (info, CONSONANT_FLAGS); -} - -static inline bool -is_halant (const hb_glyph_info_t &info) -{ - return is_one_of (info, FLAG (OT_H)); -} - - /* * Indic configurations. Note that we do not want to keep every single script-specific * behavior in these tables necessarily. This should mainly be used for per-script diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc index 2db4f6097d81a0730253536f634b200a0f80fc41..0e2ca88cb5d152f045c244557fac0bdce5b6751d 100644 --- a/src/hb-ot-shape-complex-khmer.cc +++ b/src/hb-ot-shape-complex-khmer.cc @@ -28,8 +28,8 @@ #include "hb-ot-layout-private.hh" /* buffer var allocations */ -#define khmer_category() complex_var_u8_0() /* khmer_category_t */ -#define khmer_position() complex_var_u8_1() /* khmer_position_t */ +#define khmer_category() indic_category() /* khmer_category_t */ +#define khmer_position() indic_position() /* khmer_position_t */ /* @@ -41,7 +41,7 @@ typedef indic_position_t khmer_position_t; static inline khmer_position_t -matra_position (khmer_position_t side) +matra_position_khmer (khmer_position_t side) { switch ((int) side) { @@ -59,21 +59,7 @@ matra_position (khmer_position_t side) } 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.khmer_category()) & flags); -} - -static inline bool -is_joiner (const hb_glyph_info_t &info) -{ - return is_one_of (info, JOINER_FLAGS); -} - -static inline bool -is_consonant (const hb_glyph_info_t &info) +is_consonant_or_vowel (const hb_glyph_info_t &info) { return is_one_of (info, CONSONANT_FLAGS | FLAG (OT_V)); } @@ -122,7 +108,7 @@ set_khmer_properties (hb_glyph_info_t &info) } else if (cat == OT_M) { - pos = matra_position (pos); + pos = matra_position_khmer (pos); } else if ((FLAG_UNSAFE (cat) & (FLAG (OT_SM) | FLAG (OT_A) | FLAG (OT_Symbol)))) { @@ -404,7 +390,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, /* Mark all subsequent consonants as below. */ for (unsigned int i = base + 1; i < end; i++) - if (is_consonant (info[i])) + if (is_consonant_or_vowel (info[i])) info[i].khmer_position() = POS_BELOW_C; /* Mark final consonants. A final consonant is one appearing after a matra, @@ -412,7 +398,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, for (unsigned int i = base + 1; i < end; i++) if (info[i].khmer_category() == OT_M) { for (unsigned int j = i + 1; j < end; j++) - if (is_consonant (info[j])) { + if (is_consonant_or_vowel (info[j])) { info[j].khmer_position() = POS_FINAL_C; break; } @@ -455,7 +441,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, { unsigned int last = base; for (unsigned int i = base + 1; i < end; i++) - if (is_consonant (info[i])) + if (is_consonant_or_vowel (info[i])) { for (unsigned int j = last + 1; j < i; j++) if (info[j].khmer_position() < POS_SMVD) diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc index 31bb976b1bbd62f88869d819b68a440c6b7c2911..dacb1abe096144eef8e9feb9b0afc2dd86caf250 100644 --- a/src/hb-ot-shape-complex-myanmar.cc +++ b/src/hb-ot-shape-complex-myanmar.cc @@ -27,8 +27,8 @@ #include "hb-ot-shape-complex-indic-private.hh" /* buffer var allocations */ -#define myanmar_category() complex_var_u8_0() /* myanmar_category_t */ -#define myanmar_position() complex_var_u8_1() /* myanmar_position_t */ +#define myanmar_category() indic_category() /* myanmar_category_t */ +#define myanmar_position() indic_position() /* myanmar_position_t */ /* @@ -149,21 +149,6 @@ enum myanmar_category_t { }; -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.myanmar_category()) & flags); -} - -static inline bool -is_consonant (const hb_glyph_info_t &info) -{ - return is_one_of (info, CONSONANT_FLAGS); -} - - static inline void set_myanmar_properties (hb_glyph_info_t &info) {