hb-ot-shape-complex-indic-private.hh revision 3a83d33ec0b1be6f5992816ff5ebb0f43c8dff00
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 37dba186711e3f5e723f917b7104e849c4c525d3b8Behdad Esfahbod#define INDIC_TABLE_ELEMENT_TYPE uint16_t 383ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 393ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod/* Cateories used in the OpenType spec: 403ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * https://www.microsoft.com/typography/otfntdev/devanot/shaping.aspx 413ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod */ 423ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod/* Note: This enum is duplicated in the -machine.rl source file. 433ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * Not sure how to avoid duplication. */ 443ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbodenum indic_category_t { 453ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_X = 0, 463ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_C, 473ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_V, 483ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_N, 493ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_H, 503ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_ZWNJ, 513ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_ZWJ, 523ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_M, 533ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_SM, 543ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_VD, 553ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod OT_A, 5618c06e189bd078affbb84c3bb5bb80687a227c5eBehdad Esfahbod OT_NBSP, 577d09c98a1fff97127e48eae48d380dc9fcff288eBehdad Esfahbod OT_DOTTEDCIRCLE, /* Not in the spec, but special in Uniscribe. /Very very/ special! */ 5825bc489498ef7d0beb8fe9ab663e3f0b2f52c9c2Behdad Esfahbod OT_RS, /* Register Shifter, used in Khmer OT spec */ 59db8981f1e0e8625714568c6d0f11f0b317b11d0aBehdad Esfahbod OT_Coeng, 60db8981f1e0e8625714568c6d0f11f0b317b11d0aBehdad Esfahbod OT_Repha, 619cac1338c4bc3e9034cbfa104291ed0329debefeBehdad Esfahbod OT_Ra, /* Not explicitly listed in the OT spec, but used in the grammar. */ 629cac1338c4bc3e9034cbfa104291ed0329debefeBehdad Esfahbod OT_CM 633ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod}; 643ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 653ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod/* Visual positions in a syllable from left to right. */ 663ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbodenum indic_position_t { 6781202bd860e4034c18d9f80c5a4f33d9f48463a3Behdad Esfahbod POS_START, 6881202bd860e4034c18d9f80c5a4f33d9f48463a3Behdad Esfahbod 693d25079f8d6be81b9b4b91d3a97016b8a572f571Behdad Esfahbod POS_RA_TO_BECOME_REPH, 706a091df9b403b147ef78f3974610dedf4ce1e08aBehdad Esfahbod POS_PRE_M, 71dbccf87eef0d26838fa4bb3ae26410f6c4818836Behdad Esfahbod POS_PRE_C, 72be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod 73dbccf87eef0d26838fa4bb3ae26410f6c4818836Behdad Esfahbod POS_BASE_C, 74be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod POS_AFTER_MAIN, 75be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod 76dbccf87eef0d26838fa4bb3ae26410f6c4818836Behdad Esfahbod POS_ABOVE_C, 77be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod 78be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod POS_BEFORE_SUB, 79dbccf87eef0d26838fa4bb3ae26410f6c4818836Behdad Esfahbod POS_BELOW_C, 80be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod POS_AFTER_SUB, 81be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod 82be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod POS_BEFORE_POST, 83dbccf87eef0d26838fa4bb3ae26410f6c4818836Behdad Esfahbod POS_POST_C, 84be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod POS_AFTER_POST, 85be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod 8655f70ebfb95083f515d9b0044a2a65ab11484bb5Behdad Esfahbod POS_FINAL_C, 87be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod POS_SMVD, 8881202bd860e4034c18d9f80c5a4f33d9f48463a3Behdad Esfahbod 89be8b9f5f715f6fb36b98bd33c3303f79cc068f8aBehdad Esfahbod POS_END 903ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod}; 913ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 92c5306b6861cfaa50af40e8ceb058791fa06d7981Behdad Esfahbod/* Categories used in IndicSyllabicCategory.txt from UCD. */ 933ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbodenum indic_syllabic_category_t { 943ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_OTHER = OT_X, 953ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 963ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_AVAGRAHA = OT_X, 973ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_BINDU = OT_SM, 983ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_CONSONANT = OT_C, 993ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_CONSONANT_DEAD = OT_C, 1003ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_CONSONANT_FINAL = OT_C, 1013ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_CONSONANT_HEAD_LETTER = OT_C, 1029cac1338c4bc3e9034cbfa104291ed0329debefeBehdad Esfahbod INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL = OT_CM, 1033ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_CONSONANT_PLACEHOLDER = OT_NBSP, 1043ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED = OT_C, 105db8981f1e0e8625714568c6d0f11f0b317b11d0aBehdad Esfahbod INDIC_SYLLABIC_CATEGORY_CONSONANT_REPHA = OT_Repha, 1063ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_MODIFYING_LETTER = OT_X, 1073ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_NUKTA = OT_N, 1087d09c98a1fff97127e48eae48d380dc9fcff288eBehdad Esfahbod INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER = OT_RS, 1093ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_TONE_LETTER = OT_X, 110d187099cbab8e75f870a2bc9c23b6a1cf226905eBehdad Esfahbod INDIC_SYLLABIC_CATEGORY_TONE_MARK = OT_N, 1113ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_VIRAMA = OT_H, 1123ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_VISARGA = OT_SM, 1133ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_VOWEL = OT_V, 1143ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT = OT_M, 1153ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_SYLLABIC_CATEGORY_VOWEL_INDEPENDENT = OT_V 1163ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod}; 1173ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 1183ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod/* Categories used in IndicSMatraCategory.txt from UCD */ 1193ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbodenum indic_matra_category_t { 1202ec934c6c25423e7af20d909a9c698a149808ea9Behdad Esfahbod INDIC_MATRA_CATEGORY_NOT_APPLICABLE = POS_END, 1213ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 1228bb32458f95f13f66688e0811cc91f1bfffb867dBehdad Esfahbod INDIC_MATRA_CATEGORY_LEFT = POS_PRE_C, 1238bb32458f95f13f66688e0811cc91f1bfffb867dBehdad Esfahbod INDIC_MATRA_CATEGORY_TOP = POS_ABOVE_C, 1248bb32458f95f13f66688e0811cc91f1bfffb867dBehdad Esfahbod INDIC_MATRA_CATEGORY_BOTTOM = POS_BELOW_C, 1258bb32458f95f13f66688e0811cc91f1bfffb867dBehdad Esfahbod INDIC_MATRA_CATEGORY_RIGHT = POS_POST_C, 1263ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 127f83aaa3133de5d807be267a100d6a200e8db9017Behdad Esfahbod /* These should resolve to the position of the last part of the split sequence. */ 128f83aaa3133de5d807be267a100d6a200e8db9017Behdad Esfahbod INDIC_MATRA_CATEGORY_BOTTOM_AND_RIGHT = INDIC_MATRA_CATEGORY_RIGHT, 129f83aaa3133de5d807be267a100d6a200e8db9017Behdad Esfahbod INDIC_MATRA_CATEGORY_LEFT_AND_RIGHT = INDIC_MATRA_CATEGORY_RIGHT, 130f83aaa3133de5d807be267a100d6a200e8db9017Behdad Esfahbod INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM = INDIC_MATRA_CATEGORY_BOTTOM, 131f83aaa3133de5d807be267a100d6a200e8db9017Behdad Esfahbod INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM_AND_RIGHT = INDIC_MATRA_CATEGORY_RIGHT, 132f83aaa3133de5d807be267a100d6a200e8db9017Behdad Esfahbod INDIC_MATRA_CATEGORY_TOP_AND_LEFT = INDIC_MATRA_CATEGORY_TOP, 133f83aaa3133de5d807be267a100d6a200e8db9017Behdad Esfahbod INDIC_MATRA_CATEGORY_TOP_AND_LEFT_AND_RIGHT = INDIC_MATRA_CATEGORY_RIGHT, 134f83aaa3133de5d807be267a100d6a200e8db9017Behdad Esfahbod INDIC_MATRA_CATEGORY_TOP_AND_RIGHT = INDIC_MATRA_CATEGORY_RIGHT, 1353ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 1363ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod INDIC_MATRA_CATEGORY_INVISIBLE = INDIC_MATRA_CATEGORY_NOT_APPLICABLE, 137e67072bb179a5c17db04075de74215597fb43c82Behdad Esfahbod INDIC_MATRA_CATEGORY_OVERSTRUCK = POS_AFTER_MAIN, 138e67072bb179a5c17db04075de74215597fb43c82Behdad Esfahbod INDIC_MATRA_CATEGORY_VISUAL_ORDER_LEFT = POS_PRE_M 1393ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod}; 1403ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 1413ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod/* Note: We use ASSERT_STATIC_EXPR_ZERO() instead of ASSERT_STATIC_EXPR() and the comma operation 1423ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod * because gcc fails to optimize the latter and fills the table in at runtime. */ 1433ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod#define INDIC_COMBINE_CATEGORIES(S,M) \ 1443ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod (ASSERT_STATIC_EXPR_ZERO (M == INDIC_MATRA_CATEGORY_NOT_APPLICABLE || (S == INDIC_SYLLABIC_CATEGORY_VIRAMA || S == INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT)) + \ 145dba186711e3f5e723f917b7104e849c4c525d3b8Behdad Esfahbod ASSERT_STATIC_EXPR_ZERO (S < 255 && M < 255) + \ 146dba186711e3f5e723f917b7104e849c4c525d3b8Behdad Esfahbod ((M << 8) | S)) 1473ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 1483a83d33ec0b1be6f5992816ff5ebb0f43c8dff00Behdad EsfahbodHB_INTERNAL INDIC_TABLE_ELEMENT_TYPE 1493a83d33ec0b1be6f5992816ff5ebb0f43c8dff00Behdad Esfahbodhb_indic_get_categories (hb_codepoint_t u); 1503ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod 1513ed4634ec349fa9e943ad23718c04be4dd4bba62Behdad Esfahbod#endif /* HB_OT_SHAPE_COMPLEX_INDIC_PRIVATE_HH */ 152