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-map-private.hh"
37 /* buffer var allocations, used by all shapers */
38 #define general_category() var1.u8[0] /* unicode general_category (hb_unicode_general_category_t) */
39 #define combining_class() var1.u8[1] /* unicode combining_class (uint8_t) */
42 enum hb_ot_complex_shaper_t {
43 hb_ot_complex_shaper_default,
44 hb_ot_complex_shaper_arabic,
45 hb_ot_complex_shaper_indic
48 static inline hb_ot_complex_shaper_t
49 hb_ot_shape_complex_categorize (const hb_segment_properties_t *props)
51 switch ((int) props->script)
53 case HB_SCRIPT_ARABIC:
54 case HB_SCRIPT_MANDAIC:
55 case HB_SCRIPT_MONGOLIAN:
57 case HB_SCRIPT_SYRIAC:
58 return hb_ot_complex_shaper_arabic;
60 /* TODO: These are all the scripts that the ucd/IndicSyllabicCategory.txt covers.
61 * Quite possibly many of these need no shaping, and some other are encoded visually.
62 * Needs to be refined.
64 case HB_SCRIPT_BALINESE:
66 case HB_SCRIPT_BENGALI:
67 case HB_SCRIPT_BRAHMI:
68 case HB_SCRIPT_BUGINESE:
71 case HB_SCRIPT_DEVANAGARI:
72 case HB_SCRIPT_GUJARATI:
73 case HB_SCRIPT_GURMUKHI:
74 case HB_SCRIPT_HANUNOO:
75 case HB_SCRIPT_JAVANESE:
76 case HB_SCRIPT_KAITHI:
77 case HB_SCRIPT_KANNADA:
78 case HB_SCRIPT_KAYAH_LI:
79 case HB_SCRIPT_KHAROSHTHI:
82 case HB_SCRIPT_LEPCHA:
84 case HB_SCRIPT_MALAYALAM:
85 case HB_SCRIPT_MEETEI_MAYEK:
86 case HB_SCRIPT_MYANMAR:
87 case HB_SCRIPT_NEW_TAI_LUE:
89 case HB_SCRIPT_PHAGS_PA:
90 case HB_SCRIPT_REJANG:
91 case HB_SCRIPT_SAURASHTRA:
92 case HB_SCRIPT_SINHALA:
93 case HB_SCRIPT_SUNDANESE:
94 case HB_SCRIPT_SYLOTI_NAGRI:
95 case HB_SCRIPT_TAGALOG:
96 case HB_SCRIPT_TAGBANWA:
97 case HB_SCRIPT_TAI_LE:
98 case HB_SCRIPT_TAI_THAM:
99 case HB_SCRIPT_TAI_VIET:
100 case HB_SCRIPT_TAMIL:
101 case HB_SCRIPT_TELUGU:
103 case HB_SCRIPT_TIBETAN:
104 return hb_ot_complex_shaper_indic;
107 return hb_ot_complex_shaper_default;
116 * Called during shape_plan().
118 * Shapers should use map to add their features and callbacks.
121 typedef void hb_ot_shape_complex_collect_features_func_t (hb_ot_map_builder_t *map, const hb_segment_properties_t *props);
122 HB_INTERNAL hb_ot_shape_complex_collect_features_func_t _hb_ot_shape_complex_collect_features_default;
123 HB_INTERNAL hb_ot_shape_complex_collect_features_func_t _hb_ot_shape_complex_collect_features_arabic;
124 HB_INTERNAL hb_ot_shape_complex_collect_features_func_t _hb_ot_shape_complex_collect_features_indic;
127 hb_ot_shape_complex_collect_features (hb_ot_complex_shaper_t shaper,
128 hb_ot_map_builder_t *map,
129 const hb_segment_properties_t *props)
133 case hb_ot_complex_shaper_default: _hb_ot_shape_complex_collect_features_default (map, props); return;
134 case hb_ot_complex_shaper_arabic: _hb_ot_shape_complex_collect_features_arabic (map, props); return;
135 case hb_ot_complex_shaper_indic: _hb_ot_shape_complex_collect_features_indic (map, props); return;
142 * Called during shape_execute().
144 * Shapers should use map to get feature masks and set on buffer.
147 typedef void hb_ot_shape_complex_setup_masks_func_t (hb_ot_map_t *map, hb_buffer_t *buffer);
148 HB_INTERNAL hb_ot_shape_complex_setup_masks_func_t _hb_ot_shape_complex_setup_masks_default;
149 HB_INTERNAL hb_ot_shape_complex_setup_masks_func_t _hb_ot_shape_complex_setup_masks_arabic;
150 HB_INTERNAL hb_ot_shape_complex_setup_masks_func_t _hb_ot_shape_complex_setup_masks_indic;
153 hb_ot_shape_complex_setup_masks (hb_ot_complex_shaper_t shaper,
159 case hb_ot_complex_shaper_default: _hb_ot_shape_complex_setup_masks_default(map, buffer); return;
160 case hb_ot_complex_shaper_arabic: _hb_ot_shape_complex_setup_masks_arabic (map, buffer); return;
161 case hb_ot_complex_shaper_indic: _hb_ot_shape_complex_setup_masks_indic (map, buffer); return;
168 #endif /* HB_OT_SHAPE_COMPLEX_PRIVATE_HH */