Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2011,2012,2013 Google, Inc. |
| 3 | * |
| 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 Esfahbod | c77ae40 | 2018-08-25 22:36:36 -0700 | [diff] [blame] | 27 | #include "hb-ot-shape-complex-myanmar.hh" |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 28 | |
| 29 | |
| 30 | /* |
| 31 | * Myanmar shaper. |
| 32 | */ |
| 33 | |
| 34 | static const hb_tag_t |
Behdad Esfahbod | ee9c3a1 | 2013-02-15 06:22:26 -0500 | [diff] [blame] | 35 | basic_features[] = |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 36 | { |
| 37 | /* |
| 38 | * Basic features. |
| 39 | * These features are applied in order, one at a time, after initial_reordering. |
| 40 | */ |
| 41 | HB_TAG('r','p','h','f'), |
| 42 | HB_TAG('p','r','e','f'), |
| 43 | HB_TAG('b','l','w','f'), |
| 44 | HB_TAG('p','s','t','f'), |
Behdad Esfahbod | ee9c3a1 | 2013-02-15 06:22:26 -0500 | [diff] [blame] | 45 | }; |
| 46 | static const hb_tag_t |
| 47 | other_features[] = |
| 48 | { |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 49 | /* |
| 50 | * Other features. |
| 51 | * These features are applied all at once, after final_reordering. |
| 52 | */ |
| 53 | HB_TAG('p','r','e','s'), |
| 54 | HB_TAG('a','b','v','s'), |
| 55 | HB_TAG('b','l','w','s'), |
| 56 | HB_TAG('p','s','t','s'), |
Behdad Esfahbod | 3583fb0 | 2018-09-23 22:33:38 -0400 | [diff] [blame] | 57 | }; |
| 58 | static const hb_tag_t |
| 59 | positioning_features[] = |
| 60 | { |
| 61 | /* |
| 62 | * Positioning features. |
| 63 | * We don't care about the types. |
| 64 | */ |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 65 | HB_TAG('d','i','s','t'), |
Behdad Esfahbod | 5e7432b | 2013-10-15 12:28:23 +0200 | [diff] [blame] | 66 | /* Pre-release version of Windows 8 Myanmar font had abvm,blwm |
| 67 | * features. The released Windows 8 version of the font (as well |
| 68 | * as the released spec) used 'mark' instead. The Windows 8 |
| 69 | * shaper however didn't apply 'mark' but did apply 'mkmk'. |
| 70 | * Perhaps it applied abvm/blwm. This was fixed in a Windows 8 |
| 71 | * update, so now it applies mark/mkmk. We are guessing that |
| 72 | * it still applies abvm/blwm too. |
| 73 | */ |
| 74 | HB_TAG('a','b','v','m'), |
| 75 | HB_TAG('b','l','w','m'), |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 76 | }; |
| 77 | |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 78 | static void |
| 79 | setup_syllables (const hb_ot_shape_plan_t *plan, |
| 80 | hb_font_t *font, |
| 81 | hb_buffer_t *buffer); |
| 82 | static void |
| 83 | initial_reordering (const hb_ot_shape_plan_t *plan, |
| 84 | hb_font_t *font, |
| 85 | hb_buffer_t *buffer); |
| 86 | static void |
| 87 | final_reordering (const hb_ot_shape_plan_t *plan, |
| 88 | hb_font_t *font, |
| 89 | hb_buffer_t *buffer); |
| 90 | |
| 91 | static void |
| 92 | collect_features_myanmar (hb_ot_shape_planner_t *plan) |
| 93 | { |
| 94 | hb_ot_map_builder_t *map = &plan->map; |
| 95 | |
| 96 | /* Do this before any lookups have been applied. */ |
| 97 | map->add_gsub_pause (setup_syllables); |
| 98 | |
Behdad Esfahbod | f048ead | 2018-09-24 18:01:53 -0400 | [diff] [blame] | 99 | map->enable_feature (HB_TAG('l','o','c','l')); |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 100 | /* The Indic specs do not require ccmp, but we apply it here since if |
| 101 | * there is a use of it, it's typically at the beginning. */ |
Behdad Esfahbod | f048ead | 2018-09-24 18:01:53 -0400 | [diff] [blame] | 102 | map->enable_feature (HB_TAG('c','c','m','p')); |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 103 | |
| 104 | |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 105 | map->add_gsub_pause (initial_reordering); |
Behdad Esfahbod | 3583fb0 | 2018-09-23 22:33:38 -0400 | [diff] [blame] | 106 | |
Behdad Esfahbod | ee9c3a1 | 2013-02-15 06:22:26 -0500 | [diff] [blame] | 107 | for (unsigned int i = 0; i < ARRAY_LENGTH (basic_features); i++) |
| 108 | { |
Behdad Esfahbod | 0a371fe | 2018-10-02 14:48:39 +0200 | [diff] [blame] | 109 | map->enable_feature (basic_features[i], F_MANUAL_ZWJ); |
Behdad Esfahbod | dbdbfe3 | 2017-10-15 12:11:08 +0200 | [diff] [blame] | 110 | map->add_gsub_pause (nullptr); |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 111 | } |
Behdad Esfahbod | 3583fb0 | 2018-09-23 22:33:38 -0400 | [diff] [blame] | 112 | |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 113 | map->add_gsub_pause (final_reordering); |
Behdad Esfahbod | 3583fb0 | 2018-09-23 22:33:38 -0400 | [diff] [blame] | 114 | |
Behdad Esfahbod | ee9c3a1 | 2013-02-15 06:22:26 -0500 | [diff] [blame] | 115 | for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++) |
Behdad Esfahbod | 0a371fe | 2018-10-02 14:48:39 +0200 | [diff] [blame] | 116 | map->enable_feature (other_features[i], F_MANUAL_ZWJ); |
Behdad Esfahbod | 3583fb0 | 2018-09-23 22:33:38 -0400 | [diff] [blame] | 117 | |
| 118 | for (unsigned int i = 0; i < ARRAY_LENGTH (positioning_features); i++) |
Behdad Esfahbod | f048ead | 2018-09-24 18:01:53 -0400 | [diff] [blame] | 119 | map->enable_feature (positioning_features[i]); |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 120 | } |
| 121 | |
| 122 | static void |
| 123 | override_features_myanmar (hb_ot_shape_planner_t *plan) |
| 124 | { |
Behdad Esfahbod | 1676f60 | 2018-09-24 17:55:03 -0400 | [diff] [blame] | 125 | plan->map.disable_feature (HB_TAG('l','i','g','a')); |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | |
| 129 | enum syllable_type_t { |
| 130 | consonant_syllable, |
Behdad Esfahbod | 9174a9d | 2013-11-25 18:10:38 -0500 | [diff] [blame] | 131 | punctuation_cluster, |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 132 | broken_cluster, |
| 133 | non_myanmar_cluster, |
| 134 | }; |
| 135 | |
| 136 | #include "hb-ot-shape-complex-myanmar-machine.hh" |
| 137 | |
| 138 | |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 139 | static void |
| 140 | setup_masks_myanmar (const hb_ot_shape_plan_t *plan HB_UNUSED, |
| 141 | hb_buffer_t *buffer, |
| 142 | hb_font_t *font HB_UNUSED) |
| 143 | { |
| 144 | HB_BUFFER_ALLOCATE_VAR (buffer, myanmar_category); |
| 145 | HB_BUFFER_ALLOCATE_VAR (buffer, myanmar_position); |
| 146 | |
| 147 | /* We cannot setup masks here. We save information about characters |
| 148 | * and setup masks later on in a pause-callback. */ |
| 149 | |
| 150 | unsigned int count = buffer->len; |
Behdad Esfahbod | 7cd33f2 | 2014-07-17 14:22:11 -0400 | [diff] [blame] | 151 | hb_glyph_info_t *info = buffer->info; |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 152 | for (unsigned int i = 0; i < count; i++) |
Behdad Esfahbod | 7cd33f2 | 2014-07-17 14:22:11 -0400 | [diff] [blame] | 153 | set_myanmar_properties (info[i]); |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | static void |
| 157 | setup_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED, |
| 158 | hb_font_t *font HB_UNUSED, |
| 159 | hb_buffer_t *buffer) |
| 160 | { |
| 161 | find_syllables (buffer); |
Behdad Esfahbod | 9e005c5 | 2017-08-10 18:45:33 -0700 | [diff] [blame] | 162 | foreach_syllable (buffer, start, end) |
| 163 | buffer->unsafe_to_break (start, end); |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | static int |
| 167 | compare_myanmar_order (const hb_glyph_info_t *pa, const hb_glyph_info_t *pb) |
| 168 | { |
| 169 | int a = pa->myanmar_position(); |
| 170 | int b = pb->myanmar_position(); |
| 171 | |
| 172 | return a < b ? -1 : a == b ? 0 : +1; |
| 173 | } |
| 174 | |
| 175 | |
| 176 | /* Rules from: |
Ebrahim Byagowi | f24b0b9 | 2018-04-12 13:40:45 +0430 | [diff] [blame] | 177 | * https://docs.microsoft.com/en-us/typography/script-development/myanmar */ |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 178 | |
| 179 | static void |
Behdad Esfahbod | 56f71ff | 2015-07-22 11:58:11 +0100 | [diff] [blame] | 180 | initial_reordering_consonant_syllable (hb_buffer_t *buffer, |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 181 | unsigned int start, unsigned int end) |
| 182 | { |
| 183 | hb_glyph_info_t *info = buffer->info; |
| 184 | |
| 185 | unsigned int base = end; |
| 186 | bool has_reph = false; |
| 187 | |
| 188 | { |
| 189 | unsigned int limit = start; |
| 190 | if (start + 3 <= end && |
| 191 | info[start ].myanmar_category() == OT_Ra && |
| 192 | info[start+1].myanmar_category() == OT_As && |
| 193 | info[start+2].myanmar_category() == OT_H) |
| 194 | { |
| 195 | limit += 3; |
| 196 | base = start; |
| 197 | has_reph = true; |
| 198 | } |
| 199 | |
| 200 | { |
| 201 | if (!has_reph) |
| 202 | base = limit; |
| 203 | |
| 204 | for (unsigned int i = limit; i < end; i++) |
| 205 | if (is_consonant (info[i])) |
| 206 | { |
| 207 | base = i; |
| 208 | break; |
| 209 | } |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | /* Reorder! */ |
| 214 | { |
| 215 | unsigned int i = start; |
| 216 | for (; i < start + (has_reph ? 3 : 0); i++) |
| 217 | info[i].myanmar_position() = POS_AFTER_MAIN; |
| 218 | for (; i < base; i++) |
| 219 | info[i].myanmar_position() = POS_PRE_C; |
| 220 | if (i < end) |
| 221 | { |
| 222 | info[i].myanmar_position() = POS_BASE_C; |
| 223 | i++; |
| 224 | } |
Behdad Esfahbod | f9b6605 | 2013-02-12 16:13:56 -0500 | [diff] [blame] | 225 | indic_position_t pos = POS_AFTER_MAIN; |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 226 | /* The following loop may be ugly, but it implements all of |
| 227 | * Myanmar reordering! */ |
| 228 | for (; i < end; i++) |
| 229 | { |
| 230 | if (info[i].myanmar_category() == OT_MR) /* Pre-base reordering */ |
| 231 | { |
| 232 | info[i].myanmar_position() = POS_PRE_C; |
| 233 | continue; |
| 234 | } |
| 235 | if (info[i].myanmar_position() < POS_BASE_C) /* Left matra */ |
| 236 | { |
| 237 | continue; |
| 238 | } |
David Corbett | ccb0367 | 2018-02-02 12:04:04 -0500 | [diff] [blame] | 239 | if (info[i].myanmar_category() == OT_VS) |
| 240 | { |
| 241 | info[i].myanmar_position() = info[i - 1].myanmar_position(); |
| 242 | continue; |
| 243 | } |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 244 | |
| 245 | if (pos == POS_AFTER_MAIN && info[i].myanmar_category() == OT_VBlw) |
| 246 | { |
| 247 | pos = POS_BELOW_C; |
| 248 | info[i].myanmar_position() = pos; |
| 249 | continue; |
| 250 | } |
| 251 | |
| 252 | if (pos == POS_BELOW_C && info[i].myanmar_category() == OT_A) |
| 253 | { |
| 254 | info[i].myanmar_position() = POS_BEFORE_SUB; |
| 255 | continue; |
| 256 | } |
| 257 | if (pos == POS_BELOW_C && info[i].myanmar_category() == OT_VBlw) |
| 258 | { |
| 259 | info[i].myanmar_position() = pos; |
| 260 | continue; |
| 261 | } |
| 262 | if (pos == POS_BELOW_C && info[i].myanmar_category() != OT_A) |
| 263 | { |
| 264 | pos = POS_AFTER_SUB; |
| 265 | info[i].myanmar_position() = pos; |
| 266 | continue; |
| 267 | } |
| 268 | info[i].myanmar_position() = pos; |
| 269 | } |
| 270 | } |
| 271 | |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 272 | /* Sit tight, rock 'n roll! */ |
Behdad Esfahbod | c403d63 | 2015-09-01 16:15:25 +0100 | [diff] [blame] | 273 | buffer->sort (start, end, compare_myanmar_order); |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 274 | } |
| 275 | |
| 276 | static void |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 277 | initial_reordering_syllable (const hb_ot_shape_plan_t *plan, |
| 278 | hb_face_t *face, |
| 279 | hb_buffer_t *buffer, |
| 280 | unsigned int start, unsigned int end) |
| 281 | { |
| 282 | syllable_type_t syllable_type = (syllable_type_t) (buffer->info[start].syllable() & 0x0F); |
| 283 | switch (syllable_type) { |
Behdad Esfahbod | 56f71ff | 2015-07-22 11:58:11 +0100 | [diff] [blame] | 284 | |
| 285 | case broken_cluster: /* We already inserted dotted-circles, so just call the consonant_syllable. */ |
| 286 | case consonant_syllable: |
| 287 | initial_reordering_consonant_syllable (buffer, start, end); |
| 288 | break; |
| 289 | |
| 290 | case punctuation_cluster: |
| 291 | case non_myanmar_cluster: |
| 292 | break; |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 293 | } |
| 294 | } |
| 295 | |
| 296 | static inline void |
| 297 | insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, |
| 298 | hb_font_t *font, |
| 299 | hb_buffer_t *buffer) |
| 300 | { |
| 301 | /* Note: This loop is extra overhead, but should not be measurable. */ |
| 302 | bool has_broken_syllables = false; |
| 303 | unsigned int count = buffer->len; |
Behdad Esfahbod | 7cd33f2 | 2014-07-17 14:22:11 -0400 | [diff] [blame] | 304 | hb_glyph_info_t *info = buffer->info; |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 305 | for (unsigned int i = 0; i < count; i++) |
Behdad Esfahbod | 7cd33f2 | 2014-07-17 14:22:11 -0400 | [diff] [blame] | 306 | if ((info[i].syllable() & 0x0F) == broken_cluster) |
| 307 | { |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 308 | has_broken_syllables = true; |
| 309 | break; |
| 310 | } |
| 311 | if (likely (!has_broken_syllables)) |
| 312 | return; |
| 313 | |
| 314 | |
| 315 | hb_codepoint_t dottedcircle_glyph; |
Behdad Esfahbod | 8b5bc14 | 2016-02-24 19:05:23 +0900 | [diff] [blame] | 316 | if (!font->get_nominal_glyph (0x25CCu, &dottedcircle_glyph)) |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 317 | return; |
| 318 | |
| 319 | hb_glyph_info_t dottedcircle = {0}; |
Behdad Esfahbod | 7627100 | 2014-07-11 14:54:42 -0400 | [diff] [blame] | 320 | dottedcircle.codepoint = 0x25CCu; |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 321 | set_myanmar_properties (dottedcircle); |
| 322 | dottedcircle.codepoint = dottedcircle_glyph; |
| 323 | |
| 324 | buffer->clear_output (); |
| 325 | |
| 326 | buffer->idx = 0; |
| 327 | unsigned int last_syllable = 0; |
Behdad Esfahbod | 7185b27 | 2018-05-31 20:03:00 -0700 | [diff] [blame] | 328 | while (buffer->idx < buffer->len && buffer->successful) |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 329 | { |
| 330 | unsigned int syllable = buffer->cur().syllable(); |
| 331 | syllable_type_t syllable_type = (syllable_type_t) (syllable & 0x0F); |
| 332 | if (unlikely (last_syllable != syllable && syllable_type == broken_cluster)) |
| 333 | { |
| 334 | last_syllable = syllable; |
| 335 | |
Behdad Esfahbod | 6f932bc | 2015-10-21 11:16:49 -0200 | [diff] [blame] | 336 | hb_glyph_info_t ginfo = dottedcircle; |
| 337 | ginfo.cluster = buffer->cur().cluster; |
| 338 | ginfo.mask = buffer->cur().mask; |
| 339 | ginfo.syllable() = buffer->cur().syllable(); |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 340 | |
Behdad Esfahbod | 6f932bc | 2015-10-21 11:16:49 -0200 | [diff] [blame] | 341 | buffer->output_info (ginfo); |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 342 | } |
| 343 | else |
| 344 | buffer->next_glyph (); |
| 345 | } |
| 346 | |
| 347 | buffer->swap_buffers (); |
| 348 | } |
| 349 | |
| 350 | static void |
| 351 | initial_reordering (const hb_ot_shape_plan_t *plan, |
| 352 | hb_font_t *font, |
| 353 | hb_buffer_t *buffer) |
| 354 | { |
| 355 | insert_dotted_circles (plan, font, buffer); |
| 356 | |
Behdad Esfahbod | 56f71ff | 2015-07-22 11:58:11 +0100 | [diff] [blame] | 357 | foreach_syllable (buffer, start, end) |
| 358 | initial_reordering_syllable (plan, font->face, buffer, start, end); |
Behdad Esfahbod | 98628ca | 2013-02-11 13:36:23 -0500 | [diff] [blame] | 359 | } |
| 360 | |
| 361 | static void |
| 362 | final_reordering (const hb_ot_shape_plan_t *plan, |
| 363 | hb_font_t *font HB_UNUSED, |
| 364 | hb_buffer_t *buffer) |
| 365 | { |
| 366 | hb_glyph_info_t *info = buffer->info; |
| 367 | unsigned int count = buffer->len; |
| 368 | |
| 369 | /* Zero syllables now... */ |
| 370 | for (unsigned int i = 0; i < count; i++) |
| 371 | info[i].syllable() = 0; |
| 372 | |
| 373 | HB_BUFFER_DEALLOCATE_VAR (buffer, myanmar_category); |
| 374 | HB_BUFFER_DEALLOCATE_VAR (buffer, myanmar_position); |
| 375 | } |
| 376 | |
Behdad Esfahbod | 71b4c99 | 2013-10-28 00:20:59 +0100 | [diff] [blame] | 377 | |
Behdad Esfahbod | 00c5c4a | 2018-10-11 20:15:31 -0400 | [diff] [blame] | 378 | const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar = |
| 379 | { |
| 380 | collect_features_myanmar, |
| 381 | override_features_myanmar, |
| 382 | nullptr, /* data_create */ |
| 383 | nullptr, /* data_destroy */ |
| 384 | nullptr, /* preprocess_text */ |
| 385 | nullptr, /* postprocess_glyphs */ |
| 386 | HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, |
| 387 | nullptr, /* decompose */ |
| 388 | nullptr, /* compose */ |
| 389 | setup_masks_myanmar, |
| 390 | HB_TAG_NONE, /* gpos_tag */ |
| 391 | nullptr, /* reorder_marks */ |
| 392 | HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY, |
| 393 | false, /* fallback_position */ |
| 394 | }; |
| 395 | |
| 396 | |
Behdad Esfahbod | 6f2d9ba | 2014-07-26 19:17:44 -0400 | [diff] [blame] | 397 | /* Uniscribe seems to have a shaper for 'mymr' that is like the |
| 398 | * generic shaper, except that it zeros mark advances GDEF_LATE. */ |
| 399 | const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar_old = |
| 400 | { |
Behdad Esfahbod | dbdbfe3 | 2017-10-15 12:11:08 +0200 | [diff] [blame] | 401 | nullptr, /* collect_features */ |
| 402 | nullptr, /* override_features */ |
| 403 | nullptr, /* data_create */ |
| 404 | nullptr, /* data_destroy */ |
| 405 | nullptr, /* preprocess_text */ |
| 406 | nullptr, /* postprocess_glyphs */ |
Behdad Esfahbod | 6f2d9ba | 2014-07-26 19:17:44 -0400 | [diff] [blame] | 407 | HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT, |
Behdad Esfahbod | dbdbfe3 | 2017-10-15 12:11:08 +0200 | [diff] [blame] | 408 | nullptr, /* decompose */ |
| 409 | nullptr, /* compose */ |
| 410 | nullptr, /* setup_masks */ |
Behdad Esfahbod | 48c513f | 2018-10-02 14:17:42 +0200 | [diff] [blame] | 411 | HB_TAG_NONE, /* gpos_tag */ |
Behdad Esfahbod | dbdbfe3 | 2017-10-15 12:11:08 +0200 | [diff] [blame] | 412 | nullptr, /* reorder_marks */ |
Behdad Esfahbod | 6f2d9ba | 2014-07-26 19:17:44 -0400 | [diff] [blame] | 413 | HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, |
| 414 | true, /* fallback_position */ |
| 415 | }; |
Behdad Esfahbod | bdb53ca | 2018-10-11 20:20:00 -0400 | [diff] [blame] | 416 | |
| 417 | |
| 418 | /* Ugly Zawgyi encoding. |
| 419 | * Disable all auto processing. |
| 420 | * https://github.com/harfbuzz/harfbuzz/issues/1162 */ |
| 421 | const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar_zawgyi = |
| 422 | { |
| 423 | nullptr, /* collect_features */ |
| 424 | nullptr, /* override_features */ |
| 425 | nullptr, /* data_create */ |
| 426 | nullptr, /* data_destroy */ |
| 427 | nullptr, /* preprocess_text */ |
| 428 | nullptr, /* postprocess_glyphs */ |
| 429 | HB_OT_SHAPE_NORMALIZATION_MODE_NONE, |
| 430 | nullptr, /* decompose */ |
| 431 | nullptr, /* compose */ |
| 432 | nullptr, /* setup_masks */ |
| 433 | HB_TAG_NONE, /* gpos_tag */ |
| 434 | nullptr, /* reorder_marks */ |
| 435 | HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, |
| 436 | false, /* fallback_position */ |
| 437 | }; |