[Indic] Start adding dotted-circle instrastructure
This commit is contained in:
parent
1be368e96f
commit
327d14ef18
|
@ -78,24 +78,23 @@ standalone_cluster = reph? place_holder.n? (halant_group.cn){0,4} halant_or_matr
|
||||||
other = any;
|
other = any;
|
||||||
|
|
||||||
main := |*
|
main := |*
|
||||||
consonant_syllable => { process_syllable (consonant_syllable); };
|
consonant_syllable => { found_syllable (consonant_syllable); };
|
||||||
vowel_syllable => { process_syllable (vowel_syllable); };
|
vowel_syllable => { found_syllable (vowel_syllable); };
|
||||||
standalone_cluster => { process_syllable (standalone_cluster); };
|
standalone_cluster => { found_syllable (standalone_cluster); };
|
||||||
other => { process_syllable (non_indic); };
|
other => { found_syllable (non_indic_cluster); };
|
||||||
*|;
|
*|;
|
||||||
|
|
||||||
|
|
||||||
}%%
|
}%%
|
||||||
|
|
||||||
#define process_syllable(func) \
|
#define found_syllable(syllable_type) \
|
||||||
HB_STMT_START { \
|
HB_STMT_START { \
|
||||||
if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #func); \
|
if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type); \
|
||||||
for (unsigned int i = last; i < p+1; i++) \
|
for (unsigned int i = last; i < p+1; i++) \
|
||||||
info[i].syllable() = syllable_serial; \
|
info[i].syllable() = (syllable_serial << 4) | syllable_type; \
|
||||||
PASTE (initial_reordering_, func) (plan, buffer, last, p+1); \
|
|
||||||
last = p+1; \
|
last = p+1; \
|
||||||
syllable_serial++; \
|
syllable_serial++; \
|
||||||
if (unlikely (!syllable_serial)) syllable_serial++; \
|
if (unlikely (syllable_serial == 16)) syllable_serial = 1; \
|
||||||
} HB_STMT_END
|
} HB_STMT_END
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -113,7 +112,7 @@ find_syllables (const hb_ot_shape_plan_t *plan, hb_buffer_t *buffer)
|
||||||
pe = eof = buffer->len;
|
pe = eof = buffer->len;
|
||||||
|
|
||||||
unsigned int last = 0;
|
unsigned int last = 0;
|
||||||
uint8_t syllable_serial = 1;
|
unsigned int syllable_serial = 1;
|
||||||
%%{
|
%%{
|
||||||
write exec;
|
write exec;
|
||||||
}%%
|
}%%
|
||||||
|
|
|
@ -770,23 +770,61 @@ initial_reordering_standalone_cluster (const hb_ot_shape_plan_t *plan,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
initial_reordering_non_indic (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
initial_reordering_non_indic_cluster (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
||||||
hb_buffer_t *buffer HB_UNUSED,
|
hb_buffer_t *buffer HB_UNUSED,
|
||||||
unsigned int start HB_UNUSED, unsigned int end HB_UNUSED)
|
unsigned int start HB_UNUSED, unsigned int end HB_UNUSED)
|
||||||
{
|
{
|
||||||
/* Nothing to do right now. If we ever switch to using the output
|
/* Nothing to do right now. If we ever switch to using the output
|
||||||
* buffer in the reordering process, we'd need to next_glyph() here. */
|
* buffer in the reordering process, we'd need to next_glyph() here. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
enum syllable_type_t {
|
||||||
|
consonant_syllable,
|
||||||
|
vowel_syllable,
|
||||||
|
standalone_cluster,
|
||||||
|
broken_cluster,
|
||||||
|
non_indic_cluster,
|
||||||
|
};
|
||||||
|
|
||||||
#include "hb-ot-shape-complex-indic-machine.hh"
|
#include "hb-ot-shape-complex-indic-machine.hh"
|
||||||
|
|
||||||
|
static void
|
||||||
|
initial_reordering_syllable (const hb_ot_shape_plan_t *plan,
|
||||||
|
hb_buffer_t *buffer,
|
||||||
|
unsigned int start, unsigned int end)
|
||||||
|
{
|
||||||
|
syllable_type_t syllable_type = (syllable_type_t) (buffer->info[start].syllable() & 0x0F);
|
||||||
|
switch (syllable_type) {
|
||||||
|
case consonant_syllable: initial_reordering_consonant_syllable (plan, buffer, start, end); return;
|
||||||
|
case vowel_syllable: initial_reordering_vowel_syllable (plan, buffer, start, end); return;
|
||||||
|
case standalone_cluster: initial_reordering_standalone_cluster (plan, buffer, start, end); return;
|
||||||
|
case broken_cluster: initial_reordering_non_indic_cluster (plan, buffer, start, end); return;
|
||||||
|
case non_indic_cluster: initial_reordering_non_indic_cluster (plan, buffer, start, end); return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
initial_reordering (const hb_ot_shape_plan_t *plan,
|
initial_reordering (const hb_ot_shape_plan_t *plan,
|
||||||
hb_font_t *font,
|
hb_font_t *font,
|
||||||
hb_buffer_t *buffer)
|
hb_buffer_t *buffer)
|
||||||
{
|
{
|
||||||
|
unsigned int count = buffer->len;
|
||||||
|
if (unlikely (!count)) return;
|
||||||
|
|
||||||
update_consonant_positions (plan, font, buffer);
|
update_consonant_positions (plan, font, buffer);
|
||||||
find_syllables (plan, buffer);
|
find_syllables (plan, buffer);
|
||||||
|
|
||||||
|
hb_glyph_info_t *info = buffer->info;
|
||||||
|
unsigned int last = 0;
|
||||||
|
unsigned int last_syllable = info[0].syllable();
|
||||||
|
for (unsigned int i = 1; i < count; i++)
|
||||||
|
if (last_syllable != info[i].syllable()) {
|
||||||
|
initial_reordering_syllable (plan, buffer, last, i);
|
||||||
|
last = i;
|
||||||
|
last_syllable = info[last].syllable();
|
||||||
|
}
|
||||||
|
initial_reordering_syllable (plan, buffer, last, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1110,7 +1148,7 @@ final_reordering (const hb_ot_shape_plan_t *plan,
|
||||||
hb_buffer_t *buffer)
|
hb_buffer_t *buffer)
|
||||||
{
|
{
|
||||||
unsigned int count = buffer->len;
|
unsigned int count = buffer->len;
|
||||||
if (!count) return;
|
if (unlikely (!count)) return;
|
||||||
|
|
||||||
hb_glyph_info_t *info = buffer->info;
|
hb_glyph_info_t *info = buffer->info;
|
||||||
unsigned int last = 0;
|
unsigned int last = 0;
|
||||||
|
|
Loading…
Reference in New Issue