Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1314)

Side by Side Diff: third_party/harfbuzz-ng/src/hb-ot-shape-complex-arabic.cc

Issue 475363002: Roll HarfBuzz to 0.9.35 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Windows build fix attempt Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright © 2010,2012 Google, Inc. 2 * Copyright © 2010,2012 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 data_create_arabic (const hb_ot_shape_plan_t *plan) 216 data_create_arabic (const hb_ot_shape_plan_t *plan)
217 { 217 {
218 arabic_shape_plan_t *arabic_plan = (arabic_shape_plan_t *) calloc (1, sizeof ( arabic_shape_plan_t)); 218 arabic_shape_plan_t *arabic_plan = (arabic_shape_plan_t *) calloc (1, sizeof ( arabic_shape_plan_t));
219 if (unlikely (!arabic_plan)) 219 if (unlikely (!arabic_plan))
220 return NULL; 220 return NULL;
221 221
222 arabic_plan->do_fallback = plan->props.script == HB_SCRIPT_ARABIC; 222 arabic_plan->do_fallback = plan->props.script == HB_SCRIPT_ARABIC;
223 for (unsigned int i = 0; i < ARABIC_NUM_FEATURES; i++) { 223 for (unsigned int i = 0; i < ARABIC_NUM_FEATURES; i++) {
224 arabic_plan->mask_array[i] = plan->map.get_1_mask (arabic_features[i]); 224 arabic_plan->mask_array[i] = plan->map.get_1_mask (arabic_features[i]);
225 arabic_plan->do_fallback = arabic_plan->do_fallback && 225 arabic_plan->do_fallback = arabic_plan->do_fallback &&
226 » » » !FEATURE_IS_SYRIAC (arabic_features[i]) && 226 » » » (FEATURE_IS_SYRIAC (arabic_features[i]) ||
227 » » » plan->map.needs_fallback (arabic_features[i]); 227 » » » plan->map.needs_fallback (arabic_features[i]));
228 } 228 }
229 229
230 return arabic_plan; 230 return arabic_plan;
231 } 231 }
232 232
233 static void 233 static void
234 data_destroy_arabic (void *data) 234 data_destroy_arabic (void *data)
235 { 235 {
236 arabic_shape_plan_t *arabic_plan = (arabic_shape_plan_t *) data; 236 arabic_shape_plan_t *arabic_plan = (arabic_shape_plan_t *) data;
237 237
238 arabic_fallback_plan_destroy (arabic_plan->fallback_plan); 238 arabic_fallback_plan_destroy (arabic_plan->fallback_plan);
239 239
240 free (data); 240 free (data);
241 } 241 }
242 242
243 static void 243 static void
244 arabic_joining (hb_buffer_t *buffer) 244 arabic_joining (hb_buffer_t *buffer)
245 { 245 {
246 unsigned int count = buffer->len; 246 unsigned int count = buffer->len;
247 hb_glyph_info_t *info = buffer->info; 247 hb_glyph_info_t *info = buffer->info;
248 unsigned int prev = (unsigned int) -1, state = 0; 248 unsigned int prev = (unsigned int) -1, state = 0;
249 249
250 /* Check pre-context */ 250 /* Check pre-context */
251 if (!(buffer->flags & HB_BUFFER_FLAG_BOT)) 251 for (unsigned int i = 0; i < buffer->context_len[0]; i++)
252 for (unsigned int i = 0; i < buffer->context_len[0]; i++) 252 {
253 { 253 unsigned int this_type = get_joining_type (buffer->context[0][i], buffer->un icode->general_category (buffer->context[0][i]));
254 unsigned int this_type = get_joining_type (buffer->context[0][i], buffer-> unicode->general_category (buffer->context[0][i]));
255 254
256 if (unlikely (this_type == JOINING_TYPE_T)) 255 if (unlikely (this_type == JOINING_TYPE_T))
257 » continue; 256 continue;
258 257
259 const arabic_state_table_entry *entry = &arabic_state_table[state][this_ty pe]; 258 const arabic_state_table_entry *entry = &arabic_state_table[state][this_type ];
260 state = entry->next_state; 259 state = entry->next_state;
261 break; 260 break;
262 } 261 }
263 262
264 for (unsigned int i = 0; i < count; i++) 263 for (unsigned int i = 0; i < count; i++)
265 { 264 {
266 unsigned int this_type = get_joining_type (info[i].codepoint, _hb_glyph_info _get_general_category (&info[i])); 265 unsigned int this_type = get_joining_type (info[i].codepoint, _hb_glyph_info _get_general_category (&info[i]));
267 266
268 if (unlikely (this_type == JOINING_TYPE_T)) { 267 if (unlikely (this_type == JOINING_TYPE_T)) {
269 info[i].arabic_shaping_action() = NONE; 268 info[i].arabic_shaping_action() = NONE;
270 continue; 269 continue;
271 } 270 }
272 271
273 const arabic_state_table_entry *entry = &arabic_state_table[state][this_type ]; 272 const arabic_state_table_entry *entry = &arabic_state_table[state][this_type ];
274 273
275 if (entry->prev_action != NONE && prev != (unsigned int) -1) 274 if (entry->prev_action != NONE && prev != (unsigned int) -1)
276 info[prev].arabic_shaping_action() = entry->prev_action; 275 info[prev].arabic_shaping_action() = entry->prev_action;
277 276
278 info[i].arabic_shaping_action() = entry->curr_action; 277 info[i].arabic_shaping_action() = entry->curr_action;
279 278
280 prev = i; 279 prev = i;
281 state = entry->next_state; 280 state = entry->next_state;
282 } 281 }
283 282
284 if (!(buffer->flags & HB_BUFFER_FLAG_EOT)) 283 for (unsigned int i = 0; i < buffer->context_len[1]; i++)
285 for (unsigned int i = 0; i < buffer->context_len[1]; i++) 284 {
286 { 285 unsigned int this_type = get_joining_type (buffer->context[1][i], buffer->un icode->general_category (buffer->context[1][i]));
287 unsigned int this_type = get_joining_type (buffer->context[1][i], buffer-> unicode->general_category (buffer->context[1][i]));
288 286
289 if (unlikely (this_type == JOINING_TYPE_T)) 287 if (unlikely (this_type == JOINING_TYPE_T))
290 » continue; 288 continue;
291 289
292 const arabic_state_table_entry *entry = &arabic_state_table[state][this_ty pe]; 290 const arabic_state_table_entry *entry = &arabic_state_table[state][this_type ];
293 if (entry->prev_action != NONE && prev != (unsigned int) -1) 291 if (entry->prev_action != NONE && prev != (unsigned int) -1)
294 » info[prev].arabic_shaping_action() = entry->prev_action; 292 info[prev].arabic_shaping_action() = entry->prev_action;
295 break; 293 break;
296 } 294 }
297 } 295 }
298 296
299 static void 297 static void
300 mongolian_variation_selectors (hb_buffer_t *buffer) 298 mongolian_variation_selectors (hb_buffer_t *buffer)
301 { 299 {
302 /* Copy arabic_shaping_action() from base to Mongolian variation selectors. */ 300 /* Copy arabic_shaping_action() from base to Mongolian variation selectors. */
303 unsigned int count = buffer->len; 301 unsigned int count = buffer->len;
304 hb_glyph_info_t *info = buffer->info; 302 hb_glyph_info_t *info = buffer->info;
305 for (unsigned int i = 1; i < count; i++) 303 for (unsigned int i = 1; i < count; i++)
306 if (unlikely (hb_in_range (info[i].codepoint, 0x180Bu, 0x180Du))) 304 if (unlikely (hb_in_range (info[i].codepoint, 0x180Bu, 0x180Du)))
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 data_create_arabic, 373 data_create_arabic,
376 data_destroy_arabic, 374 data_destroy_arabic,
377 NULL, /* preprocess_text_arabic */ 375 NULL, /* preprocess_text_arabic */
378 HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT, 376 HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
379 NULL, /* decompose */ 377 NULL, /* decompose */
380 NULL, /* compose */ 378 NULL, /* compose */
381 setup_masks_arabic, 379 setup_masks_arabic,
382 HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, 380 HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
383 true, /* fallback_position */ 381 true, /* fallback_position */
384 }; 382 };
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-ot-shape.cc ('k') | third_party/harfbuzz-ng/src/hb-ot-shape-complex-arabic-fallback.hh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698