OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2011,2012,2013 Google, Inc. | 2 * Copyright © 2011,2012,2013 Google, Inc. |
3 * | 3 * |
4 * This is part of HarfBuzz, a text shaping library. | 4 * This is part of HarfBuzz, a text shaping library. |
5 * | 5 * |
6 * Permission is hereby granted, without written agreement and without | 6 * Permission is hereby granted, without written agreement and without |
7 * license or royalty fees, to use, copy, modify, and distribute this | 7 * license or royalty fees, to use, copy, modify, and distribute this |
8 * software and its documentation for any purpose, provided that the | 8 * software and its documentation for any purpose, provided that the |
9 * above copyright notice and the following two paragraphs appear in | 9 * above copyright notice and the following two paragraphs appear in |
10 * all copies of this software. | 10 * all copies of this software. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 OT_VPst = 29, | 132 OT_VPst = 29, |
133 OT_T = 3, /* Tone Marks */ | 133 OT_T = 3, /* Tone Marks */ |
134 // OT_A = 10, /* Anusvara */ | 134 // OT_A = 10, /* Anusvara */ |
135 }; | 135 }; |
136 | 136 |
137 static inline void | 137 static inline void |
138 set_sea_properties (hb_glyph_info_t &info) | 138 set_sea_properties (hb_glyph_info_t &info) |
139 { | 139 { |
140 hb_codepoint_t u = info.codepoint; | 140 hb_codepoint_t u = info.codepoint; |
141 unsigned int type = hb_indic_get_categories (u); | 141 unsigned int type = hb_indic_get_categories (u); |
142 indic_category_t cat = (indic_category_t) (type & 0x7F); | 142 indic_category_t cat = (indic_category_t) (type & 0x7Fu); |
143 indic_position_t pos = (indic_position_t) (type >> 8); | 143 indic_position_t pos = (indic_position_t) (type >> 8); |
144 | 144 |
145 /* Medial Ra */ | 145 /* Medial Ra */ |
146 if (u == 0x1A55 || u == 0xAA34) | 146 if (u == 0x1A55u || u == 0xAA34u) |
147 cat = (indic_category_t) OT_MR; | 147 cat = (indic_category_t) OT_MR; |
148 | 148 |
149 if (cat == OT_M) | 149 if (cat == OT_M) |
150 { | 150 { |
151 switch ((int) pos) | 151 switch ((int) pos) |
152 { | 152 { |
153 case POS_PRE_C: cat = (indic_category_t) OT_VPre; break; | 153 case POS_PRE_C: cat = (indic_category_t) OT_VPre; break; |
154 case POS_ABOVE_C: cat = (indic_category_t) OT_VAbv; break; | 154 case POS_ABOVE_C: cat = (indic_category_t) OT_VAbv; break; |
155 case POS_BELOW_C: cat = (indic_category_t) OT_VBlw; break; | 155 case POS_BELOW_C: cat = (indic_category_t) OT_VBlw; break; |
156 case POS_POST_C: cat = (indic_category_t) OT_VPst; break; | 156 case POS_POST_C: cat = (indic_category_t) OT_VPst; break; |
(...skipping 10 matching lines...) Expand all Loading... |
167 hb_buffer_t *buffer, | 167 hb_buffer_t *buffer, |
168 hb_font_t *font HB_UNUSED) | 168 hb_font_t *font HB_UNUSED) |
169 { | 169 { |
170 HB_BUFFER_ALLOCATE_VAR (buffer, sea_category); | 170 HB_BUFFER_ALLOCATE_VAR (buffer, sea_category); |
171 HB_BUFFER_ALLOCATE_VAR (buffer, sea_position); | 171 HB_BUFFER_ALLOCATE_VAR (buffer, sea_position); |
172 | 172 |
173 /* We cannot setup masks here. We save information about characters | 173 /* We cannot setup masks here. We save information about characters |
174 * and setup masks later on in a pause-callback. */ | 174 * and setup masks later on in a pause-callback. */ |
175 | 175 |
176 unsigned int count = buffer->len; | 176 unsigned int count = buffer->len; |
| 177 hb_glyph_info_t *info = buffer->info; |
177 for (unsigned int i = 0; i < count; i++) | 178 for (unsigned int i = 0; i < count; i++) |
178 set_sea_properties (buffer->info[i]); | 179 set_sea_properties (info[i]); |
179 } | 180 } |
180 | 181 |
181 static void | 182 static void |
182 setup_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED, | 183 setup_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED, |
183 hb_font_t *font HB_UNUSED, | 184 hb_font_t *font HB_UNUSED, |
184 hb_buffer_t *buffer) | 185 hb_buffer_t *buffer) |
185 { | 186 { |
186 find_syllables (buffer); | 187 find_syllables (buffer); |
187 } | 188 } |
188 | 189 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 } | 272 } |
272 | 273 |
273 static inline void | 274 static inline void |
274 insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, | 275 insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, |
275 hb_font_t *font, | 276 hb_font_t *font, |
276 hb_buffer_t *buffer) | 277 hb_buffer_t *buffer) |
277 { | 278 { |
278 /* Note: This loop is extra overhead, but should not be measurable. */ | 279 /* Note: This loop is extra overhead, but should not be measurable. */ |
279 bool has_broken_syllables = false; | 280 bool has_broken_syllables = false; |
280 unsigned int count = buffer->len; | 281 unsigned int count = buffer->len; |
| 282 hb_glyph_info_t *info = buffer->info; |
281 for (unsigned int i = 0; i < count; i++) | 283 for (unsigned int i = 0; i < count; i++) |
282 if ((buffer->info[i].syllable() & 0x0F) == broken_cluster) { | 284 if ((info[i].syllable() & 0x0F) == broken_cluster) |
| 285 { |
283 has_broken_syllables = true; | 286 has_broken_syllables = true; |
284 break; | 287 break; |
285 } | 288 } |
286 if (likely (!has_broken_syllables)) | 289 if (likely (!has_broken_syllables)) |
287 return; | 290 return; |
288 | 291 |
289 | 292 |
290 hb_codepoint_t dottedcircle_glyph; | 293 hb_codepoint_t dottedcircle_glyph; |
291 if (!font->get_glyph (0x25CC, 0, &dottedcircle_glyph)) | 294 if (!font->get_glyph (0x25CCu, 0, &dottedcircle_glyph)) |
292 return; | 295 return; |
293 | 296 |
294 hb_glyph_info_t dottedcircle = {0}; | 297 hb_glyph_info_t dottedcircle = {0}; |
295 dottedcircle.codepoint = 0x25CC; | 298 dottedcircle.codepoint = 0x25CCu; |
296 set_sea_properties (dottedcircle); | 299 set_sea_properties (dottedcircle); |
297 dottedcircle.codepoint = dottedcircle_glyph; | 300 dottedcircle.codepoint = dottedcircle_glyph; |
298 | 301 |
299 buffer->clear_output (); | 302 buffer->clear_output (); |
300 | 303 |
301 buffer->idx = 0; | 304 buffer->idx = 0; |
302 unsigned int last_syllable = 0; | 305 unsigned int last_syllable = 0; |
303 while (buffer->idx < buffer->len) | 306 while (buffer->idx < buffer->len) |
304 { | 307 { |
305 unsigned int syllable = buffer->cur().syllable(); | 308 unsigned int syllable = buffer->cur().syllable(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 NULL, /* data_create */ | 371 NULL, /* data_create */ |
369 NULL, /* data_destroy */ | 372 NULL, /* data_destroy */ |
370 NULL, /* preprocess_text */ | 373 NULL, /* preprocess_text */ |
371 HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, | 374 HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, |
372 NULL, /* decompose */ | 375 NULL, /* decompose */ |
373 NULL, /* compose */ | 376 NULL, /* compose */ |
374 setup_masks_sea, | 377 setup_masks_sea, |
375 HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, | 378 HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, |
376 false, /* fallback_position */ | 379 false, /* fallback_position */ |
377 }; | 380 }; |
OLD | NEW |