2 * Copyright © 2010,2011 Google, Inc.
4 * This is part of HarfBuzz, a text shaping library.
6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software.
12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24 * Google Author(s): Behdad Esfahbod
27 #ifndef HB_OT_SHAPE_COMPLEX_PRIVATE_HH
28 #define HB_OT_SHAPE_COMPLEX_PRIVATE_HH
30 #include "hb-private.hh"
32 #include "hb-ot-shape-private.hh"
37 static inline hb_ot_complex_shaper_t
38 hb_ot_shape_complex_categorize (const hb_segment_properties_t *props)
40 switch ((int) props->script)
42 case HB_SCRIPT_ARABIC:
43 case HB_SCRIPT_MANDAIC:
44 case HB_SCRIPT_MONGOLIAN:
46 case HB_SCRIPT_SYRIAC:
47 return hb_ot_complex_shaper_arabic;
49 /* TODO: These are all the scripts that the ucd/IndicSyllabicCategory.txt covers.
50 * Quite possibly many of these need no shaping, and some other are encoded visually.
51 * Needs to be refined.
53 case HB_SCRIPT_BALINESE:
55 case HB_SCRIPT_BENGALI:
56 case HB_SCRIPT_BRAHMI:
57 case HB_SCRIPT_BUGINESE:
60 case HB_SCRIPT_DEVANAGARI:
61 case HB_SCRIPT_GUJARATI:
62 case HB_SCRIPT_GURMUKHI:
63 case HB_SCRIPT_HANUNOO:
64 case HB_SCRIPT_JAVANESE:
65 case HB_SCRIPT_KAITHI:
66 case HB_SCRIPT_KANNADA:
67 case HB_SCRIPT_KAYAH_LI:
68 case HB_SCRIPT_KHAROSHTHI:
71 case HB_SCRIPT_LEPCHA:
73 case HB_SCRIPT_MALAYALAM:
74 case HB_SCRIPT_MEETEI_MAYEK:
75 case HB_SCRIPT_MYANMAR:
76 case HB_SCRIPT_NEW_TAI_LUE:
78 case HB_SCRIPT_PHAGS_PA:
79 case HB_SCRIPT_REJANG:
80 case HB_SCRIPT_SAURASHTRA:
81 case HB_SCRIPT_SINHALA:
82 case HB_SCRIPT_SUNDANESE:
83 case HB_SCRIPT_SYLOTI_NAGRI:
84 case HB_SCRIPT_TAGALOG:
85 case HB_SCRIPT_TAGBANWA:
86 case HB_SCRIPT_TAI_LE:
87 case HB_SCRIPT_TAI_THAM:
88 case HB_SCRIPT_TAI_VIET:
90 case HB_SCRIPT_TELUGU:
92 case HB_SCRIPT_TIBETAN:
93 return hb_ot_complex_shaper_indic;
96 return hb_ot_complex_shaper_none;
105 * Called during shape_plan().
107 * Shapers should use plan->map to add their features.
110 HB_INTERNAL void _hb_ot_shape_complex_collect_features_arabic (hb_ot_shape_planner_t *plan, const hb_segment_properties_t *props);
111 HB_INTERNAL void _hb_ot_shape_complex_collect_features_indic (hb_ot_shape_planner_t *plan, const hb_segment_properties_t *props);
114 hb_ot_shape_complex_collect_features (hb_ot_shape_planner_t *planner,
115 const hb_segment_properties_t *props)
117 switch (planner->shaper) {
118 case hb_ot_complex_shaper_arabic: _hb_ot_shape_complex_collect_features_arabic (planner, props); return;
119 case hb_ot_complex_shaper_indic: _hb_ot_shape_complex_collect_features_indic (planner, props); return;
120 case hb_ot_complex_shaper_none: default: return;
127 * Called during shape_execute().
129 * Shapers should use c->plan.map to get feature masks and set on buffer.
132 HB_INTERNAL void _hb_ot_shape_complex_setup_masks_arabic (hb_ot_shape_context_t *c);
133 HB_INTERNAL void _hb_ot_shape_complex_setup_masks_indic (hb_ot_shape_context_t *c);
136 hb_ot_shape_complex_setup_masks (hb_ot_shape_context_t *c)
138 switch (c->plan->shaper) {
139 case hb_ot_complex_shaper_arabic: _hb_ot_shape_complex_setup_masks_arabic (c); return;
140 case hb_ot_complex_shaper_indic: _hb_ot_shape_complex_setup_masks_indic (c); return;
141 case hb_ot_complex_shaper_none: default: return;
148 #endif /* HB_OT_SHAPE_COMPLEX_PRIVATE_HH */