From 8fdba506f0f1c66b50f8f4b114d624cb956d03b7 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 24 Jun 2011 20:45:55 -0400 Subject: [PATCH] [Indic] Define indic_position_t --- src/hb-ot-shape-complex-indic.cc | 239 ++++++++++++++++++++------------------- 1 file changed, 122 insertions(+), 117 deletions(-) diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index a6edf85..cfd7bb4 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -56,6 +56,17 @@ enum indic_category_t { OT_NBSP }; +/* Visual positions in a syllable from left to right. */ +enum indic_position_t { + POS_PRE, + POS_BASE, + POS_ABOVE, + POS_BELOW, + POS_POST, + + POS_INHERIT /* For Halant, Nukta, ZWJ, ZWNJ */ +}; + /* Categories used in IndicSyllabicCategory.txt from UCD */ /* The assignments are guesswork */ enum indic_syllabic_category_t { @@ -85,31 +96,25 @@ enum indic_syllabic_category_t { /* Categories used in IndicSMatraCategory.txt from UCD */ enum indic_matra_category_t { - INDIC_MATRA_CATEGORY_NOT_APPLICABLE = 0, + INDIC_MATRA_CATEGORY_NOT_APPLICABLE = POS_BASE, - INDIC_MATRA_CATEGORY_LEFT = 0x01, - INDIC_MATRA_CATEGORY_TOP = 0x02, - INDIC_MATRA_CATEGORY_BOTTOM = 0x04, - INDIC_MATRA_CATEGORY_RIGHT = 0x08, + INDIC_MATRA_CATEGORY_LEFT = POS_PRE, + INDIC_MATRA_CATEGORY_TOP = POS_ABOVE, + INDIC_MATRA_CATEGORY_BOTTOM = POS_BELOW, + INDIC_MATRA_CATEGORY_RIGHT = POS_POST, /* We don't really care much about these since we decompose them - * in the generic pre-shaping layer. */ - INDIC_MATRA_CATEGORY_BOTTOM_AND_RIGHT = INDIC_MATRA_CATEGORY_BOTTOM + - INDIC_MATRA_CATEGORY_RIGHT, - INDIC_MATRA_CATEGORY_LEFT_AND_RIGHT = INDIC_MATRA_CATEGORY_LEFT + - INDIC_MATRA_CATEGORY_RIGHT, - INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM = INDIC_MATRA_CATEGORY_TOP + - INDIC_MATRA_CATEGORY_BOTTOM, - INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM_AND_RIGHT = INDIC_MATRA_CATEGORY_TOP + - INDIC_MATRA_CATEGORY_BOTTOM + - INDIC_MATRA_CATEGORY_RIGHT, - INDIC_MATRA_CATEGORY_TOP_AND_LEFT = INDIC_MATRA_CATEGORY_TOP + - INDIC_MATRA_CATEGORY_LEFT, - INDIC_MATRA_CATEGORY_TOP_AND_LEFT_AND_RIGHT = INDIC_MATRA_CATEGORY_TOP + - INDIC_MATRA_CATEGORY_LEFT + - INDIC_MATRA_CATEGORY_RIGHT, - INDIC_MATRA_CATEGORY_TOP_AND_RIGHT = INDIC_MATRA_CATEGORY_TOP + - INDIC_MATRA_CATEGORY_RIGHT, + * in the generic pre-shaping layer. They will only be used if + * the font does not cover the decomposition. In which case, we + * define these as aliases to the place we want the split-matra + * glyph to show up. Quite arbitrary. */ + INDIC_MATRA_CATEGORY_BOTTOM_AND_RIGHT = INDIC_MATRA_CATEGORY_BOTTOM, + INDIC_MATRA_CATEGORY_LEFT_AND_RIGHT = INDIC_MATRA_CATEGORY_LEFT, + INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM = INDIC_MATRA_CATEGORY_BOTTOM, + INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM_AND_RIGHT = INDIC_MATRA_CATEGORY_BOTTOM, + INDIC_MATRA_CATEGORY_TOP_AND_LEFT = INDIC_MATRA_CATEGORY_LEFT, + INDIC_MATRA_CATEGORY_TOP_AND_LEFT_AND_RIGHT = INDIC_MATRA_CATEGORY_LEFT, + INDIC_MATRA_CATEGORY_TOP_AND_RIGHT = INDIC_MATRA_CATEGORY_RIGHT, INDIC_MATRA_CATEGORY_INVISIBLE = INDIC_MATRA_CATEGORY_NOT_APPLICABLE, INDIC_MATRA_CATEGORY_OVERSTRUCK = INDIC_MATRA_CATEGORY_NOT_APPLICABLE, @@ -131,102 +136,102 @@ enum indic_matra_category_t { */ static const struct { hb_codepoint_t u; - indic_matra_category_t position; + indic_position_t position; } consonant_positions[] = { - {0x0930, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x09AC, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x09AF, INDIC_MATRA_CATEGORY_RIGHT}, - {0x09B0, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x09F0, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0A2F, INDIC_MATRA_CATEGORY_RIGHT}, - {0x0A30, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0A35, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0A39, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0AB0, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0B24, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0B28, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0B2C, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0B2D, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0B2E, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0B2F, INDIC_MATRA_CATEGORY_RIGHT}, - {0x0B30, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0B32, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0B33, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0B5F, INDIC_MATRA_CATEGORY_RIGHT}, - {0x0B71, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C15, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C16, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C17, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C18, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C19, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C1A, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C1B, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C1C, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C1D, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C1E, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C1F, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C20, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C21, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C22, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C23, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C24, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C25, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C26, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C27, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C28, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C2A, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C2B, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C2C, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C2D, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C2E, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C2F, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C30, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C32, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C33, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C35, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C36, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C37, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C38, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C39, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C95, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C96, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C97, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C98, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C99, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C9A, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C9B, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C9C, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C9D, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C9E, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0C9F, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CA0, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CA1, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CA2, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CA3, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CA4, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CA5, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CA6, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CA7, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CA8, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CAA, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CAB, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CAC, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CAD, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CAE, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CAF, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CB0, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CB2, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CB3, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CB5, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CB6, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CB7, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CB8, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CB9, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0CDE, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0D2F, INDIC_MATRA_CATEGORY_RIGHT}, - {0x0D30, INDIC_MATRA_CATEGORY_RIGHT}, - {0x0D32, INDIC_MATRA_CATEGORY_BOTTOM}, - {0x0D35, INDIC_MATRA_CATEGORY_RIGHT}, + {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}, }; -- 2.7.4