From 20503ccd578c9983162857954e3236413469ed35 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 7 Jun 2011 17:02:48 -0400 Subject: [PATCH] More Indic data shuffling --- src/hb-ot-shape-complex-indic.cc | 76 +++++++++++++++++++++----------- 1 file changed, 51 insertions(+), 25 deletions(-) diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 901c0e53b..62bea9a60 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -1,5 +1,5 @@ /* - * Copyright © 2010 Google, Inc. + * Copyright © 2011 Google, Inc. * * This is part of HarfBuzz, a text shaping library. * @@ -34,37 +34,60 @@ HB_BEGIN_DECLS #define INDIC_TABLE_ELEMENT_TYPE uint8_t -enum indic_syllabic_category_t { - INDIC_SYLLABIC_CATEGORY_AVAGRAHA, - INDIC_SYLLABIC_CATEGORY_BINDU, - INDIC_SYLLABIC_CATEGORY_CONSONANT, - INDIC_SYLLABIC_CATEGORY_CONSONANT_DEAD, - INDIC_SYLLABIC_CATEGORY_CONSONANT_FINAL, - INDIC_SYLLABIC_CATEGORY_CONSONANT_HEAD_LETTER, - INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL, - INDIC_SYLLABIC_CATEGORY_CONSONANT_PLACEHOLDER, - INDIC_SYLLABIC_CATEGORY_CONSONANT_REPHA, - INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED, - INDIC_SYLLABIC_CATEGORY_MODIFYING_LETTER, - INDIC_SYLLABIC_CATEGORY_NUKTA, - INDIC_SYLLABIC_CATEGORY_OTHER, - INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER, - INDIC_SYLLABIC_CATEGORY_TONE_LETTER, - INDIC_SYLLABIC_CATEGORY_TONE_MARK, - INDIC_SYLLABIC_CATEGORY_VIRAMA, - INDIC_SYLLABIC_CATEGORY_VISARGA, - INDIC_SYLLABIC_CATEGORY_VOWEL, - INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT, - INDIC_SYLLABIC_CATEGORY_VOWEL_INDEPENDENT, +/* Cateories used in the OpenType spec: + * https://www.microsoft.com/typography/otfntdev/devanot/shaping.aspx + */ +enum { + OT_X = 0, + OT_C, + OT_V, + OT_N, + OT_H, + OT_ZWNJ, + OT_ZWJ, + OT_M, + OT_SM, + OT_VD, + OT_A, + OT_NBSP, }; +/* Categories used in IndicSyllabicCategory.txt from UCD */ +/* The assignments are guesswork */ +enum indic_syllabic_category_t { + INDIC_SYLLABIC_CATEGORY_OTHER = OT_X, + + INDIC_SYLLABIC_CATEGORY_AVAGRAHA = OT_SM, + INDIC_SYLLABIC_CATEGORY_BINDU = OT_SM, + INDIC_SYLLABIC_CATEGORY_CONSONANT = OT_C, + INDIC_SYLLABIC_CATEGORY_CONSONANT_DEAD = OT_C, + INDIC_SYLLABIC_CATEGORY_CONSONANT_FINAL = OT_C, + INDIC_SYLLABIC_CATEGORY_CONSONANT_HEAD_LETTER = OT_C, + INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL = OT_C, + INDIC_SYLLABIC_CATEGORY_CONSONANT_PLACEHOLDER = OT_NBSP, + INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED = OT_C, + INDIC_SYLLABIC_CATEGORY_CONSONANT_REPHA = OT_C, + INDIC_SYLLABIC_CATEGORY_MODIFYING_LETTER = OT_SM, + INDIC_SYLLABIC_CATEGORY_NUKTA = OT_N, + INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER = OT_SM, + INDIC_SYLLABIC_CATEGORY_TONE_LETTER = OT_V, + INDIC_SYLLABIC_CATEGORY_TONE_MARK = OT_M, + INDIC_SYLLABIC_CATEGORY_VIRAMA = OT_H, + INDIC_SYLLABIC_CATEGORY_VISARGA = OT_SM, + INDIC_SYLLABIC_CATEGORY_VOWEL = OT_V, + INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT = OT_M, + INDIC_SYLLABIC_CATEGORY_VOWEL_INDEPENDENT = OT_V, +}; + +/* Categories used in IndicSMatraCategory.txt from UCD */ enum indic_matra_category_t { + INDIC_MATRA_CATEGORY_NOT_APPLICABLE = 0, + INDIC_MATRA_CATEGORY_BOTTOM, INDIC_MATRA_CATEGORY_BOTTOM_AND_RIGHT, INDIC_MATRA_CATEGORY_INVISIBLE, INDIC_MATRA_CATEGORY_LEFT, INDIC_MATRA_CATEGORY_LEFT_AND_RIGHT, - INDIC_MATRA_CATEGORY_NOT_APPLICABLE, INDIC_MATRA_CATEGORY_OVERSTRUCK, INDIC_MATRA_CATEGORY_RIGHT, INDIC_MATRA_CATEGORY_TOP, @@ -76,7 +99,10 @@ enum indic_matra_category_t { INDIC_MATRA_CATEGORY_VISUAL_ORDER_LEFT, }; -#define INDIC_COMBINE_CATEGORIES(S,M) (S) +#define INDIC_COMBINE_CATEGORIES(S,M) \ + (ASSERT_STATIC_EXPR (M == INDIC_MATRA_CATEGORY_NOT_APPLICABLE || (S == INDIC_SYLLABIC_CATEGORY_VIRAMA || S == INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT)), \ + ASSERT_STATIC_EXPR (S < 16 && M < 16), \ + (M << 4) | S) #include "hb-ot-shape-complex-indic-table.hh"