michael@0: /* michael@0: * Copyright © 2012 Google, Inc. michael@0: * michael@0: * This is part of HarfBuzz, a text shaping library. michael@0: * michael@0: * Permission is hereby granted, without written agreement and without michael@0: * license or royalty fees, to use, copy, modify, and distribute this michael@0: * software and its documentation for any purpose, provided that the michael@0: * above copyright notice and the following two paragraphs appear in michael@0: * all copies of this software. michael@0: * michael@0: * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR michael@0: * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES michael@0: * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN michael@0: * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH michael@0: * DAMAGE. michael@0: * michael@0: * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, michael@0: * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND michael@0: * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS michael@0: * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO michael@0: * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. michael@0: * michael@0: * Google Author(s): Behdad Esfahbod michael@0: */ michael@0: michael@0: #ifndef HB_OT_SHAPE_COMPLEX_INDIC_PRIVATE_HH michael@0: #define HB_OT_SHAPE_COMPLEX_INDIC_PRIVATE_HH michael@0: michael@0: #include "hb-private.hh" michael@0: michael@0: michael@0: #include "hb-ot-shape-complex-private.hh" michael@0: #include "hb-ot-shape-private.hh" /* XXX Remove */ michael@0: michael@0: michael@0: #define INDIC_TABLE_ELEMENT_TYPE uint16_t michael@0: michael@0: /* Cateories used in the OpenType spec: michael@0: * https://www.microsoft.com/typography/otfntdev/devanot/shaping.aspx michael@0: */ michael@0: /* Note: This enum is duplicated in the -machine.rl source file. michael@0: * Not sure how to avoid duplication. */ michael@0: enum indic_category_t { michael@0: OT_X = 0, michael@0: OT_C = 1, michael@0: OT_V = 2, michael@0: OT_N = 3, michael@0: OT_H = 4, michael@0: OT_ZWNJ = 5, michael@0: OT_ZWJ = 6, michael@0: OT_M = 7, michael@0: OT_SM = 8, michael@0: OT_VD = 9, michael@0: OT_A = 10, michael@0: OT_NBSP = 11, michael@0: OT_DOTTEDCIRCLE = 12, michael@0: OT_RS = 13, /* Register Shifter, used in Khmer OT spec. */ michael@0: OT_Coeng = 14, /* Khmer-style Virama. */ michael@0: OT_Repha = 15, /* Atomically-encoded logical or visual repha. */ michael@0: OT_Ra = 16, michael@0: OT_CM = 17, /* Consonant-Medial. */ michael@0: OT_Avag = 18, /* Avagraha. */ michael@0: OT_CM2 = 31 /* Consonant-Medial, second slot. */ michael@0: }; michael@0: michael@0: /* Visual positions in a syllable from left to right. */ michael@0: enum indic_position_t { michael@0: POS_START, michael@0: michael@0: POS_RA_TO_BECOME_REPH, michael@0: POS_PRE_M, michael@0: POS_PRE_C, michael@0: michael@0: POS_BASE_C, michael@0: POS_AFTER_MAIN, michael@0: michael@0: POS_ABOVE_C, michael@0: michael@0: POS_BEFORE_SUB, michael@0: POS_BELOW_C, michael@0: POS_AFTER_SUB, michael@0: michael@0: POS_BEFORE_POST, michael@0: POS_POST_C, michael@0: POS_AFTER_POST, michael@0: michael@0: POS_FINAL_C, michael@0: POS_SMVD, michael@0: michael@0: POS_END michael@0: }; michael@0: michael@0: /* Categories used in IndicSyllabicCategory.txt from UCD. */ michael@0: enum indic_syllabic_category_t { michael@0: INDIC_SYLLABIC_CATEGORY_OTHER = OT_X, michael@0: michael@0: INDIC_SYLLABIC_CATEGORY_AVAGRAHA = OT_Avag, michael@0: INDIC_SYLLABIC_CATEGORY_BINDU = OT_SM, michael@0: INDIC_SYLLABIC_CATEGORY_CONSONANT = OT_C, michael@0: INDIC_SYLLABIC_CATEGORY_CONSONANT_DEAD = OT_C, michael@0: INDIC_SYLLABIC_CATEGORY_CONSONANT_FINAL = OT_CM, michael@0: INDIC_SYLLABIC_CATEGORY_CONSONANT_HEAD_LETTER = OT_C, michael@0: INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL = OT_CM, michael@0: INDIC_SYLLABIC_CATEGORY_CONSONANT_PLACEHOLDER = OT_NBSP, michael@0: INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED = OT_CM, michael@0: INDIC_SYLLABIC_CATEGORY_CONSONANT_REPHA = OT_Repha, michael@0: INDIC_SYLLABIC_CATEGORY_MODIFYING_LETTER = OT_X, michael@0: INDIC_SYLLABIC_CATEGORY_NUKTA = OT_N, michael@0: INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER = OT_RS, michael@0: INDIC_SYLLABIC_CATEGORY_TONE_LETTER = OT_X, michael@0: INDIC_SYLLABIC_CATEGORY_TONE_MARK = OT_N, michael@0: INDIC_SYLLABIC_CATEGORY_VIRAMA = OT_H, michael@0: INDIC_SYLLABIC_CATEGORY_VISARGA = OT_SM, michael@0: INDIC_SYLLABIC_CATEGORY_VOWEL = OT_V, michael@0: INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT = OT_M, michael@0: INDIC_SYLLABIC_CATEGORY_VOWEL_INDEPENDENT = OT_V michael@0: }; michael@0: michael@0: /* Categories used in IndicSMatraCategory.txt from UCD */ michael@0: enum indic_matra_category_t { michael@0: INDIC_MATRA_CATEGORY_NOT_APPLICABLE = POS_END, michael@0: michael@0: INDIC_MATRA_CATEGORY_LEFT = POS_PRE_C, michael@0: INDIC_MATRA_CATEGORY_TOP = POS_ABOVE_C, michael@0: INDIC_MATRA_CATEGORY_BOTTOM = POS_BELOW_C, michael@0: INDIC_MATRA_CATEGORY_RIGHT = POS_POST_C, michael@0: michael@0: /* These should resolve to the position of the last part of the split sequence. */ michael@0: INDIC_MATRA_CATEGORY_BOTTOM_AND_RIGHT = INDIC_MATRA_CATEGORY_RIGHT, michael@0: INDIC_MATRA_CATEGORY_LEFT_AND_RIGHT = INDIC_MATRA_CATEGORY_RIGHT, michael@0: INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM = INDIC_MATRA_CATEGORY_BOTTOM, michael@0: INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM_AND_RIGHT = INDIC_MATRA_CATEGORY_RIGHT, michael@0: INDIC_MATRA_CATEGORY_TOP_AND_LEFT = INDIC_MATRA_CATEGORY_TOP, michael@0: INDIC_MATRA_CATEGORY_TOP_AND_LEFT_AND_RIGHT = INDIC_MATRA_CATEGORY_RIGHT, michael@0: INDIC_MATRA_CATEGORY_TOP_AND_RIGHT = INDIC_MATRA_CATEGORY_RIGHT, michael@0: michael@0: INDIC_MATRA_CATEGORY_INVISIBLE = INDIC_MATRA_CATEGORY_NOT_APPLICABLE, michael@0: INDIC_MATRA_CATEGORY_OVERSTRUCK = POS_AFTER_MAIN, michael@0: INDIC_MATRA_CATEGORY_VISUAL_ORDER_LEFT = POS_PRE_M michael@0: }; michael@0: michael@0: /* Note: We use ASSERT_STATIC_EXPR_ZERO() instead of ASSERT_STATIC_EXPR() and the comma operation michael@0: * because gcc fails to optimize the latter and fills the table in at runtime. */ michael@0: #define INDIC_COMBINE_CATEGORIES(S,M) \ michael@0: (ASSERT_STATIC_EXPR_ZERO (M == INDIC_MATRA_CATEGORY_NOT_APPLICABLE || (S == INDIC_SYLLABIC_CATEGORY_VIRAMA || S == INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT)) + \ michael@0: ASSERT_STATIC_EXPR_ZERO (S < 255 && M < 255) + \ michael@0: ((M << 8) | S)) michael@0: michael@0: HB_INTERNAL INDIC_TABLE_ELEMENT_TYPE michael@0: hb_indic_get_categories (hb_codepoint_t u); michael@0: michael@0: #endif /* HB_OT_SHAPE_COMPLEX_INDIC_PRIVATE_HH */