From dbccf87eef0d26838fa4bb3ae26410f6c4818836 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 9 May 2012 17:24:39 +0200 Subject: [PATCH] [Indic] Make room for more reordering positions --- src/hb-ot-shape-complex-indic-private.hh | 213 ++++++++++++++++--------------- src/hb-ot-shape-complex-indic.cc | 12 +- 2 files changed, 115 insertions(+), 110 deletions(-) diff --git a/src/hb-ot-shape-complex-indic-private.hh b/src/hb-ot-shape-complex-indic-private.hh index 8ba37d3..babb1fc 100644 --- a/src/hb-ot-shape-complex-indic-private.hh +++ b/src/hb-ot-shape-complex-indic-private.hh @@ -62,19 +62,24 @@ enum indic_category_t { /* Visual positions in a syllable from left to right. */ enum indic_position_t { - POS_LEFT_MATRA = 0, + POS_RA, + POS_LEFT_MATRA, - POS_PRE = 1, - POS_BASE = 2, - POS_ABOVE = 3, - POS_BELOW = 4, - POS_POST = 5, + POS_PRE_C, - POS_MATRAS = 6, + POS_BEFORE_HALFS, + POS_HALFS, - POS_REPH = 7, + POS_BASE_C, + POS_ABOVE_C, + POS_BELOW_C, + POS_POST_C, - POS_SMVD = 8 + POS_MATRAS, + + POS_REPH, + + POS_SMVD }; /* Categories used in IndicSyllabicCategory.txt from UCD */ @@ -106,7 +111,7 @@ enum indic_syllabic_category_t { /* Categories used in IndicSMatraCategory.txt from UCD */ enum indic_matra_category_t { - INDIC_MATRA_CATEGORY_NOT_APPLICABLE = POS_BASE, + INDIC_MATRA_CATEGORY_NOT_APPLICABLE = POS_BASE_C, INDIC_MATRA_CATEGORY_LEFT = POS_LEFT_MATRA, INDIC_MATRA_CATEGORY_TOP = POS_MATRAS, @@ -155,100 +160,100 @@ static const struct consonant_position_t { hb_codepoint_t u; indic_position_t position; } consonant_positions[] = { - {0x0930, POS_BELOW}, - {0x09AC, POS_BELOW}, - {0x09AF, POS_POST}, - {0x09B0, POS_BELOW}, - {0x09F0, POS_BELOW}, - {0x0A2F, POS_POST}, - {0x0A30, POS_BELOW}, - {0x0A35, POS_BELOW}, - {0x0A39, POS_BELOW}, - {0x0AB0, POS_BELOW}, - {0x0B24, POS_BELOW}, - {0x0B28, POS_BELOW}, - {0x0B2C, POS_BELOW}, - {0x0B2D, POS_BELOW}, - {0x0B2E, POS_BELOW}, - {0x0B2F, POS_POST}, - {0x0B30, POS_BELOW}, - {0x0B32, POS_BELOW}, - {0x0B33, POS_BELOW}, - {0x0B5F, POS_POST}, - {0x0B71, POS_BELOW}, - {0x0C15, POS_BELOW}, - {0x0C16, POS_BELOW}, - {0x0C17, POS_BELOW}, - {0x0C18, POS_BELOW}, - {0x0C19, POS_BELOW}, - {0x0C1A, POS_BELOW}, - {0x0C1B, POS_BELOW}, - {0x0C1C, POS_BELOW}, - {0x0C1D, POS_BELOW}, - {0x0C1E, POS_BELOW}, - {0x0C1F, POS_BELOW}, - {0x0C20, POS_BELOW}, - {0x0C21, POS_BELOW}, - {0x0C22, POS_BELOW}, - {0x0C23, POS_BELOW}, - {0x0C24, POS_BELOW}, - {0x0C25, POS_BELOW}, - {0x0C26, POS_BELOW}, - {0x0C27, POS_BELOW}, - {0x0C28, POS_BELOW}, - {0x0C2A, POS_BELOW}, - {0x0C2B, POS_BELOW}, - {0x0C2C, POS_BELOW}, - {0x0C2D, POS_BELOW}, - {0x0C2E, POS_BELOW}, - {0x0C2F, POS_BELOW}, - {0x0C30, POS_BELOW}, - {0x0C32, POS_BELOW}, - {0x0C33, POS_BELOW}, - {0x0C35, POS_BELOW}, - {0x0C36, POS_BELOW}, - {0x0C37, POS_BELOW}, - {0x0C38, POS_BELOW}, - {0x0C39, POS_BELOW}, - {0x0C95, POS_BELOW}, - {0x0C96, POS_BELOW}, - {0x0C97, POS_BELOW}, - {0x0C98, POS_BELOW}, - {0x0C99, POS_BELOW}, - {0x0C9A, POS_BELOW}, - {0x0C9B, POS_BELOW}, - {0x0C9C, POS_BELOW}, - {0x0C9D, POS_BELOW}, - {0x0C9E, POS_BELOW}, - {0x0C9F, POS_BELOW}, - {0x0CA0, POS_BELOW}, - {0x0CA1, POS_BELOW}, - {0x0CA2, POS_BELOW}, - {0x0CA3, POS_BELOW}, - {0x0CA4, POS_BELOW}, - {0x0CA5, POS_BELOW}, - {0x0CA6, POS_BELOW}, - {0x0CA7, POS_BELOW}, - {0x0CA8, POS_BELOW}, - {0x0CAA, POS_BELOW}, - {0x0CAB, POS_BELOW}, - {0x0CAC, POS_BELOW}, - {0x0CAD, POS_BELOW}, - {0x0CAE, POS_BELOW}, - {0x0CAF, POS_BELOW}, - {0x0CB0, POS_BELOW}, - {0x0CB2, POS_BELOW}, - {0x0CB3, POS_BELOW}, - {0x0CB5, POS_BELOW}, - {0x0CB6, POS_BELOW}, - {0x0CB7, POS_BELOW}, - {0x0CB8, POS_BELOW}, - {0x0CB9, POS_BELOW}, - {0x0CDE, POS_BELOW}, - {0x0D2F, POS_POST}, - {0x0D30, POS_POST}, - {0x0D32, POS_BELOW}, - {0x0D35, POS_POST}, + {0x0930, POS_BELOW_C}, + {0x09AC, POS_BELOW_C}, + {0x09AF, POS_POST_C}, + {0x09B0, POS_BELOW_C}, + {0x09F0, POS_BELOW_C}, + {0x0A2F, POS_POST_C}, + {0x0A30, POS_BELOW_C}, + {0x0A35, POS_BELOW_C}, + {0x0A39, POS_BELOW_C}, + {0x0AB0, POS_BELOW_C}, + {0x0B24, POS_BELOW_C}, + {0x0B28, POS_BELOW_C}, + {0x0B2C, POS_BELOW_C}, + {0x0B2D, POS_BELOW_C}, + {0x0B2E, POS_BELOW_C}, + {0x0B2F, POS_POST_C}, + {0x0B30, POS_BELOW_C}, + {0x0B32, POS_BELOW_C}, + {0x0B33, POS_BELOW_C}, + {0x0B5F, POS_POST_C}, + {0x0B71, POS_BELOW_C}, + {0x0C15, POS_BELOW_C}, + {0x0C16, POS_BELOW_C}, + {0x0C17, POS_BELOW_C}, + {0x0C18, POS_BELOW_C}, + {0x0C19, POS_BELOW_C}, + {0x0C1A, POS_BELOW_C}, + {0x0C1B, POS_BELOW_C}, + {0x0C1C, POS_BELOW_C}, + {0x0C1D, POS_BELOW_C}, + {0x0C1E, POS_BELOW_C}, + {0x0C1F, POS_BELOW_C}, + {0x0C20, POS_BELOW_C}, + {0x0C21, POS_BELOW_C}, + {0x0C22, POS_BELOW_C}, + {0x0C23, POS_BELOW_C}, + {0x0C24, POS_BELOW_C}, + {0x0C25, POS_BELOW_C}, + {0x0C26, POS_BELOW_C}, + {0x0C27, POS_BELOW_C}, + {0x0C28, POS_BELOW_C}, + {0x0C2A, POS_BELOW_C}, + {0x0C2B, POS_BELOW_C}, + {0x0C2C, POS_BELOW_C}, + {0x0C2D, POS_BELOW_C}, + {0x0C2E, POS_BELOW_C}, + {0x0C2F, POS_BELOW_C}, + {0x0C30, POS_BELOW_C}, + {0x0C32, POS_BELOW_C}, + {0x0C33, POS_BELOW_C}, + {0x0C35, POS_BELOW_C}, + {0x0C36, POS_BELOW_C}, + {0x0C37, POS_BELOW_C}, + {0x0C38, POS_BELOW_C}, + {0x0C39, POS_BELOW_C}, + {0x0C95, POS_BELOW_C}, + {0x0C96, POS_BELOW_C}, + {0x0C97, POS_BELOW_C}, + {0x0C98, POS_BELOW_C}, + {0x0C99, POS_BELOW_C}, + {0x0C9A, POS_BELOW_C}, + {0x0C9B, POS_BELOW_C}, + {0x0C9C, POS_BELOW_C}, + {0x0C9D, POS_BELOW_C}, + {0x0C9E, POS_BELOW_C}, + {0x0C9F, POS_BELOW_C}, + {0x0CA0, POS_BELOW_C}, + {0x0CA1, POS_BELOW_C}, + {0x0CA2, POS_BELOW_C}, + {0x0CA3, POS_BELOW_C}, + {0x0CA4, POS_BELOW_C}, + {0x0CA5, POS_BELOW_C}, + {0x0CA6, POS_BELOW_C}, + {0x0CA7, POS_BELOW_C}, + {0x0CA8, POS_BELOW_C}, + {0x0CAA, POS_BELOW_C}, + {0x0CAB, POS_BELOW_C}, + {0x0CAC, POS_BELOW_C}, + {0x0CAD, POS_BELOW_C}, + {0x0CAE, POS_BELOW_C}, + {0x0CAF, POS_BELOW_C}, + {0x0CB0, POS_BELOW_C}, + {0x0CB2, POS_BELOW_C}, + {0x0CB3, POS_BELOW_C}, + {0x0CB5, POS_BELOW_C}, + {0x0CB6, POS_BELOW_C}, + {0x0CB7, POS_BELOW_C}, + {0x0CB8, POS_BELOW_C}, + {0x0CB9, POS_BELOW_C}, + {0x0CDE, POS_BELOW_C}, + {0x0D2F, POS_POST_C}, + {0x0D30, POS_POST_C}, + {0x0D32, POS_BELOW_C}, + {0x0D35, POS_POST_C}, }; /* XXX diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index e4ae50f..b964861 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -46,7 +46,7 @@ consonant_position (hb_codepoint_t u) sizeof (consonant_positions[0]), compare_codepoint); - return record ? record->position : POS_BASE; + return record ? record->position : POS_BASE_C; } static bool @@ -189,7 +189,7 @@ _hb_ot_shape_complex_setup_masks_indic (hb_ot_map_t *map, hb_buffer_t *buffer, h if (unlikely (buffer->info[i].codepoint == 0x0952)) { buffer->info[i].indic_category() = OT_A; - buffer->info[i].indic_position() = POS_BELOW; + buffer->info[i].indic_position() = POS_SMVD; } } } @@ -253,8 +253,8 @@ found_consonant_syllable (const hb_ot_map_t *map, hb_buffer_t *buffer, hb_mask_t { /* -> that does not have a below-base or post-base form * (post-base forms have to follow below-base forms), */ - if (info[i].indic_position() != POS_BELOW && - info[i].indic_position() != POS_POST) + if (info[i].indic_position() != POS_BELOW_C && + info[i].indic_position() != POS_POST_C) { base = i; break; @@ -321,8 +321,8 @@ found_consonant_syllable (const hb_ot_map_t *map, hb_buffer_t *buffer, hb_mask_t /* Reorder characters */ for (i = start; i < base; i++) - info[i].indic_position() = POS_PRE; - info[base].indic_position() = POS_BASE; + info[i].indic_position() = POS_PRE_C; + info[base].indic_position() = POS_BASE_C; /* Handle beginning Ra */ -- 2.7.4