hb-ot-shape-complex-private.hh revision eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4
149baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod/* 2cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod * Copyright © 2010,2011,2012 Google, Inc. 349baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * 449baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * This is part of HarfBuzz, a text shaping library. 549baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * 649baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * Permission is hereby granted, without written agreement and without 749baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * license or royalty fees, to use, copy, modify, and distribute this 849baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * software and its documentation for any purpose, provided that the 949baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * above copyright notice and the following two paragraphs appear in 1049baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * all copies of this software. 1149baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * 1249baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 1349baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 1449baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 1549baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 1649baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * DAMAGE. 1749baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * 1849baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 1949baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 2049baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 2149baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 2249baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 2349baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * 2449baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod * Google Author(s): Behdad Esfahbod 2549baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod */ 2649baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod 2749baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod#ifndef HB_OT_SHAPE_COMPLEX_PRIVATE_HH 2849baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod#define HB_OT_SHAPE_COMPLEX_PRIVATE_HH 2949baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod 30c57d454accff66e5f2c58006e8fb40bc020b6182Behdad Esfahbod#include "hb-private.hh" 3149baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod 3216c6a27b4bffc19026944c7bea9cf0a3a8ff1d8fBehdad Esfahbod#include "hb-ot-shape-private.hh" 3311138ccff71f442da1fcf64faa0e1d22e083e775Behdad Esfahbod#include "hb-ot-shape-normalize-private.hh" 3449baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod 3549baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod 3649baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod 37b65c06025d2b54a44f716e030d4b10072c65bea8Behdad Esfahbod/* buffer var allocations, used by complex shapers */ 38cd0c6e148f6d078b364370cb2f808b793b921be2Behdad Esfahbod#define complex_var_u8_0() var2.u8[2] 39cd0c6e148f6d078b364370cb2f808b793b921be2Behdad Esfahbod#define complex_var_u8_1() var2.u8[3] 40b65c06025d2b54a44f716e030d4b10072c65bea8Behdad Esfahbod 4176f76812ac7cca8ac6935952a2360d5e151480faBehdad Esfahbod 42693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod 43693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod/* Master OT shaper list */ 44d05dded1676924e8894c90f7a7c3527b492bcdffBehdad Esfahbod#define HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS \ 45d05dded1676924e8894c90f7a7c3527b492bcdffBehdad Esfahbod HB_COMPLEX_SHAPER_IMPLEMENT (default) /* should be first */ \ 46d05dded1676924e8894c90f7a7c3527b492bcdffBehdad Esfahbod HB_COMPLEX_SHAPER_IMPLEMENT (arabic) \ 47d05dded1676924e8894c90f7a7c3527b492bcdffBehdad Esfahbod HB_COMPLEX_SHAPER_IMPLEMENT (indic) \ 483b26f96ebe859570d14c6902afc23462bca40712Behdad Esfahbod HB_COMPLEX_SHAPER_IMPLEMENT (thai) \ 49d05dded1676924e8894c90f7a7c3527b492bcdffBehdad Esfahbod /* ^--- Add new shapers here */ 50d05dded1676924e8894c90f7a7c3527b492bcdffBehdad Esfahbod 51693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod 52693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbodstruct hb_ot_complex_shaper_t 53693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod{ 54693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod char name[8]; 55693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod 56693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod /* collect_features() 57693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod * Called during shape_plan(). 5816c6a27b4bffc19026944c7bea9cf0a3a8ff1d8fBehdad Esfahbod * Shapers should use plan->map to add their features and callbacks. 590736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod * May be NULL. 60693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod */ 6116c6a27b4bffc19026944c7bea9cf0a3a8ff1d8fBehdad Esfahbod void (*collect_features) (hb_ot_shape_planner_t *plan); 62693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod 63693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod /* override_features() 64693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod * Called during shape_plan(). 6516c6a27b4bffc19026944c7bea9cf0a3a8ff1d8fBehdad Esfahbod * Shapers should use plan->map to override features and add callbacks after 66693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod * common features are added. 670736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod * May be NULL. 68693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod */ 6916c6a27b4bffc19026944c7bea9cf0a3a8ff1d8fBehdad Esfahbod void (*override_features) (hb_ot_shape_planner_t *plan); 70693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod 71a8c6da90f4c6e8d27a3a1b758a55476776d9f750Behdad Esfahbod 72a8c6da90f4c6e8d27a3a1b758a55476776d9f750Behdad Esfahbod /* data_create() 73a8c6da90f4c6e8d27a3a1b758a55476776d9f750Behdad Esfahbod * Called at the end of shape_plan(). 74a8c6da90f4c6e8d27a3a1b758a55476776d9f750Behdad Esfahbod * Whatever shapers return will be accessible through plan->data later. 75a8c6da90f4c6e8d27a3a1b758a55476776d9f750Behdad Esfahbod * If NULL is returned, means a plan failure. 769f9f04c2229227bb0712166e824157bbbf5cef80Behdad Esfahbod */ 77a8c6da90f4c6e8d27a3a1b758a55476776d9f750Behdad Esfahbod void *(*data_create) (const hb_ot_shape_plan_t *plan); 78a8c6da90f4c6e8d27a3a1b758a55476776d9f750Behdad Esfahbod 79a8c6da90f4c6e8d27a3a1b758a55476776d9f750Behdad Esfahbod /* data_destroy() 80a8c6da90f4c6e8d27a3a1b758a55476776d9f750Behdad Esfahbod * Called when the shape_plan is being destroyed. 81a8c6da90f4c6e8d27a3a1b758a55476776d9f750Behdad Esfahbod * plan->data is passed here for destruction. 82a8c6da90f4c6e8d27a3a1b758a55476776d9f750Behdad Esfahbod * If NULL is returned, means a plan failure. 830736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod * May be NULL. 840736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod */ 85a8c6da90f4c6e8d27a3a1b758a55476776d9f750Behdad Esfahbod void (*data_destroy) (void *data); 86a8c6da90f4c6e8d27a3a1b758a55476776d9f750Behdad Esfahbod 879f9f04c2229227bb0712166e824157bbbf5cef80Behdad Esfahbod 889f9f04c2229227bb0712166e824157bbbf5cef80Behdad Esfahbod /* preprocess_text() 899f9f04c2229227bb0712166e824157bbbf5cef80Behdad Esfahbod * Called during shape(). 909f9f04c2229227bb0712166e824157bbbf5cef80Behdad Esfahbod * Shapers can use to modify text before shaping starts. 910736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod * May be NULL. 929f9f04c2229227bb0712166e824157bbbf5cef80Behdad Esfahbod */ 939f9f04c2229227bb0712166e824157bbbf5cef80Behdad Esfahbod void (*preprocess_text) (const hb_ot_shape_plan_t *plan, 949f9f04c2229227bb0712166e824157bbbf5cef80Behdad Esfahbod hb_buffer_t *buffer, 959f9f04c2229227bb0712166e824157bbbf5cef80Behdad Esfahbod hb_font_t *font); 969f9f04c2229227bb0712166e824157bbbf5cef80Behdad Esfahbod 979f9f04c2229227bb0712166e824157bbbf5cef80Behdad Esfahbod 98693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod /* normalization_preference() 9916c6a27b4bffc19026944c7bea9cf0a3a8ff1d8fBehdad Esfahbod * Called during shape(). 1000736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod * May be NULL. 101693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod */ 102693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod hb_ot_shape_normalization_mode_t 1030736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod (*normalization_preference) (const hb_segment_properties_t *props); 1040736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod 1050736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod /* decompose() 1060736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod * Called during shape()'s normalization. 1070736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod * May be NULL. 1080736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod */ 109eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahbod bool (*decompose) (const hb_ot_shape_normalize_context_t *c, 110eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahbod hb_codepoint_t ab, 111eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahbod hb_codepoint_t *a, 112eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahbod hb_codepoint_t *b); 1130736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod 1140736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod /* compose() 1150736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod * Called during shape()'s normalization. 1160736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod * May be NULL. 1170736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod */ 118eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahbod bool (*compose) (const hb_ot_shape_normalize_context_t *c, 119eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahbod hb_codepoint_t a, 120eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahbod hb_codepoint_t b, 121eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahbod hb_codepoint_t *ab); 122693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod 123693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod /* setup_masks() 12416c6a27b4bffc19026944c7bea9cf0a3a8ff1d8fBehdad Esfahbod * Called during shape(). 125693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod * Shapers should use map to get feature masks and set on buffer. 1269f9f04c2229227bb0712166e824157bbbf5cef80Behdad Esfahbod * Shapers may NOT modify characters. 1270736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod * May be NULL. 128693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod */ 12916c6a27b4bffc19026944c7bea9cf0a3a8ff1d8fBehdad Esfahbod void (*setup_masks) (const hb_ot_shape_plan_t *plan, 13016c6a27b4bffc19026944c7bea9cf0a3a8ff1d8fBehdad Esfahbod hb_buffer_t *buffer, 13116c6a27b4bffc19026944c7bea9cf0a3a8ff1d8fBehdad Esfahbod hb_font_t *font); 1322bc3b9a616cedbc56ff4a915f9e3439ff3a6bf13Behdad Esfahbod 1331e7d860613032e40a3f90e2caa2ee5ac44ab8c8cBehdad Esfahbod bool zero_width_attached_marks; 134865745b5b87236651f5663cae3461db9cb505eedBehdad Esfahbod bool fallback_position; 13576f76812ac7cca8ac6935952a2360d5e151480faBehdad Esfahbod}; 13676f76812ac7cca8ac6935952a2360d5e151480faBehdad Esfahbod 137693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod#define HB_COMPLEX_SHAPER_IMPLEMENT(name) extern HB_INTERNAL const hb_ot_complex_shaper_t _hb_ot_complex_shaper_##name; 138693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad EsfahbodHB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS 139693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod#undef HB_COMPLEX_SHAPER_IMPLEMENT 140693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod 141693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod 142693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbodstatic inline const hb_ot_complex_shaper_t * 1439b37b4c5800b158f61602d2aba8a01349e24d251Behdad Esfahbodhb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner) 14449baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod{ 1459b37b4c5800b158f61602d2aba8a01349e24d251Behdad Esfahbod switch ((hb_tag_t) planner->props.script) 14662879eebd9965179af8602ba29ac0a64a739b757Behdad Esfahbod { 147d05dded1676924e8894c90f7a7c3527b492bcdffBehdad Esfahbod default: 148693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod return &_hb_ot_complex_shaper_default; 149d05dded1676924e8894c90f7a7c3527b492bcdffBehdad Esfahbod 150c9a841f4452921c5361b8f5697bbff7736ce60cdBehdad Esfahbod 151317b9504d7a4faa70dcf21e5c2aff4792dbd201aBehdad Esfahbod /* Unicode-1.1 additions */ 15249baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod case HB_SCRIPT_ARABIC: 153d86a5b3c5752abcc791724035ba4115958e6b5e2Behdad Esfahbod case HB_SCRIPT_MONGOLIAN: 154b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod case HB_SCRIPT_SYRIAC: 155317b9504d7a4faa70dcf21e5c2aff4792dbd201aBehdad Esfahbod 156317b9504d7a4faa70dcf21e5c2aff4792dbd201aBehdad Esfahbod /* Unicode-5.0 additions */ 157317b9504d7a4faa70dcf21e5c2aff4792dbd201aBehdad Esfahbod case HB_SCRIPT_NKO: 1583ba7bc14ea652d27639f34109e51a497a678a54aBehdad Esfahbod case HB_SCRIPT_PHAGS_PA: 159317b9504d7a4faa70dcf21e5c2aff4792dbd201aBehdad Esfahbod 160317b9504d7a4faa70dcf21e5c2aff4792dbd201aBehdad Esfahbod /* Unicode-6.0 additions */ 161317b9504d7a4faa70dcf21e5c2aff4792dbd201aBehdad Esfahbod case HB_SCRIPT_MANDAIC: 162317b9504d7a4faa70dcf21e5c2aff4792dbd201aBehdad Esfahbod 1639e92978c8aa3d3cdab4d20c81698c56adbb3dbddBehdad Esfahbod /* For Arabic script, use the Arabic shaper even if no OT script tag was found. 1649e92978c8aa3d3cdab4d20c81698c56adbb3dbddBehdad Esfahbod * This is because we do fallback shaping for Arabic script (and not others). */ 1655ab3855f8106158ee7e68797e8c35e63e9216e5dBehdad Esfahbod if (planner->map.chosen_script[0] != HB_OT_TAG_DEFAULT_SCRIPT || 1665ab3855f8106158ee7e68797e8c35e63e9216e5dBehdad Esfahbod planner->props.script == HB_SCRIPT_ARABIC) 1675ab3855f8106158ee7e68797e8c35e63e9216e5dBehdad Esfahbod return &_hb_ot_complex_shaper_arabic; 1685ab3855f8106158ee7e68797e8c35e63e9216e5dBehdad Esfahbod else 1695ab3855f8106158ee7e68797e8c35e63e9216e5dBehdad Esfahbod return &_hb_ot_complex_shaper_default; 17049baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod 171c9a841f4452921c5361b8f5697bbff7736ce60cdBehdad Esfahbod 172c9a841f4452921c5361b8f5697bbff7736ce60cdBehdad Esfahbod /* Unicode-1.1 additions */ 1733b26f96ebe859570d14c6902afc23462bca40712Behdad Esfahbod case HB_SCRIPT_THAI: 1743b26f96ebe859570d14c6902afc23462bca40712Behdad Esfahbod case HB_SCRIPT_LAO: 1753b26f96ebe859570d14c6902afc23462bca40712Behdad Esfahbod 176693918ef8541014a5ef7dfb91c6ea0ae36d9c368Behdad Esfahbod return &_hb_ot_complex_shaper_thai; 1773b26f96ebe859570d14c6902afc23462bca40712Behdad Esfahbod 1783b26f96ebe859570d14c6902afc23462bca40712Behdad Esfahbod 179c9a841f4452921c5361b8f5697bbff7736ce60cdBehdad Esfahbod 180c9a841f4452921c5361b8f5697bbff7736ce60cdBehdad Esfahbod /* ^--- Add new shapers here */ 181c9a841f4452921c5361b8f5697bbff7736ce60cdBehdad Esfahbod 182c9a841f4452921c5361b8f5697bbff7736ce60cdBehdad Esfahbod 183bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod#if 0 184bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod /* Note: 185bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod * 186bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod * These disabled scripts are listed in ucd/IndicSyllabicCategory.txt, but according 187f91136cb528e298651c4a8a8a1d6dc54136e09ceBehdad Esfahbod * to Martin Hosken and Jonathan Kew do not require complex shaping. 188f91136cb528e298651c4a8a8a1d6dc54136e09ceBehdad Esfahbod * 189f91136cb528e298651c4a8a8a1d6dc54136e09ceBehdad Esfahbod * TODO We should automate figuring out which scripts do not need complex shaping 190bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod * 191bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod * TODO We currently keep data for these scripts in our indic table. Need to fix the 192bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod * generator to not do that. 193b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod */ 194bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod 195cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod 196bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod /* Simple? */ 197cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod 198cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod /* Unicode-3.2 additions */ 199183224684a45d7dcd7d28510d4383a7a7cb3dff3Behdad Esfahbod case HB_SCRIPT_BUHID: 200bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod case HB_SCRIPT_HANUNOO: 201cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod 202cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod /* Unicode-5.1 additions */ 203bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod case HB_SCRIPT_SAURASHTRA: 204bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod 205cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod /* Unicode-6.0 additions */ 206cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod case HB_SCRIPT_BATAK: 207cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod case HB_SCRIPT_BRAHMI: 208cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod 209cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod 210bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod /* Simple */ 211cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod 212cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod /* Unicode-1.1 additions */ 2135b1260909350bffa3e3d06da346f9f86ce651dbbBehdad Esfahbod /* These have their own shaper now. */ 214bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod case HB_SCRIPT_LAO: 215cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod case HB_SCRIPT_THAI: 216cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod 217cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod /* Unicode-2.0 additions */ 218cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod case HB_SCRIPT_TIBETAN: 219cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod 220cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod /* Unicode-3.2 additions */ 221bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod case HB_SCRIPT_TAGALOG: 222bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod case HB_SCRIPT_TAGBANWA: 223cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod 224cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod /* Unicode-4.0 additions */ 225cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod case HB_SCRIPT_LIMBU: 226bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod case HB_SCRIPT_TAI_LE: 227cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod 228cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod /* Unicode-4.1 additions */ 2290f80a89de99293ddbf0b8b815fe360677d057e38Behdad Esfahbod case HB_SCRIPT_KHAROSHTHI: 230cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod case HB_SCRIPT_SYLOTI_NAGRI: 231cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod 232cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod /* Unicode-5.1 additions */ 233cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod case HB_SCRIPT_KAYAH_LI: 234cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod 235cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod /* Unicode-5.2 additions */ 236bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod case HB_SCRIPT_TAI_VIET: 237cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod 238bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod 239bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod#endif 240bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod 241cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod /* Unicode-1.1 additions */ 242bc187e5ac7433f5561b0e97e8c62172c73883f3fBehdad Esfahbod case HB_SCRIPT_BENGALI: 243b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod case HB_SCRIPT_DEVANAGARI: 244b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod case HB_SCRIPT_GUJARATI: 245b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod case HB_SCRIPT_GURMUKHI: 246b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod case HB_SCRIPT_KANNADA: 247b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod case HB_SCRIPT_MALAYALAM: 2487a4a848db27d1605195f677c9c8632cde558aa05Behdad Esfahbod case HB_SCRIPT_ORIYA: 249cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod case HB_SCRIPT_TAMIL: 250cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod case HB_SCRIPT_TELUGU: 251cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod 252cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod /* Unicode-3.0 additions */ 253b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod case HB_SCRIPT_SINHALA: 254cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod 255cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod /* Unicode-4.1 additions */ 256cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod case HB_SCRIPT_BUGINESE: 257cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod case HB_SCRIPT_NEW_TAI_LUE: 258cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod 259cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod /* Unicode-5.0 additions */ 260cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod case HB_SCRIPT_BALINESE: 261cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod 262cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod /* Unicode-5.1 additions */ 263cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod case HB_SCRIPT_CHAM: 264cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod case HB_SCRIPT_LEPCHA: 265cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod case HB_SCRIPT_REJANG: 266b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod case HB_SCRIPT_SUNDANESE: 267cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod 268cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod /* Unicode-5.2 additions */ 269cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod case HB_SCRIPT_JAVANESE: 270cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod case HB_SCRIPT_KAITHI: 27143149afbc0007ea075a7017c0e56056c3c0f3614Behdad Esfahbod case HB_SCRIPT_MEETEI_MAYEK: 272b9ddbd55930228422e82b34a141ad1b6093f5376Behdad Esfahbod case HB_SCRIPT_TAI_THAM: 273cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod 27443149afbc0007ea075a7017c0e56056c3c0f3614Behdad Esfahbod 275cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod /* Unicode-6.1 additions */ 276cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod case HB_SCRIPT_CHAKMA: 277cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod case HB_SCRIPT_SHARADA: 278f91136cb528e298651c4a8a8a1d6dc54136e09ceBehdad Esfahbod case HB_SCRIPT_TAKRI: 279cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod 280981748cb2e9b48b77177b19ec1f972cab7afda89Behdad Esfahbod /* Only use Indic shaper if the font has Indic tables. */ 281851784f8372004e0a40b698c0cdc2d7db8629aa2Behdad Esfahbod if (planner->map.found_script[0]) 282981748cb2e9b48b77177b19ec1f972cab7afda89Behdad Esfahbod return &_hb_ot_complex_shaper_indic; 283851784f8372004e0a40b698c0cdc2d7db8629aa2Behdad Esfahbod else 284851784f8372004e0a40b698c0cdc2d7db8629aa2Behdad Esfahbod return &_hb_ot_complex_shaper_default; 285981748cb2e9b48b77177b19ec1f972cab7afda89Behdad Esfahbod 286981748cb2e9b48b77177b19ec1f972cab7afda89Behdad Esfahbod case HB_SCRIPT_KHMER: 287981748cb2e9b48b77177b19ec1f972cab7afda89Behdad Esfahbod /* If the font has 'liga', let the generic shaper do it. */ 288851784f8372004e0a40b698c0cdc2d7db8629aa2Behdad Esfahbod if (!planner->map.found_script[0] || 289851784f8372004e0a40b698c0cdc2d7db8629aa2Behdad Esfahbod hb_ot_layout_language_find_feature (planner->face, HB_OT_TAG_GSUB, 290851784f8372004e0a40b698c0cdc2d7db8629aa2Behdad Esfahbod planner->map.script_index[0], 291851784f8372004e0a40b698c0cdc2d7db8629aa2Behdad Esfahbod planner->map.language_index[0], 292851784f8372004e0a40b698c0cdc2d7db8629aa2Behdad Esfahbod HB_TAG ('l','i','g','a'), NULL)) 293981748cb2e9b48b77177b19ec1f972cab7afda89Behdad Esfahbod return &_hb_ot_complex_shaper_default; 294981748cb2e9b48b77177b19ec1f972cab7afda89Behdad Esfahbod else 295981748cb2e9b48b77177b19ec1f972cab7afda89Behdad Esfahbod return &_hb_ot_complex_shaper_indic; 296981748cb2e9b48b77177b19ec1f972cab7afda89Behdad Esfahbod 297981748cb2e9b48b77177b19ec1f972cab7afda89Behdad Esfahbod 298981748cb2e9b48b77177b19ec1f972cab7afda89Behdad Esfahbod case HB_SCRIPT_MYANMAR: 2999e92978c8aa3d3cdab4d20c81698c56adbb3dbddBehdad Esfahbod /* For Myanmar, we only want to use the Indic shaper if the "new" script 3009e92978c8aa3d3cdab4d20c81698c56adbb3dbddBehdad Esfahbod * tag is found. For "old" script tag we want to use the default shaper. */ 301981748cb2e9b48b77177b19ec1f972cab7afda89Behdad Esfahbod if (planner->map.chosen_script[0] == HB_TAG ('m','y','m','2')) 3025ab3855f8106158ee7e68797e8c35e63e9216e5dBehdad Esfahbod return &_hb_ot_complex_shaper_indic; 3035ab3855f8106158ee7e68797e8c35e63e9216e5dBehdad Esfahbod else 3045ab3855f8106158ee7e68797e8c35e63e9216e5dBehdad Esfahbod return &_hb_ot_complex_shaper_default; 30502cdf743c2ec345a44d4fcf865594b6ac13fccd0Behdad Esfahbod } 30602cdf743c2ec345a44d4fcf865594b6ac13fccd0Behdad Esfahbod} 30702cdf743c2ec345a44d4fcf865594b6ac13fccd0Behdad Esfahbod 30802cdf743c2ec345a44d4fcf865594b6ac13fccd0Behdad Esfahbod 30949baa1f69efb0e3c62e45bd59dd88459a84bf390Behdad Esfahbod#endif /* HB_OT_SHAPE_COMPLEX_PRIVATE_HH */ 310