blob: 2691622135ac640dc09d8a6cc12cd4214b8627b9 [file] [log] [blame]
Behdad Esfahbod49baa1f2010-10-12 16:50:36 -04001/*
Behdad Esfahbodcad38212012-03-07 17:13:25 -05002 * Copyright © 2010,2011,2012 Google, Inc.
Behdad Esfahbod49baa1f2010-10-12 16:50:36 -04003 *
4 * This is part of HarfBuzz, a text shaping library.
5 *
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.
11 *
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
16 * DAMAGE.
17 *
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.
23 *
24 * Google Author(s): Behdad Esfahbod
25 */
26
Behdad Esfahbodc77ae402018-08-25 22:36:36 -070027#ifndef HB_OT_SHAPE_COMPLEX_HH
28#define HB_OT_SHAPE_COMPLEX_HH
Behdad Esfahbod49baa1f2010-10-12 16:50:36 -040029
Behdad Esfahbodc77ae402018-08-25 22:36:36 -070030#include "hb.hh"
Behdad Esfahbod49baa1f2010-10-12 16:50:36 -040031
Behdad Esfahbod10b6c7c2018-10-02 13:11:18 +020032#include "hb-ot-layout.hh"
Behdad Esfahbodc77ae402018-08-25 22:36:36 -070033#include "hb-ot-shape.hh"
34#include "hb-ot-shape-normalize.hh"
Behdad Esfahbod49baa1f2010-10-12 16:50:36 -040035
Behdad Esfahbod49baa1f2010-10-12 16:50:36 -040036
Behdad Esfahbodb65c0602011-07-28 16:48:43 -040037/* buffer var allocations, used by complex shapers */
Behdad Esfahbodcd0c6e12012-08-09 21:48:55 -040038#define complex_var_u8_0() var2.u8[2]
39#define complex_var_u8_1() var2.u8[3]
Behdad Esfahbodb65c0602011-07-28 16:48:43 -040040
Behdad Esfahbod76f76812011-07-07 22:25:25 -040041
Behdad Esfahbodab8d70e2017-10-04 14:47:10 +020042#define HB_OT_SHAPE_COMPLEX_MAX_COMBINING_MARKS 32
43
Behdad Esfahbod71b4c992013-10-28 00:20:59 +010044enum hb_ot_shape_zero_width_marks_type_t {
Behdad Esfahbod56800022013-02-12 09:44:57 -050045 HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
Behdad Esfahbod127daf12013-05-20 09:11:35 -040046 HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
Behdad Esfahbodfc06cff2015-12-17 17:47:35 +000047 HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE
Behdad Esfahbod56800022013-02-12 09:44:57 -050048};
49
Behdad Esfahbod693918e2012-07-30 21:08:51 -040050
51/* Master OT shaper list */
Behdad Esfahbodd05dded2011-07-07 23:42:40 -040052#define HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS \
53 HB_COMPLEX_SHAPER_IMPLEMENT (default) /* should be first */ \
54 HB_COMPLEX_SHAPER_IMPLEMENT (arabic) \
Behdad Esfahbodc98b7182013-12-31 15:55:40 +080055 HB_COMPLEX_SHAPER_IMPLEMENT (hangul) \
Behdad Esfahbodf14bb7d2013-12-31 16:49:15 +080056 HB_COMPLEX_SHAPER_IMPLEMENT (hebrew) \
Behdad Esfahbodd05dded2011-07-07 23:42:40 -040057 HB_COMPLEX_SHAPER_IMPLEMENT (indic) \
Behdad Esfahboddcf4d952018-01-05 14:54:31 +000058 HB_COMPLEX_SHAPER_IMPLEMENT (khmer) \
Behdad Esfahbod98628ca2013-02-11 13:36:23 -050059 HB_COMPLEX_SHAPER_IMPLEMENT (myanmar) \
Behdad Esfahbodbdb53ca2018-10-11 20:20:00 -040060 HB_COMPLEX_SHAPER_IMPLEMENT (myanmar_zawgyi) \
Behdad Esfahbod3b26f962012-04-10 10:52:07 -040061 HB_COMPLEX_SHAPER_IMPLEMENT (thai) \
Behdad Esfahbod52a95772015-07-21 10:02:04 +010062 HB_COMPLEX_SHAPER_IMPLEMENT (use) \
Behdad Esfahbodd05dded2011-07-07 23:42:40 -040063 /* ^--- Add new shapers here */
64
Behdad Esfahbod693918e2012-07-30 21:08:51 -040065
66struct hb_ot_complex_shaper_t
67{
Behdad Esfahbod693918e2012-07-30 21:08:51 -040068 /* collect_features()
69 * Called during shape_plan().
Behdad Esfahbod16c6a272012-08-02 09:38:28 -040070 * Shapers should use plan->map to add their features and callbacks.
Ebrahim Byagowi63109432018-10-13 14:00:05 +033071 * May be NULL.
Behdad Esfahbod693918e2012-07-30 21:08:51 -040072 */
Behdad Esfahbod16c6a272012-08-02 09:38:28 -040073 void (*collect_features) (hb_ot_shape_planner_t *plan);
Behdad Esfahbod693918e2012-07-30 21:08:51 -040074
75 /* override_features()
76 * Called during shape_plan().
Behdad Esfahbod16c6a272012-08-02 09:38:28 -040077 * Shapers should use plan->map to override features and add callbacks after
Behdad Esfahbod693918e2012-07-30 21:08:51 -040078 * common features are added.
Ebrahim Byagowi63109432018-10-13 14:00:05 +033079 * May be NULL.
Behdad Esfahbod693918e2012-07-30 21:08:51 -040080 */
Behdad Esfahbod16c6a272012-08-02 09:38:28 -040081 void (*override_features) (hb_ot_shape_planner_t *plan);
Behdad Esfahbod693918e2012-07-30 21:08:51 -040082
Behdad Esfahboda8c6da92012-08-02 10:46:34 -040083
84 /* data_create()
85 * Called at the end of shape_plan().
86 * Whatever shapers return will be accessible through plan->data later.
Behdad Esfahboddbdbfe32017-10-15 12:11:08 +020087 * If nullptr is returned, means a plan failure.
Behdad Esfahbod9f9f04c2012-08-11 18:34:13 -040088 */
Behdad Esfahboda8c6da92012-08-02 10:46:34 -040089 void *(*data_create) (const hb_ot_shape_plan_t *plan);
90
91 /* data_destroy()
92 * Called when the shape_plan is being destroyed.
93 * plan->data is passed here for destruction.
Behdad Esfahboddbdbfe32017-10-15 12:11:08 +020094 * If nullptr is returned, means a plan failure.
Ebrahim Byagowi63109432018-10-13 14:00:05 +033095 * May be NULL.
Behdad Esfahbod07369152012-11-13 12:35:35 -080096 */
Behdad Esfahboda8c6da92012-08-02 10:46:34 -040097 void (*data_destroy) (void *data);
98
Behdad Esfahbod9f9f04c2012-08-11 18:34:13 -040099
100 /* preprocess_text()
101 * Called during shape().
102 * Shapers can use to modify text before shaping starts.
Ebrahim Byagowi63109432018-10-13 14:00:05 +0330103 * May be NULL.
Behdad Esfahbod9f9f04c2012-08-11 18:34:13 -0400104 */
105 void (*preprocess_text) (const hb_ot_shape_plan_t *plan,
106 hb_buffer_t *buffer,
107 hb_font_t *font);
108
Behdad Esfahbod13686332015-11-05 13:24:15 -0800109 /* postprocess_glyphs()
110 * Called during shape().
111 * Shapers can use to modify glyphs after shaping ends.
Ebrahim Byagowi63109432018-10-13 14:00:05 +0330112 * May be NULL.
Behdad Esfahbod13686332015-11-05 13:24:15 -0800113 */
114 void (*postprocess_glyphs) (const hb_ot_shape_plan_t *plan,
115 hb_buffer_t *buffer,
116 hb_font_t *font);
117
Behdad Esfahbod9f9f04c2012-08-11 18:34:13 -0400118
Behdad Esfahbod3d6ca0d2013-12-31 16:04:35 +0800119 hb_ot_shape_normalization_mode_t normalization_preference;
Behdad Esfahbod07369152012-11-13 12:35:35 -0800120
121 /* decompose()
122 * Called during shape()'s normalization.
Ebrahim Byagowi63109432018-10-13 14:00:05 +0330123 * May be NULL.
Behdad Esfahbod07369152012-11-13 12:35:35 -0800124 */
Behdad Esfahbodeba312c2012-11-16 12:39:23 -0800125 bool (*decompose) (const hb_ot_shape_normalize_context_t *c,
126 hb_codepoint_t ab,
127 hb_codepoint_t *a,
128 hb_codepoint_t *b);
Behdad Esfahbod07369152012-11-13 12:35:35 -0800129
130 /* compose()
131 * Called during shape()'s normalization.
Ebrahim Byagowi63109432018-10-13 14:00:05 +0330132 * May be NULL.
Behdad Esfahbod07369152012-11-13 12:35:35 -0800133 */
Behdad Esfahbodeba312c2012-11-16 12:39:23 -0800134 bool (*compose) (const hb_ot_shape_normalize_context_t *c,
135 hb_codepoint_t a,
136 hb_codepoint_t b,
137 hb_codepoint_t *ab);
Behdad Esfahbod693918e2012-07-30 21:08:51 -0400138
Behdad Esfahbod693918e2012-07-30 21:08:51 -0400139 /* setup_masks()
Behdad Esfahbod16c6a272012-08-02 09:38:28 -0400140 * Called during shape().
Behdad Esfahbod693918e2012-07-30 21:08:51 -0400141 * Shapers should use map to get feature masks and set on buffer.
Behdad Esfahbod9f9f04c2012-08-11 18:34:13 -0400142 * Shapers may NOT modify characters.
Ebrahim Byagowi63109432018-10-13 14:00:05 +0330143 * May be NULL.
Behdad Esfahbod693918e2012-07-30 21:08:51 -0400144 */
Behdad Esfahbod16c6a272012-08-02 09:38:28 -0400145 void (*setup_masks) (const hb_ot_shape_plan_t *plan,
146 hb_buffer_t *buffer,
147 hb_font_t *font);
Behdad Esfahbod2bc3b9a2012-07-31 23:08:25 -0400148
Behdad Esfahbod48c513f2018-10-02 14:17:42 +0200149 /* gpos_tag()
150 * If not HB_TAG_NONE, then must match found GPOS script tag for
151 * GPOS to be applied. Otherwise, fallback positioning will be used.
Behdad Esfahbode2b87802016-12-22 14:40:19 -0600152 */
Behdad Esfahbod48c513f2018-10-02 14:17:42 +0200153 hb_tag_t gpos_tag;
Behdad Esfahbode2b87802016-12-22 14:40:19 -0600154
Behdad Esfahbodab8d70e2017-10-04 14:47:10 +0200155 /* reorder_marks()
156 * Called during shape().
157 * Shapers can use to modify ordering of combining marks.
Ebrahim Byagowi63109432018-10-13 14:00:05 +0330158 * May be NULL.
Behdad Esfahbodab8d70e2017-10-04 14:47:10 +0200159 */
160 void (*reorder_marks) (const hb_ot_shape_plan_t *plan,
161 hb_buffer_t *buffer,
162 unsigned int start,
163 unsigned int end);
164
Behdad Esfahbod71b4c992013-10-28 00:20:59 +0100165 hb_ot_shape_zero_width_marks_type_t zero_width_marks;
Behdad Esfahbod56800022013-02-12 09:44:57 -0500166
Behdad Esfahbod865745b2012-11-14 13:48:26 -0800167 bool fallback_position;
Behdad Esfahbod76f76812011-07-07 22:25:25 -0400168};
169
Behdad Esfahbod693918e2012-07-30 21:08:51 -0400170#define HB_COMPLEX_SHAPER_IMPLEMENT(name) extern HB_INTERNAL const hb_ot_complex_shaper_t _hb_ot_complex_shaper_##name;
171HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
172#undef HB_COMPLEX_SHAPER_IMPLEMENT
173
174
175static inline const hb_ot_complex_shaper_t *
Behdad Esfahbod9b37b4c2012-11-12 18:23:38 -0800176hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner)
Behdad Esfahbod49baa1f2010-10-12 16:50:36 -0400177{
Behdad Esfahbod9b37b4c2012-11-12 18:23:38 -0800178 switch ((hb_tag_t) planner->props.script)
Behdad Esfahbod62879ee2011-04-18 23:40:21 -0400179 {
Behdad Esfahbodd05dded2011-07-07 23:42:40 -0400180 default:
Behdad Esfahbod693918e2012-07-30 21:08:51 -0400181 return &_hb_ot_complex_shaper_default;
Behdad Esfahbodd05dded2011-07-07 23:42:40 -0400182
Behdad Esfahbodc9a841f2012-04-07 15:06:55 -0400183
Behdad Esfahbod317b9502012-03-07 16:51:29 -0500184 /* Unicode-1.1 additions */
Behdad Esfahbod49baa1f2010-10-12 16:50:36 -0400185 case HB_SCRIPT_ARABIC:
Behdad Esfahbod54e6f6c2013-08-09 14:34:54 -0400186
187 /* Unicode-3.0 additions */
Behdad Esfahbodd86a5b32010-12-21 18:36:25 -0500188 case HB_SCRIPT_MONGOLIAN:
Behdad Esfahbodb9ddbd52011-06-02 17:43:12 -0400189 case HB_SCRIPT_SYRIAC:
Behdad Esfahbod317b9502012-03-07 16:51:29 -0500190
191 /* Unicode-5.0 additions */
192 case HB_SCRIPT_NKO:
Behdad Esfahbod3ba7bc12012-11-01 20:05:04 -0700193 case HB_SCRIPT_PHAGS_PA:
Behdad Esfahbod317b9502012-03-07 16:51:29 -0500194
195 /* Unicode-6.0 additions */
196 case HB_SCRIPT_MANDAIC:
197
Behdad Esfahbod7cfee382014-04-28 15:09:30 -0700198 /* Unicode-7.0 additions */
199 case HB_SCRIPT_MANICHAEAN:
200 case HB_SCRIPT_PSALTER_PAHLAVI:
201
Behdad Esfahbode888f642017-01-26 14:50:14 -0800202 /* Unicode-9.0 additions */
203 case HB_SCRIPT_ADLAM:
204
Behdad Esfahbod060e6b42018-06-05 17:31:46 -0700205 /* Unicode-11.0 additions */
206 case HB_SCRIPT_HANIFI_ROHINGYA:
207 case HB_SCRIPT_SOGDIAN:
208
Behdad Esfahbod9e929782012-11-12 18:36:10 -0800209 /* For Arabic script, use the Arabic shaper even if no OT script tag was found.
Jonathan Kewf724cc32015-04-23 12:45:02 +0100210 * This is because we do fallback shaping for Arabic script (and not others).
211 * But note that Arabic shaping is applicable only to horizontal layout; for
212 * vertical text, just use the generic shaper instead. */
213 if ((planner->map.chosen_script[0] != HB_OT_TAG_DEFAULT_SCRIPT ||
214 planner->props.script == HB_SCRIPT_ARABIC) &&
215 HB_DIRECTION_IS_HORIZONTAL(planner->props.direction))
Behdad Esfahbod5ab38552012-11-12 18:27:42 -0800216 return &_hb_ot_complex_shaper_arabic;
217 else
218 return &_hb_ot_complex_shaper_default;
Behdad Esfahbod49baa1f2010-10-12 16:50:36 -0400219
Behdad Esfahbodc9a841f2012-04-07 15:06:55 -0400220
221 /* Unicode-1.1 additions */
Behdad Esfahbod3b26f962012-04-10 10:52:07 -0400222 case HB_SCRIPT_THAI:
223 case HB_SCRIPT_LAO:
224
Behdad Esfahbod693918e2012-07-30 21:08:51 -0400225 return &_hb_ot_complex_shaper_thai;
Behdad Esfahbod3b26f962012-04-10 10:52:07 -0400226
227
Behdad Esfahbod587e5752013-04-05 12:38:58 -0400228 /* Unicode-1.1 additions */
229 case HB_SCRIPT_HANGUL:
230
231 return &_hb_ot_complex_shaper_hangul;
Behdad Esfahbod587e5752013-04-05 12:38:58 -0400232
Behdad Esfahbodc9a841f2012-04-07 15:06:55 -0400233
Behdad Esfahbodf14bb7d2013-12-31 16:49:15 +0800234 /* Unicode-1.1 additions */
235 case HB_SCRIPT_HEBREW:
236
237 return &_hb_ot_complex_shaper_hebrew;
238
239
Behdad Esfahbodcad38212012-03-07 17:13:25 -0500240 /* Unicode-1.1 additions */
Behdad Esfahbodbc187e52011-09-08 13:35:17 -0400241 case HB_SCRIPT_BENGALI:
Behdad Esfahbodb9ddbd52011-06-02 17:43:12 -0400242 case HB_SCRIPT_DEVANAGARI:
243 case HB_SCRIPT_GUJARATI:
244 case HB_SCRIPT_GURMUKHI:
Behdad Esfahbodb9ddbd52011-06-02 17:43:12 -0400245 case HB_SCRIPT_KANNADA:
Behdad Esfahbodb9ddbd52011-06-02 17:43:12 -0400246 case HB_SCRIPT_MALAYALAM:
Behdad Esfahbod7a4a8482012-01-19 15:15:21 -0500247 case HB_SCRIPT_ORIYA:
Behdad Esfahbodb9ddbd52011-06-02 17:43:12 -0400248 case HB_SCRIPT_TAMIL:
249 case HB_SCRIPT_TELUGU:
Behdad Esfahbodcad38212012-03-07 17:13:25 -0500250
251 /* Unicode-3.0 additions */
Behdad Esfahbodcad38212012-03-07 17:13:25 -0500252 case HB_SCRIPT_SINHALA:
253
Behdad Esfahbod5676d5d2013-02-12 10:31:14 -0500254 /* If the designer designed the font for the 'DFLT' script,
Behdad Esfahbod57c55ef2017-10-02 18:21:27 +0200255 * (or we ended up arbitrarily pick 'latn'), use the default shaper.
256 * Otherwise, use the specific shaper.
Behdad Esfahbod654365d2018-10-11 17:51:21 -0400257 *
258 * If it's indy3 tag, send to USE. */
Behdad Esfahbod57c55ef2017-10-02 18:21:27 +0200259 if (planner->map.chosen_script[0] == HB_TAG ('D','F','L','T') ||
260 planner->map.chosen_script[0] == HB_TAG ('l','a','t','n'))
Behdad Esfahbod851784f2012-11-14 16:24:05 -0800261 return &_hb_ot_complex_shaper_default;
Behdad Esfahbod654365d2018-10-11 17:51:21 -0400262 else if ((planner->map.chosen_script[0] & 0x000000FF) == '3')
263 return &_hb_ot_complex_shaper_use;
Behdad Esfahbod5676d5d2013-02-12 10:31:14 -0500264 else
265 return &_hb_ot_complex_shaper_indic;
Behdad Esfahbod981748c2012-11-14 13:38:16 -0800266
267 case HB_SCRIPT_KHMER:
Behdad Esfahboddcf4d952018-01-05 14:54:31 +0000268 return &_hb_ot_complex_shaper_khmer;
Behdad Esfahbod981748c2012-11-14 13:38:16 -0800269
270 case HB_SCRIPT_MYANMAR:
Behdad Esfahbod7dc56192018-11-22 14:45:46 -0500271 /* If the designer designed the font for the 'DFLT' script,
272 * (or we ended up arbitrarily pick 'latn'), use the default shaper.
273 * Otherwise, use the specific shaper.
274 *
275 * If designer designed for 'mymr' tag, also send to default
276 * shaper. That's tag used from before Myanmar shaping spec
277 * was developed. The shaping spec uses 'mym2' tag. */
278 if (planner->map.chosen_script[0] == HB_TAG ('D','F','L','T') ||
279 planner->map.chosen_script[0] == HB_TAG ('l','a','t','n') ||
280 planner->map.chosen_script[0] == HB_TAG ('m','y','m','r'))
Behdad Esfahbod5ab38552012-11-12 18:27:42 -0800281 return &_hb_ot_complex_shaper_default;
Behdad Esfahbod7dc56192018-11-22 14:45:46 -0500282 else
283 return &_hb_ot_complex_shaper_myanmar;
Behdad Esfahbod3a83d332013-02-12 12:14:10 -0500284
Behdad Esfahbod52a95772015-07-21 10:02:04 +0100285
Behdad Esfahbodfa0bd892018-11-22 14:46:39 -0500286 /* https://github.com/harfbuzz/harfbuzz/issues/1162 */
287 case HB_SCRIPT_MYANMAR_ZAWGYI:
288
289 return &_hb_ot_complex_shaper_myanmar_zawgyi;
290
291
Behdad Esfahbod52a95772015-07-21 10:02:04 +0100292 /* Unicode-2.0 additions */
Behdad Esfahbod32a43812018-10-02 18:43:29 +0200293 case HB_SCRIPT_TIBETAN:
Behdad Esfahbod52a95772015-07-21 10:02:04 +0100294
295 /* Unicode-3.0 additions */
296 //case HB_SCRIPT_MONGOLIAN:
297 //case HB_SCRIPT_SINHALA:
298
299 /* Unicode-3.2 additions */
300 case HB_SCRIPT_BUHID:
301 case HB_SCRIPT_HANUNOO:
302 case HB_SCRIPT_TAGALOG:
303 case HB_SCRIPT_TAGBANWA:
304
305 /* Unicode-4.0 additions */
306 case HB_SCRIPT_LIMBU:
307 case HB_SCRIPT_TAI_LE:
308
309 /* Unicode-4.1 additions */
Behdad Esfahboddb1e9cd2015-07-21 17:46:06 +0100310 case HB_SCRIPT_BUGINESE:
Behdad Esfahbod52a95772015-07-21 10:02:04 +0100311 case HB_SCRIPT_KHAROSHTHI:
312 case HB_SCRIPT_SYLOTI_NAGRI:
313 case HB_SCRIPT_TIFINAGH:
314
315 /* Unicode-5.0 additions */
Behdad Esfahbod29832d72015-07-21 17:24:18 +0100316 case HB_SCRIPT_BALINESE:
Behdad Esfahbod52a95772015-07-21 10:02:04 +0100317 //case HB_SCRIPT_NKO:
318 //case HB_SCRIPT_PHAGS_PA:
319
320 /* Unicode-5.1 additions */
Behdad Esfahboddb1e9cd2015-07-21 17:46:06 +0100321 case HB_SCRIPT_CHAM:
Behdad Esfahbod52a95772015-07-21 10:02:04 +0100322 case HB_SCRIPT_KAYAH_LI:
Behdad Esfahbod29832d72015-07-21 17:24:18 +0100323 case HB_SCRIPT_LEPCHA:
324 case HB_SCRIPT_REJANG:
Behdad Esfahbod52a95772015-07-21 10:02:04 +0100325 case HB_SCRIPT_SAURASHTRA:
Behdad Esfahbod29832d72015-07-21 17:24:18 +0100326 case HB_SCRIPT_SUNDANESE:
Behdad Esfahbod52a95772015-07-21 10:02:04 +0100327
328 /* Unicode-5.2 additions */
329 case HB_SCRIPT_EGYPTIAN_HIEROGLYPHS:
Behdad Esfahbod30e6e292016-05-06 15:52:27 +0100330 case HB_SCRIPT_JAVANESE:
Behdad Esfahbod29832d72015-07-21 17:24:18 +0100331 case HB_SCRIPT_KAITHI:
332 case HB_SCRIPT_MEETEI_MAYEK:
Behdad Esfahboddb1e9cd2015-07-21 17:46:06 +0100333 case HB_SCRIPT_TAI_THAM:
Behdad Esfahbod29832d72015-07-21 17:24:18 +0100334 case HB_SCRIPT_TAI_VIET:
Behdad Esfahbod52a95772015-07-21 10:02:04 +0100335
336 /* Unicode-6.0 additions */
Behdad Esfahbod29832d72015-07-21 17:24:18 +0100337 case HB_SCRIPT_BATAK:
Behdad Esfahbod52a95772015-07-21 10:02:04 +0100338 case HB_SCRIPT_BRAHMI:
339 //case HB_SCRIPT_MANDAIC:
340
341 /* Unicode-6.1 additions */
Behdad Esfahbod29832d72015-07-21 17:24:18 +0100342 case HB_SCRIPT_CHAKMA:
343 case HB_SCRIPT_SHARADA:
344 case HB_SCRIPT_TAKRI:
Behdad Esfahbod52a95772015-07-21 10:02:04 +0100345
346 /* Unicode-7.0 additions */
347 case HB_SCRIPT_DUPLOYAN:
348 case HB_SCRIPT_GRANTHA:
349 case HB_SCRIPT_KHOJKI:
350 case HB_SCRIPT_KHUDAWADI:
351 case HB_SCRIPT_MAHAJANI:
352 //case HB_SCRIPT_MANICHAEAN:
353 case HB_SCRIPT_MODI:
354 case HB_SCRIPT_PAHAWH_HMONG:
355 //case HB_SCRIPT_PSALTER_PAHLAVI:
356 case HB_SCRIPT_SIDDHAM:
357 case HB_SCRIPT_TIRHUTA:
358
Behdad Esfahbod691086f2016-05-06 12:08:18 +0100359 /* Unicode-8.0 additions */
360 case HB_SCRIPT_AHOM:
Behdad Esfahbod691086f2016-05-06 12:08:18 +0100361
362 /* Unicode-9.0 additions */
Behdad Esfahbod9c4ffd12018-10-03 12:53:54 +0200363 //case HB_SCRIPT_ADLAM:
Behdad Esfahbod691086f2016-05-06 12:08:18 +0100364 case HB_SCRIPT_BHAIKSUKI:
365 case HB_SCRIPT_MARCHEN:
366 case HB_SCRIPT_NEWA:
367
Behdad Esfahbod1535f8c2017-10-02 16:12:18 +0200368 /* Unicode-10.0 additions */
369 case HB_SCRIPT_MASARAM_GONDI:
370 case HB_SCRIPT_SOYOMBO:
371 case HB_SCRIPT_ZANABAZAR_SQUARE:
372
Behdad Esfahbod060e6b42018-06-05 17:31:46 -0700373 /* Unicode-11.0 additions */
374 case HB_SCRIPT_DOGRA:
375 case HB_SCRIPT_GUNJALA_GONDI:
Behdad Esfahbod9c4ffd12018-10-03 12:53:54 +0200376 //case HB_SCRIPT_HANIFI_ROHINGYA:
Behdad Esfahbod060e6b42018-06-05 17:31:46 -0700377 case HB_SCRIPT_MAKASAR:
Behdad Esfahbod9c4ffd12018-10-03 12:53:54 +0200378 //case HB_SCRIPT_SOGDIAN:
Behdad Esfahbod060e6b42018-06-05 17:31:46 -0700379
David Corbette723c042019-03-06 12:37:25 -0500380 /* Unicode-12.0 additions */
381 case HB_SCRIPT_NANDINAGARI:
382
Behdad Esfahbod87dde9c2015-07-21 17:31:43 +0100383 /* If the designer designed the font for the 'DFLT' script,
Behdad Esfahbod57c55ef2017-10-02 18:21:27 +0200384 * (or we ended up arbitrarily pick 'latn'), use the default shaper.
385 * Otherwise, use the specific shaper.
Behdad Esfahbod87dde9c2015-07-21 17:31:43 +0100386 * Note that for some simple scripts, there may not be *any*
387 * GSUB/GPOS needed, so there may be no scripts found! */
Behdad Esfahbod57c55ef2017-10-02 18:21:27 +0200388 if (planner->map.chosen_script[0] == HB_TAG ('D','F','L','T') ||
389 planner->map.chosen_script[0] == HB_TAG ('l','a','t','n'))
Behdad Esfahbod87dde9c2015-07-21 17:31:43 +0100390 return &_hb_ot_complex_shaper_default;
391 else
392 return &_hb_ot_complex_shaper_use;
Behdad Esfahbod49baa1f2010-10-12 16:50:36 -0400393 }
394}
395
396
Behdad Esfahbodc77ae402018-08-25 22:36:36 -0700397#endif /* HB_OT_SHAPE_COMPLEX_HH */