* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH
-#define HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH
+#ifndef HB_OT_SHAPER_USE_MACHINE_HH
+#define HB_OT_SHAPER_USE_MACHINE_HH
#include "hb.hh"
-#include "hb-ot-shape-complex-syllabic.hh"
+#include "hb-ot-shaper-syllabic.hh"
/* buffer var allocations */
-#define use_category() complex_var_u8_category()
+#define use_category() ot_shaper_var_u8_category()
#define USE(Cat) use_syllable_machine_ex_##Cat
export HN = 13; # HALANT_NUM
export ZWNJ = 14; # Zero width non-joiner
+export WJ = 16; # Word joiner
export R = 18; # REPHA
export CS = 43; # CONS_WITH_STACKER
-export HVM = 44; # HALANT_OR_VOWEL_MODIFIER
+export IS = 44; # INVISIBLE_STACKER
export Sk = 48; # SAKOT
export G = 49; # HIEROGLYPH
export J = 50; # HIEROGLYPH_JOINER
export SB = 51; # HIEROGLYPH_SEGMENT_BEGIN
export SE = 52; # HIEROGLYPH_SEGMENT_END
+export HVM = 53; # HALANT_OR_VOWEL_MODIFIER
+export HM = 54; # HIEROGLYPH_MOD
+export HR = 55; # HIEROGLYPH_MIRROR
export FAbv = 24; # CONS_FINAL_ABOVE
export FBlw = 25; # CONS_FINAL_BELOW
export FMPst = 47; # CONS_FINAL_MOD UIPC = Not_Applicable
-h = H | HVM | Sk;
+h = H | HVM | IS | Sk;
-consonant_modifiers = CMAbv* CMBlw* ((h B | SUB) CMAbv? CMBlw*)*;
+consonant_modifiers = CMAbv* CMBlw* ((h B | SUB) CMAbv* CMBlw*)*;
medial_consonants = MPre? MAbv? MBlw? MPst?;
-dependent_vowels = VPre* VAbv* VBlw* VPst*;
+dependent_vowels = VPre* VAbv* VBlw* VPst* | H;
vowel_modifiers = HVM? VMPre* VMAbv* VMBlw* VMPst*;
final_consonants = FAbv* FBlw* FPst*;
final_modifiers = FMAbv* FMBlw* | FMPst?;
virama_terminated_cluster_tail =
consonant_modifiers
- h
+ IS
;
virama_terminated_cluster =
complex_syllable_start
complex_syllable_start
complex_syllable_tail
;
+tail = complex_syllable_tail | sakot_terminated_cluster_tail | symbol_cluster_tail | virama_terminated_cluster_tail;
broken_cluster =
R?
- (complex_syllable_tail | number_joiner_terminated_cluster_tail | numeral_cluster_tail | symbol_cluster_tail | virama_terminated_cluster_tail | sakot_terminated_cluster_tail)
+ (tail | number_joiner_terminated_cluster_tail | numeral_cluster_tail)
;
number_joiner_terminated_cluster = N number_joiner_terminated_cluster_tail;
numeral_cluster = N numeral_cluster_tail?;
-symbol_cluster = (O | GB) symbol_cluster_tail?;
-hieroglyph_cluster = SB+ | SB* G SE* (J SE* (G SE*)?)*;
+symbol_cluster = (O | GB | SB) tail?;
+hieroglyph_cluster = SB* G HR? HM? SE* (J SB* (G HR? HM? SE*)?)*;
other = any;
main := |*
- virama_terminated_cluster => { found_syllable (use_virama_terminated_cluster); };
- sakot_terminated_cluster => { found_syllable (use_sakot_terminated_cluster); };
- standard_cluster => { found_syllable (use_standard_cluster); };
- number_joiner_terminated_cluster => { found_syllable (use_number_joiner_terminated_cluster); };
- numeral_cluster => { found_syllable (use_numeral_cluster); };
- symbol_cluster => { found_syllable (use_symbol_cluster); };
- hieroglyph_cluster => { found_syllable (use_hieroglyph_cluster); };
- broken_cluster => { found_syllable (use_broken_cluster); };
+ virama_terminated_cluster ZWNJ? => { found_syllable (use_virama_terminated_cluster); };
+ sakot_terminated_cluster ZWNJ? => { found_syllable (use_sakot_terminated_cluster); };
+ standard_cluster ZWNJ? => { found_syllable (use_standard_cluster); };
+ number_joiner_terminated_cluster ZWNJ? => { found_syllable (use_number_joiner_terminated_cluster); };
+ numeral_cluster ZWNJ? => { found_syllable (use_numeral_cluster); };
+ symbol_cluster ZWNJ? => { found_syllable (use_symbol_cluster); };
+ hieroglyph_cluster ZWNJ? => { found_syllable (use_hieroglyph_cluster); };
+ broken_cluster ZWNJ? => { found_syllable (use_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; };
other => { found_syllable (use_non_cluster); };
*|;
#define found_syllable(syllable_type) \
HB_STMT_START { \
- if (0) fprintf (stderr, "syllable %d..%d %s\n", (*ts).second.first, (*te).second.first, #syllable_type); \
+ if (0) fprintf (stderr, "syllable %u..%u %s\n", (*ts).second.first, (*te).second.first, #syllable_type); \
for (unsigned i = (*ts).second.first; i < (*te).second.first; ++i) \
info[i].syllable() = (syllable_serial << 4) | syllable_type; \
syllable_serial++; \
- if (unlikely (syllable_serial == 16)) syllable_serial = 1; \
+ if (syllable_serial == 16) syllable_serial = 1; \
} HB_STMT_END
typename Iter::item_t>
{
machine_index_t (const Iter& it) : it (it) {}
- machine_index_t (const machine_index_t& o) : it (o.it) {}
+ machine_index_t (const machine_index_t& o) : hb_iter_with_fallback_t<machine_index_t<Iter>,
+ typename Iter::item_t> (),
+ it (o.it), is_null (o.is_null) {}
static constexpr bool is_random_access_iterator = Iter::is_random_access_iterator;
static constexpr bool is_sorted_iterator = Iter::is_sorted_iterator;
void __forward__ (unsigned n) { it += n; }
void __prev__ () { --it; }
void __rewind__ (unsigned n) { it -= n; }
+
void operator = (unsigned n)
- { unsigned index = (*it).first; if (index < n) it += n - index; else if (index > n) it -= index - n; }
- void operator = (const machine_index_t& o) { *this = (*o.it).first; }
- bool operator == (const machine_index_t& o) const { return (*it).first == (*o.it).first; }
+ {
+ assert (n == 0);
+ is_null = true;
+ }
+ explicit operator bool () { return !is_null; }
+
+ void operator = (const machine_index_t& o)
+ {
+ is_null = o.is_null;
+ unsigned index = (*it).first;
+ unsigned n = (*o.it).first;
+ if (index < n) it += n - index; else if (index > n) it -= index - n;
+ }
+ bool operator == (const machine_index_t& o) const
+ { return is_null ? o.is_null : !o.is_null && (*it).first == (*o.it).first; }
bool operator != (const machine_index_t& o) const { return !(*this == o); }
private:
Iter it;
+ bool is_null = false;
};
struct
{
static bool
not_ccs_default_ignorable (const hb_glyph_info_t &i)
-{ return !(i.use_category() == USE(CGJ) && _hb_glyph_info_is_default_ignorable (&i)); }
+{ return i.use_category() != USE(CGJ); }
static inline void
find_syllables_use (hb_buffer_t *buffer)
#undef found_syllable
-#endif /* HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH */
+#endif /* HB_OT_SHAPER_USE_MACHINE_HH */