hb-ot-shape-complex-indic-private.hh revision dba186711e3f5e723f917b7104e849c4c525d3b8
13ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod/* 23ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * Copyright © 2012 Google, Inc. 33ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * 43ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * This is part of HarfBuzz, a text shaping library. 53ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * 63ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * Permission is hereby granted, without written agreement and without 73ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * license or royalty fees, to use, copy, modify, and distribute this 83ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * software and its documentation for any purpose, provided that the 93ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * above copyright notice and the following two paragraphs appear in 103ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * all copies of this software. 113ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * 123ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 133ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 143ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 153ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 163ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * DAMAGE. 173ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * 183ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 193ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 203ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 213ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 223ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 233ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * 243ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * Google Author(s): Behdad Esfahbod 253ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod */ 263ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 273ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod#ifndef HB_OT_SHAPE_COMPLEX_INDIC_PRIVATE_HH 283ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod#define HB_OT_SHAPE_COMPLEX_INDIC_PRIVATE_HH 293ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 303ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod#include "hb-private.hh" 313ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 323ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 333ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod#include "hb-ot-shape-complex-private.hh" 343eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod#include "hb-ot-shape-private.hh" /* XXX Remove */ 353ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 363ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 373ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod/* buffer var allocations */ 38cd0c6e148f6d078b364370cb2f808b793b921be2Behdad Esfahbod#define indic_category() complex_var_u8_0() /* indic_category_t */ 39cd0c6e148f6d078b364370cb2f808b793b921be2Behdad Esfahbod#define indic_position() complex_var_u8_1() /* indic_matra_category_t */ 403ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 41f83aaa3133de5d807be267a100d6a200e8db9017Behdad Esfahbod 42dba186711e3f5e723f917b7104e849c4c525d3b8Behdad Esfahbod#define INDIC_TABLE_ELEMENT_TYPE uint16_t 433ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 443ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod/* Cateories used in the OpenType spec: 453ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * https://www.microsoft.com/typography/otfntdev/devanot/shaping.aspx 463ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod */ 473ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod/* Note: This enum is duplicated in the -machine.rl source file. 483ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * Not sure how to avoid duplication. */ 493ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbodenum indic_category_t { 503ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_X = 0, 513ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_C, 523ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_V, 533ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_N, 543ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_H, 553ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_ZWNJ, 563ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_ZWJ, 573ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_M, 583ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_SM, 593ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_VD, 603ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_A, 6118c06e189bd078affbb84c3bb5bb80687a227c5eBehdad Esfahbod OT_NBSP, 627d09c98a1fff97127e48eae48d380dc9fcff288eBehdad Esfahbod OT_DOTTEDCIRCLE, /* Not in the spec, but special in Uniscribe. /Very very/ special! */ 6325bc489498ef7d0beb8fe9ab663e3f0b2f52c9c2Behdad Esfahbod OT_RS, /* Register Shifter, used in Khmer OT spec */ 64db8981f1e0e8625714568c6d0f11f0b317b11d0aBehdad Esfahbod OT_Coeng, 65db8981f1e0e8625714568c6d0f11f0b317b11d0aBehdad Esfahbod OT_Repha, 66db8981f1e0e8625714568c6d0f11f0b317b11d0aBehdad Esfahbod OT_Ra /* Not explicitly listed in the OT spec, but used in the grammar. */ 673ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod}; 683ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 693ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod/* Visual positions in a syllable from left to right. */ 703ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbodenum indic_position_t { 7181202bd860e4034c18d9f80c5a4f33d9f48463a3Behdad Esfahbod POS_START, 7281202bd860e4034c18d9f80c5a4f33d9f48463a3Behdad Esfahbod 733d25079f8d6be81b9b4b91d3a97016b8a572f571Behdad Esfahbod POS_RA_TO_BECOME_REPH, 746a091df9b403b147ef78f3974610dedf4ce1e08aBehdad Esfahbod POS_PRE_M, 75dbccf87eef0d26838fa4bb3ae26410f6c4818836Behdad Esfahbod POS_PRE_C, 76be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod 77dbccf87eef0d26838fa4bb3ae26410f6c4818836Behdad Esfahbod POS_BASE_C, 78be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod POS_AFTER_MAIN, 79be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod 80dbccf87eef0d26838fa4bb3ae26410f6c4818836Behdad Esfahbod POS_ABOVE_C, 81be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod 82be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod POS_BEFORE_SUB, 83dbccf87eef0d26838fa4bb3ae26410f6c4818836Behdad Esfahbod POS_BELOW_C, 84be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod POS_AFTER_SUB, 85be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod 86be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod POS_BEFORE_POST, 87dbccf87eef0d26838fa4bb3ae26410f6c4818836Behdad Esfahbod POS_POST_C, 88be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod POS_AFTER_POST, 89be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod 9055f70ebfb95083f515d9b0044a2a65ab11484bb5Behdad Esfahbod POS_FINAL_C, 91be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod POS_SMVD, 9281202bd860e4034c18d9f80c5a4f33d9f48463a3Behdad Esfahbod 93be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod POS_END 943ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod}; 953ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 96c5306b6861cfaa50af40e8ceb058791fa06d7981Behdad Esfahbod/* Categories used in IndicSyllabicCategory.txt from UCD. */ 973ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbodenum indic_syllabic_category_t { 983ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_OTHER = OT_X, 993ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 1003ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_AVAGRAHA = OT_X, 1013ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_BINDU = OT_SM, 1023ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_CONSONANT = OT_C, 1033ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_CONSONANT_DEAD = OT_C, 1043ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_CONSONANT_FINAL = OT_C, 1053ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_CONSONANT_HEAD_LETTER = OT_C, 1063ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL = OT_C, 1073ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_CONSONANT_PLACEHOLDER = OT_NBSP, 1083ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED = OT_C, 109db8981f1e0e8625714568c6d0f11f0b317b11d0aBehdad Esfahbod INDIC_SYLLABIC_CATEGORY_CONSONANT_REPHA = OT_Repha, 1103ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_MODIFYING_LETTER = OT_X, 1113ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_NUKTA = OT_N, 1127d09c98a1fff97127e48eae48d380dc9fcff288eBehdad Esfahbod INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER = OT_RS, 1133ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_TONE_LETTER = OT_X, 1143ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_TONE_MARK = OT_X, 1153ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_VIRAMA = OT_H, 1163ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_VISARGA = OT_SM, 1173ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_VOWEL = OT_V, 1183ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT = OT_M, 1193ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_VOWEL_INDEPENDENT = OT_V 1203ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod}; 1213ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 1223ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod/* Categories used in IndicSMatraCategory.txt from UCD */ 1233ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbodenum indic_matra_category_t { 1242ec934c6c25423e7af20d909a9c698a149808ea9Behdad Esfahbod INDIC_MATRA_CATEGORY_NOT_APPLICABLE = POS_END, 1253ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 1268bb32458f95f13f66688e0811cc91f1bfffb867dBehdad Esfahbod INDIC_MATRA_CATEGORY_LEFT = POS_PRE_C, 1278bb32458f95f13f66688e0811cc91f1bfffb867dBehdad Esfahbod INDIC_MATRA_CATEGORY_TOP = POS_ABOVE_C, 1288bb32458f95f13f66688e0811cc91f1bfffb867dBehdad Esfahbod INDIC_MATRA_CATEGORY_BOTTOM = POS_BELOW_C, 1298bb32458f95f13f66688e0811cc91f1bfffb867dBehdad Esfahbod INDIC_MATRA_CATEGORY_RIGHT = POS_POST_C, 1303ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 131f83aaa3133de5d807be267a100d6a200e8db9017Behdad Esfahbod /* These should resolve to the position of the last part of the split sequence. */ 132f83aaa3133de5d807be267a100d6a200e8db9017Behdad Esfahbod INDIC_MATRA_CATEGORY_BOTTOM_AND_RIGHT = INDIC_MATRA_CATEGORY_RIGHT, 133f83aaa3133de5d807be267a100d6a200e8db9017Behdad Esfahbod INDIC_MATRA_CATEGORY_LEFT_AND_RIGHT = INDIC_MATRA_CATEGORY_RIGHT, 134f83aaa3133de5d807be267a100d6a200e8db9017Behdad Esfahbod INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM = INDIC_MATRA_CATEGORY_BOTTOM, 135f83aaa3133de5d807be267a100d6a200e8db9017Behdad Esfahbod INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM_AND_RIGHT = INDIC_MATRA_CATEGORY_RIGHT, 136f83aaa3133de5d807be267a100d6a200e8db9017Behdad Esfahbod INDIC_MATRA_CATEGORY_TOP_AND_LEFT = INDIC_MATRA_CATEGORY_TOP, 137f83aaa3133de5d807be267a100d6a200e8db9017Behdad Esfahbod INDIC_MATRA_CATEGORY_TOP_AND_LEFT_AND_RIGHT = INDIC_MATRA_CATEGORY_RIGHT, 138f83aaa3133de5d807be267a100d6a200e8db9017Behdad Esfahbod INDIC_MATRA_CATEGORY_TOP_AND_RIGHT = INDIC_MATRA_CATEGORY_RIGHT, 1393ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 1403ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_MATRA_CATEGORY_INVISIBLE = INDIC_MATRA_CATEGORY_NOT_APPLICABLE, 1413ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_MATRA_CATEGORY_OVERSTRUCK = INDIC_MATRA_CATEGORY_NOT_APPLICABLE, 1423ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_MATRA_CATEGORY_VISUAL_ORDER_LEFT = INDIC_MATRA_CATEGORY_NOT_APPLICABLE 1433ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod}; 1443ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 1453ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod/* Note: We use ASSERT_STATIC_EXPR_ZERO() instead of ASSERT_STATIC_EXPR() and the comma operation 1463ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * because gcc fails to optimize the latter and fills the table in at runtime. */ 1473ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod#define INDIC_COMBINE_CATEGORIES(S,M) \ 1483ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod (ASSERT_STATIC_EXPR_ZERO (M == INDIC_MATRA_CATEGORY_NOT_APPLICABLE || (S == INDIC_SYLLABIC_CATEGORY_VIRAMA || S == INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT)) + \ 149dba186711e3f5e723f917b7104e849c4c525d3b8Behdad Esfahbod ASSERT_STATIC_EXPR_ZERO (S < 255 && M < 255) + \ 150dba186711e3f5e723f917b7104e849c4c525d3b8Behdad Esfahbod ((M << 8) | S)) 1513ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 1523ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 1533ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod#include "hb-ot-shape-complex-indic-table.hh" 1543ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 1553ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 1563eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod#define IN_HALF_BLOCK(u, Base) (((u) & ~0x7F) == (Base)) 1573eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 1583eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod#define IS_DEVA(u) (IN_HALF_BLOCK (u, 0x0900)) 1593eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod#define IS_BENG(u) (IN_HALF_BLOCK (u, 0x0980)) 16011b0e20ba42bf0b17133c3e1087732802bb4f230Behdad Esfahbod#define IS_GURU(u) (IN_HALF_BLOCK (u, 0x0A00)) 16111b0e20ba42bf0b17133c3e1087732802bb4f230Behdad Esfahbod#define IS_GUJR(u) (IN_HALF_BLOCK (u, 0x0A80)) 1623eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod#define IS_ORYA(u) (IN_HALF_BLOCK (u, 0x0B00)) 1633eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod#define IS_TAML(u) (IN_HALF_BLOCK (u, 0x0B80)) 1643eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod#define IS_TELU(u) (IN_HALF_BLOCK (u, 0x0C00)) 1653eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod#define IS_KNDA(u) (IN_HALF_BLOCK (u, 0x0C80)) 1663eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod#define IS_MLYM(u) (IN_HALF_BLOCK (u, 0x0D00)) 1673eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod#define IS_SINH(u) (IN_HALF_BLOCK (u, 0x0D80)) 1683eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod#define IS_KHMR(u) (IN_HALF_BLOCK (u, 0x1780)) 1693eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 1703eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 1713eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod#define MATRA_POS_LEFT(u) POS_PRE_M 1723eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod#define MATRA_POS_RIGHT(u) ( \ 1733eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_DEVA(u) ? POS_AFTER_SUB : \ 1743eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_BENG(u) ? POS_AFTER_POST : \ 17511b0e20ba42bf0b17133c3e1087732802bb4f230Behdad Esfahbod IS_GURU(u) ? POS_AFTER_POST : \ 17611b0e20ba42bf0b17133c3e1087732802bb4f230Behdad Esfahbod IS_GUJR(u) ? POS_AFTER_POST : \ 1773eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_ORYA(u) ? POS_AFTER_POST : \ 1783eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_TAML(u) ? POS_AFTER_POST : \ 1793eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_TELU(u) ? (u <= 0x0C42 ? POS_BEFORE_SUB : POS_AFTER_SUB) : \ 1803eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_KNDA(u) ? (u < 0x0CC3 || u > 0xCD6 ? POS_BEFORE_SUB : POS_AFTER_SUB) : \ 1813eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_MLYM(u) ? POS_AFTER_POST : \ 1823eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_SINH(u) ? POS_AFTER_SUB : \ 1833eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_KHMR(u) ? POS_AFTER_POST : \ 1843eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod /*default*/ POS_AFTER_SUB \ 1853eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod ) 1863eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod#define MATRA_POS_TOP(u) ( /* BENG and MLYM don't have top matras. */ \ 1873eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_DEVA(u) ? POS_AFTER_SUB : \ 18811b0e20ba42bf0b17133c3e1087732802bb4f230Behdad Esfahbod IS_GURU(u) ? POS_AFTER_POST : /* Deviate from spec */ \ 18911b0e20ba42bf0b17133c3e1087732802bb4f230Behdad Esfahbod IS_GUJR(u) ? POS_AFTER_SUB : \ 1903eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_ORYA(u) ? POS_AFTER_MAIN : \ 1913eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_TAML(u) ? POS_AFTER_SUB : \ 1923eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_TELU(u) ? POS_BEFORE_SUB : \ 1933eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_KNDA(u) ? POS_BEFORE_SUB : \ 1943eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_SINH(u) ? POS_AFTER_SUB : \ 1953eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_KHMR(u) ? POS_AFTER_POST : \ 1963eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod /*default*/ POS_AFTER_SUB \ 1973eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod ) 1983eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod#define MATRA_POS_BOTTOM(u) ( \ 1993eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_DEVA(u) ? POS_AFTER_SUB : \ 2003eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_BENG(u) ? POS_AFTER_SUB : \ 20111b0e20ba42bf0b17133c3e1087732802bb4f230Behdad Esfahbod IS_GURU(u) ? POS_AFTER_POST : \ 20211b0e20ba42bf0b17133c3e1087732802bb4f230Behdad Esfahbod IS_GUJR(u) ? POS_AFTER_POST : \ 2033eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_ORYA(u) ? POS_AFTER_SUB : \ 2043eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_TAML(u) ? POS_AFTER_POST : \ 2053eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_TELU(u) ? POS_BEFORE_SUB : \ 2063eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_KNDA(u) ? POS_BEFORE_SUB : \ 2073eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_MLYM(u) ? POS_AFTER_POST : \ 2083eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_SINH(u) ? POS_AFTER_SUB : \ 2093eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod IS_KHMR(u) ? POS_AFTER_POST : \ 2103eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod /*default*/ POS_AFTER_SUB \ 2113eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod ) 2123eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 2133eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 2143eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbodstatic inline indic_position_t 2153eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbodmatra_position (hb_codepoint_t u, indic_position_t side) 2163eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod{ 2173eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod switch ((int) side) 2183eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod { 2193eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod case POS_PRE_C: return MATRA_POS_LEFT (u); 2203eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod case POS_POST_C: return MATRA_POS_RIGHT (u); 2213eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod case POS_ABOVE_C: return MATRA_POS_TOP (u); 2223eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod case POS_BELOW_C: return MATRA_POS_BOTTOM (u); 2233eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod }; 2243eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod abort (); 2253eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod} 2263eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 2273eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 2283eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 2293ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod/* XXX 2303ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * This is a hack for now. We should move this data into the main Indic table. 23174e54cf446bb979e488685e8c09eeed6b9d03c24Behdad Esfahbod * Or completely remove it and just check in the tables. 2323ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod */ 2333ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbodstatic const hb_codepoint_t ra_chars[] = { 2343ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 0x0930, /* Devanagari */ 2353ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 0x09B0, /* Bengali */ 2363ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 0x09F0, /* Bengali */ 23774e54cf446bb979e488685e8c09eeed6b9d03c24Behdad Esfahbod 0x0A30, /* Gurmukhi */ /* No Reph */ 2383ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 0x0AB0, /* Gujarati */ 2393ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 0x0B30, /* Oriya */ 24074e54cf446bb979e488685e8c09eeed6b9d03c24Behdad Esfahbod 0x0BB0, /* Tamil */ /* No Reph */ 241f31d97e44eeb6fb141f3de928e27e033fc7b1f47Behdad Esfahbod 0x0C30, /* Telugu */ /* Reph formed only with ZWJ */ 2423ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 0x0CB0, /* Kannada */ 243e092c556fb1cf38be3cea1f4b75a0d879372dfa2Behdad Esfahbod 0x0D30, /* Malayalam */ /* No Reph, Logical Repha */ 244fcdc5f1c8849a7f38d9f34f64d60c6d95d7501f7Behdad Esfahbod 2453285e107c9a83aeb552e67f9460680ff6d167d88Behdad Esfahbod 0x0DBB, /* Sinhala */ /* Reph formed only with ZWJ */ 2463285e107c9a83aeb552e67f9460680ff6d167d88Behdad Esfahbod 247e092c556fb1cf38be3cea1f4b75a0d879372dfa2Behdad Esfahbod 0x179A, /* Khmer */ /* No Reph, Visual Repha */ 2483ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod}; 2493ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 2503eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbodstatic inline indic_position_t 2513eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbodconsonant_position (hb_codepoint_t u) 2523eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod{ 2533eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod if ((u & ~0x007F) == 0x1780) 2543eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod return POS_BELOW_C; /* In Khmer coeng model, post and below forms should not be reordered. */ 2553eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod return POS_BASE_C; /* Will recategorize later based on font lookups. */ 2563eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod} 2573eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 2583eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbodstatic inline bool 2593eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbodis_ra (hb_codepoint_t u) 2603eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod{ 2613eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod for (unsigned int i = 0; i < ARRAY_LENGTH (ra_chars); i++) 2623eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod if (u == ra_chars[i]) 2633eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod return true; 2643eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod return false; 2653eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod} 2663eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 2673eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 2683eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbodstatic inline bool 2693eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbodis_one_of (const hb_glyph_info_t &info, unsigned int flags) 2703eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod{ 2713eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod /* If it ligated, all bets are off. */ 2723eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod if (is_a_ligature (info)) return false; 2733eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod return !!(FLAG (info.indic_category()) & flags); 2743eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod} 2753eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 2763eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod#define JOINER_FLAGS (FLAG (OT_ZWJ) | FLAG (OT_ZWNJ)) 2773eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbodstatic inline bool 2783eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbodis_joiner (const hb_glyph_info_t &info) 2793eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod{ 2803eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod return is_one_of (info, JOINER_FLAGS); 2813eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod} 2823eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 2833eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod/* Note: 2843eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod * 2853eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod * We treat Vowels and placeholders as if they were consonants. This is safe because Vowels 2863eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod * cannot happen in a consonant syllable. The plus side however is, we can call the 2873eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod * consonant syllable logic from the vowel syllable function and get it all right! */ 2883eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod#define CONSONANT_FLAGS (FLAG (OT_C) | FLAG (OT_Ra) | FLAG (OT_V) | FLAG (OT_NBSP) | FLAG (OT_DOTTEDCIRCLE)) 2893eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbodstatic inline bool 2903eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbodis_consonant (const hb_glyph_info_t &info) 2913eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod{ 2923eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod return is_one_of (info, CONSONANT_FLAGS); 2933eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod} 2943eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 2953eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod#define HALANT_OR_COENG_FLAGS (FLAG (OT_H) | FLAG (OT_Coeng)) 2963eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbodstatic inline bool 2973eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbodis_halant_or_coeng (const hb_glyph_info_t &info) 2983eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod{ 2993eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod return is_one_of (info, HALANT_OR_COENG_FLAGS); 3003eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod} 3013eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 3023eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbodstatic inline void 303b85800f9de8976a7418ef9df467d3080c6ab0199Behdad Esfahbodset_indic_properties (hb_glyph_info_t &info) 3043eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod{ 3053eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod hb_codepoint_t u = info.codepoint; 3063eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod unsigned int type = get_indic_categories (u); 307dba186711e3f5e723f917b7104e849c4c525d3b8Behdad Esfahbod indic_category_t cat = (indic_category_t) (type & 0x7F); 308dba186711e3f5e723f917b7104e849c4c525d3b8Behdad Esfahbod indic_position_t pos = (indic_position_t) (type >> 8); 3093eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 3103eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 3113eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod /* 3123eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod * Re-assign category 3133eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod */ 3143eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 3153eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 3163eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod /* The spec says U+0952 is OT_A. However, testing shows that Uniscribe 3173eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod * treats U+0951..U+0952 all as OT_VD. 3183eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod * TESTS: 3193eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod * U+092E,U+0947,U+0952 3203eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod * U+092E,U+0952,U+0947 3213eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod * U+092E,U+0947,U+0951 3223eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod * U+092E,U+0951,U+0947 3233eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod * */ 3243eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x0951, 0x0954))) 3253eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod cat = OT_VD; 3263eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 3273eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod if (unlikely (u == 0x17D1)) 3283eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod cat = OT_X; 3293eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod if (cat == OT_X && 3303eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod unlikely (hb_in_range<hb_codepoint_t> (u, 0x17CB, 0x17D3))) /* Khmer Various signs */ 3313eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod { 3323eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod /* These are like Top Matras. */ 3333eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod cat = OT_M; 3343eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod pos = POS_ABOVE_C; 3353eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod } 3363eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod if (u == 0x17C6) /* Khmer Bindu doesn't like to be repositioned. */ 3373eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod cat = OT_N; 3383eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 3393eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod if (unlikely (u == 0x17D2)) cat = OT_Coeng; /* Khmer coeng */ 3403eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod else if (unlikely (u == 0x200C)) cat = OT_ZWNJ; 3413eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod else if (unlikely (u == 0x200D)) cat = OT_ZWJ; 3423eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod else if (unlikely (u == 0x25CC)) cat = OT_DOTTEDCIRCLE; 3433eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod else if (unlikely (u == 0x0A71)) cat = OT_SM; /* GURMUKHI ADDAK. More like consonant medial. like 0A75. */ 3443eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 3453eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod if (cat == OT_Repha) { 3463eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod /* There are two kinds of characters marked as Repha: 3473eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod * - The ones that are GenCat=Mn are already positioned visually, ie. after base. (eg. Khmer) 3483eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod * - The ones that are GenCat=Lo is encoded logically, ie. beginning of syllable. (eg. Malayalam) 3493eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod * 3503eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod * We recategorize the first kind to look like a Nukta and attached to the base directly. 3513eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod */ 3523eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod if (_hb_glyph_info_get_general_category (&info) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) 3533eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod cat = OT_N; 3543eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod } 3553eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 3563eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 3573eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 3583eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod /* 3593eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod * Re-assign position. 3603eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod */ 3613eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 3623eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod if ((FLAG (cat) & CONSONANT_FLAGS)) 3633eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod { 3643eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod pos = consonant_position (u); 3653eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod if (is_ra (u)) 3663eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod cat = OT_Ra; 3673eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod } 3683eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod else if (cat == OT_M) 3693eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod { 3703eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod pos = matra_position (u, pos); 3713eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod } 3723eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod else if (cat == OT_SM || cat == OT_VD) 3733eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod { 3743eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod pos = POS_SMVD; 3753eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod } 3763eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 3773eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod if (unlikely (u == 0x0B01)) pos = POS_BEFORE_SUB; /* Oriya Bindu is BeforeSub in the spec. */ 3783eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 3793eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 3803eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 3813eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod info.indic_category() = cat; 3823eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod info.indic_position() = pos; 3833eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod} 3843eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 3853eb6f81fd3f1e56679eec10d08f5e2303121753fBehdad Esfahbod 3863ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 3873ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod#endif /* HB_OT_SHAPE_COMPLEX_INDIC_PRIVATE_HH */ 388