[Indic] Move consonant-position-setting into initial_reordering()
This commit is contained in:
parent
afbcc24be0
commit
24eacf17c8
|
@ -236,6 +236,34 @@ override_features_indic (const hb_ot_complex_shaper_t *shaper,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
setup_masks_indic (const hb_ot_complex_shaper_t *shaper,
|
||||||
|
const hb_ot_map_t *map,
|
||||||
|
hb_buffer_t *buffer,
|
||||||
|
hb_font_t *font HB_UNUSED)
|
||||||
|
{
|
||||||
|
HB_BUFFER_ALLOCATE_VAR (buffer, indic_category);
|
||||||
|
HB_BUFFER_ALLOCATE_VAR (buffer, indic_position);
|
||||||
|
|
||||||
|
/* We cannot setup masks here. We save information about characters
|
||||||
|
* and setup masks later on in a pause-callback. */
|
||||||
|
|
||||||
|
unsigned int count = buffer->len;
|
||||||
|
for (unsigned int i = 0; i < count; i++)
|
||||||
|
set_indic_properties (buffer->info[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
compare_indic_order (const hb_glyph_info_t *pa, const hb_glyph_info_t *pb)
|
||||||
|
{
|
||||||
|
int a = pa->indic_position();
|
||||||
|
int b = pb->indic_position();
|
||||||
|
|
||||||
|
return a < b ? -1 : a == b ? 0 : +1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_consonant_positions (const hb_ot_map_t *map,
|
update_consonant_positions (const hb_ot_map_t *map,
|
||||||
hb_buffer_t *buffer,
|
hb_buffer_t *buffer,
|
||||||
|
@ -263,43 +291,18 @@ update_consonant_positions (const hb_ot_map_t *map,
|
||||||
hb_codepoint_t glyphs[2];
|
hb_codepoint_t glyphs[2];
|
||||||
if (virama && font->get_glyph (virama, 0, &glyphs[1 - consonant_pos]))
|
if (virama && font->get_glyph (virama, 0, &glyphs[1 - consonant_pos]))
|
||||||
{
|
{
|
||||||
|
/* Technically speaking, the spec says we should apply 'locl' to virama too.
|
||||||
|
* Maybe one day... */
|
||||||
hb_face_t *face = font->face;
|
hb_face_t *face = font->face;
|
||||||
unsigned int count = buffer->len;
|
unsigned int count = buffer->len;
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
if (buffer->info[i].indic_position() == POS_BASE_C) {
|
if (buffer->info[i].indic_position() == POS_BASE_C) {
|
||||||
font->get_glyph (buffer->info[i].codepoint, 0, &glyphs[consonant_pos]);
|
glyphs[consonant_pos] = buffer->info[i].codepoint;
|
||||||
buffer->info[i].indic_position() = consonant_position_from_font (&indic_plan, glyphs, 2, face);
|
buffer->info[i].indic_position() = consonant_position_from_font (&indic_plan, glyphs, 2, face);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
setup_masks_indic (const hb_ot_complex_shaper_t *shaper,
|
|
||||||
const hb_ot_map_t *map,
|
|
||||||
hb_buffer_t *buffer,
|
|
||||||
hb_font_t *font)
|
|
||||||
{
|
|
||||||
HB_BUFFER_ALLOCATE_VAR (buffer, indic_category);
|
|
||||||
HB_BUFFER_ALLOCATE_VAR (buffer, indic_position);
|
|
||||||
|
|
||||||
/* We cannot setup masks here. We save information about characters
|
|
||||||
* and setup masks later on in a pause-callback. */
|
|
||||||
|
|
||||||
unsigned int count = buffer->len;
|
|
||||||
for (unsigned int i = 0; i < count; i++)
|
|
||||||
set_indic_properties (buffer->info[i]);
|
|
||||||
|
|
||||||
update_consonant_positions (map, buffer, font);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
compare_indic_order (const hb_glyph_info_t *pa, const hb_glyph_info_t *pb)
|
|
||||||
{
|
|
||||||
int a = pa->indic_position();
|
|
||||||
int b = pb->indic_position();
|
|
||||||
|
|
||||||
return a < b ? -1 : a == b ? 0 : +1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Rules from:
|
/* Rules from:
|
||||||
* https://www.microsoft.com/typography/otfntdev/devanot/shaping.aspx */
|
* https://www.microsoft.com/typography/otfntdev/devanot/shaping.aspx */
|
||||||
|
@ -696,10 +699,12 @@ initial_reordering_non_indic (const hb_ot_map_t *map HB_UNUSED,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
initial_reordering (const hb_ot_map_t *map,
|
initial_reordering (const hb_ot_map_t *map,
|
||||||
hb_font_t *font HB_UNUSED,
|
hb_font_t *font,
|
||||||
hb_buffer_t *buffer,
|
hb_buffer_t *buffer,
|
||||||
void *user_data HB_UNUSED)
|
void *user_data HB_UNUSED)
|
||||||
{
|
{
|
||||||
|
update_consonant_positions (map, buffer, font);
|
||||||
|
|
||||||
hb_mask_t basic_mask_array[ARRAY_LENGTH (indic_basic_features)] = {0};
|
hb_mask_t basic_mask_array[ARRAY_LENGTH (indic_basic_features)] = {0};
|
||||||
unsigned int num_masks = ARRAY_LENGTH (indic_basic_features);
|
unsigned int num_masks = ARRAY_LENGTH (indic_basic_features);
|
||||||
for (unsigned int i = 0; i < num_masks; i++)
|
for (unsigned int i = 0; i < num_masks; i++)
|
||||||
|
|
Loading…
Reference in New Issue