[Indic] Improve matra vs consonant ordering

Another 1.5% down.
This commit is contained in:
Behdad Esfahbod 2012-05-09 15:56:35 +02:00
parent 33c92e7695
commit d4480ace7f
3 changed files with 24 additions and 16 deletions

View File

@ -62,11 +62,19 @@ enum indic_category_t {
/* Visual positions in a syllable from left to right. */
enum indic_position_t {
POS_LEFT_MATRA = 0,
POS_PRE = 1,
POS_BASE = 2,
POS_ABOVE = 3,
POS_BELOW = 4,
POS_POST = 5
POS_POST = 5,
POS_MATRAS = 6,
POS_REPH = 7,
POS_SMVD = 8
};
/* Categories used in IndicSyllabicCategory.txt from UCD */
@ -100,10 +108,10 @@ enum indic_syllabic_category_t {
enum indic_matra_category_t {
INDIC_MATRA_CATEGORY_NOT_APPLICABLE = POS_BASE,
INDIC_MATRA_CATEGORY_LEFT = POS_PRE - 1, /* Move *before* existing "pre" chars */
INDIC_MATRA_CATEGORY_TOP = POS_ABOVE,
INDIC_MATRA_CATEGORY_BOTTOM = POS_BELOW,
INDIC_MATRA_CATEGORY_RIGHT = POS_POST,
INDIC_MATRA_CATEGORY_LEFT = POS_LEFT_MATRA,
INDIC_MATRA_CATEGORY_TOP = POS_MATRAS,
INDIC_MATRA_CATEGORY_BOTTOM = POS_MATRAS,
INDIC_MATRA_CATEGORY_RIGHT = POS_MATRAS,
/* We don't really care much about these since we decompose them
* in the generic pre-shaping layer. They will only be used if
@ -114,13 +122,13 @@ enum indic_matra_category_t {
* TODO: There are some split matras without Unicode decompositions.
* We have to figure out what to do with them.
*/
INDIC_MATRA_CATEGORY_BOTTOM_AND_RIGHT = 8 + INDIC_MATRA_CATEGORY_BOTTOM,
INDIC_MATRA_CATEGORY_LEFT_AND_RIGHT = 8 + INDIC_MATRA_CATEGORY_LEFT,
INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM = 8 + INDIC_MATRA_CATEGORY_BOTTOM,
INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM_AND_RIGHT = 8 + INDIC_MATRA_CATEGORY_BOTTOM,
INDIC_MATRA_CATEGORY_TOP_AND_LEFT = 8 + INDIC_MATRA_CATEGORY_LEFT,
INDIC_MATRA_CATEGORY_TOP_AND_LEFT_AND_RIGHT = 8 + INDIC_MATRA_CATEGORY_LEFT,
INDIC_MATRA_CATEGORY_TOP_AND_RIGHT = 8 + INDIC_MATRA_CATEGORY_RIGHT,
INDIC_MATRA_CATEGORY_BOTTOM_AND_RIGHT = POS_MATRAS,
INDIC_MATRA_CATEGORY_LEFT_AND_RIGHT = POS_LEFT_MATRA,
INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM = POS_MATRAS,
INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM_AND_RIGHT = POS_MATRAS,
INDIC_MATRA_CATEGORY_TOP_AND_LEFT = POS_LEFT_MATRA,
INDIC_MATRA_CATEGORY_TOP_AND_LEFT_AND_RIGHT = POS_LEFT_MATRA,
INDIC_MATRA_CATEGORY_TOP_AND_RIGHT = POS_MATRAS,
INDIC_MATRA_CATEGORY_INVISIBLE = INDIC_MATRA_CATEGORY_NOT_APPLICABLE,
INDIC_MATRA_CATEGORY_OVERSTRUCK = INDIC_MATRA_CATEGORY_NOT_APPLICABLE,

View File

@ -173,7 +173,7 @@ _hb_ot_shape_complex_setup_masks_indic (hb_ot_map_t *map, hb_buffer_t *buffer, h
unsigned int type = get_indic_categories (buffer->info[i].codepoint);
buffer->info[i].indic_category() = type & 0x0F;
buffer->info[i].indic_position() = (type >> 4) & 7;
buffer->info[i].indic_position() = type >> 4;
if (buffer->info[i].indic_category() == OT_C) {
buffer->info[i].indic_position() = consonant_position (buffer->info[i].codepoint);
@ -181,7 +181,7 @@ _hb_ot_shape_complex_setup_masks_indic (hb_ot_map_t *map, hb_buffer_t *buffer, h
buffer->info[i].indic_category() = OT_Ra;
} else if (buffer->info[i].indic_category() == OT_SM ||
buffer->info[i].indic_category() == OT_VD) {
buffer->info[i].indic_position() = POS_POST;
buffer->info[i].indic_position() = POS_SMVD;
} else if (unlikely (buffer->info[i].codepoint == 0x200C))
buffer->info[i].indic_category() = OT_ZWNJ;
else if (unlikely (buffer->info[i].codepoint == 0x200D))
@ -330,7 +330,7 @@ found_consonant_syllable (const hb_ot_map_t *map, hb_buffer_t *buffer, hb_mask_t
start + 3 <= end &&
!is_joiner (info[start + 2]))
{
info[start].indic_position() = POS_POST + 1;
info[start].indic_position() = POS_REPH;
info[start].mask = mask_array[RPHF];
}

View File

@ -40,7 +40,7 @@ main (void)
unsigned int position = type >> 4;
hb_codepoint_t a, b;
if ((position & 8) && !hb_unicode_decompose (funcs, u, &a, &b))
if (!hb_unicode_decompose (funcs, u, &a, &b))
printf ("U+%04X\n", u);
}
}